@@ -205,6 +205,7 @@ static void perform_echo_dot(const char *arg);
205205static void perform_echo (const char * arg );
206206static void perform_elfexec (const char * arg );
207207static void perform_elfload (const char * arg );
208+ static void perform_elfload2 (const char * arg );
208209static void perform_exit (const char * arg );
209210static void perform_for (const char * arg );
210211static void perform_goto (const char * arg );
@@ -261,6 +262,7 @@ struct built_in_cmd cmd_table[] =
261262 {"echo" , perform_echo , "" , "terminal output" },
262263 {"elfexec" , perform_elfexec , "" , "execute elf file" },
263264 {"elfload" , perform_elfload , "" , "load host's elf file" },
265+ {"elfload2" , perform_elfload2 , "" , "load host's elf file" },
264266 {"exit" , perform_exit , "" , "exit from interpreter" },
265267 {"for" , perform_for , "" , "FOR loop" },
266268 {"goto" , perform_goto , "" , "move to label" },
@@ -2779,6 +2781,32 @@ static void perform_elfload(const char *arg)
27792781#endif
27802782 }
27812783
2784+ static void perform_elfload2 (const char * arg )
2785+ {
2786+ #ifdef DJ64
2787+ char * cs ;
2788+ #endif
2789+ if (!arg || !arg [0 ])
2790+ {
2791+ cprintf ("Syntax error\r\n" );
2792+ reset_batfile_call_stack ();
2793+ return ;
2794+ }
2795+ #ifdef DJ64
2796+ cs = getenv ("COMSPEC" );
2797+ if (!cs )
2798+ {
2799+ printf ("COMSPEC not set\n" );
2800+ return ;
2801+ }
2802+ setenv ("ELFLOAD" , arg , 1 );
2803+ perform_external_cmd (false, false, cs );
2804+ unsetenv ("ELFLOAD" );
2805+ #else
2806+ printf ("elfload2 unsupported\n" );
2807+ #endif
2808+ }
2809+
27822810static void perform_break (const char * arg )
27832811 {
27842812 if (stricmp (arg , "off" ) == 0 )
0 commit comments