diff --git a/scp.c b/scp.c index 9f8f4dac..14c2c927 100644 --- a/scp.c +++ b/scp.c @@ -1755,6 +1755,10 @@ static const char simh_help[] = " in the current do command file which is encountered. Since labels\n" " don't do anything else besides being the targets of goto's, they could\n" " also be used to provide comments in do command files.\n\n" + "++GOTO :EOF\n\n" + " The target label of :EOF is explicitly defined to mean the end of the\n" + " DO command file. This will cause the execution to return from the current\n" + " command file.\n\n" "4Examples\n\n" "++:: This is a comment\n" "++echo Some Message to Output\n" @@ -5049,6 +5053,13 @@ if ('\0' == gbuf1[0]) /* unspecified goto targ fpos = ftell(sim_gotofile); /* Save start position */ if (fpos < 0) return sim_messagef (SCPE_IERR, "goto ftell error: %s\n", strerror (errno)); +if (strcasecmp(":EOF", gbuf1) == 0) { + if (fseek (sim_gotofile, 0, SEEK_END)) + return sim_messagef (SCPE_IERR, "goto seek error: %s\n", strerror (errno)); + sim_brk_clract (); /* goto defangs current actions */ + sim_do_echo = saved_do_echo; /* restore echo mode */ + return SCPE_OK; + } rewind(sim_gotofile); /* start search for label */ sim_goto_line[sim_do_depth] = 0; /* reset line number */ sim_do_echo = 0; /* Don't echo while searching for label */