Skip to content

Commit

Permalink
preliminary elfexec impl
Browse files Browse the repository at this point in the history
Args are not passed yet.
  • Loading branch information
stsp committed Oct 21, 2024
1 parent 282de1e commit eefad73
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@
#include <sys/segments.h>
#include <sys/farptr.h>
#include <go32.h>
#ifdef DJ64
#include <go64.h>
#endif

#include "cmdbuf.h"
#ifdef DJ64
Expand Down Expand Up @@ -200,6 +203,7 @@ static void perform_deltree(const char *arg);
static void perform_dir(const char *arg);
static void perform_echo_dot(const char *arg);
static void perform_echo(const char *arg);
static void perform_elfexec(const char *arg);
static void perform_exit(const char *arg);
static void perform_for(const char *arg);
static void perform_goto(const char *arg);
Expand Down Expand Up @@ -254,6 +258,7 @@ struct built_in_cmd cmd_table[] =
{"dir", perform_dir, "", "directory listing"},
{"echo.", perform_echo_dot, "", "terminal output"}, // before normal echo
{"echo", perform_echo, "", "terminal output"},
{"elfexec", perform_elfexec, "", "execute elf file"},
{"exit", perform_exit, "", "exit from interpreter"},
{"for", perform_for, "", "FOR loop"},
{"goto", perform_goto, "", "move to label"},
Expand Down Expand Up @@ -2677,6 +2682,21 @@ static void perform_echo(const char *arg)
puts(cmd_args);
}

static void perform_elfexec(const char *arg)
{
if (!arg || !arg[0])
{
cprintf("Syntax error\r\n");
reset_batfile_call_stack();
return;
}
#ifdef DJ64
elfexec(arg, 0, NULL);
#else
printf("elfexec unsupported\n");
#endif
}

static void perform_break(const char *arg)
{
if (stricmp(arg, "off") == 0)
Expand Down

0 comments on commit eefad73

Please sign in to comment.