SCP: Allow spawn commands to not require space after !

This commit is contained in:
Mark Pizzolato 2016-05-30 04:14:45 -07:00
parent e67bf602a0
commit 8b08e6c2d9
2 changed files with 16 additions and 3 deletions

18
scp.c
View file

@ -2050,11 +2050,12 @@ while (stat != SCPE_EXIT) { /* in case exit */
fprintf (sim_log, "%s%s\n", sim_prompt, cptr);
if (sim_deb && (sim_deb != sim_log) && (sim_deb != stdout))
fprintf (sim_deb, "%s%s\n", sim_prompt, cptr);
cptr = get_glyph (cptr, gbuf, 0); /* get command glyph */
cptr = get_glyph_cmd (cptr, gbuf); /* get command glyph */
sim_switches = 0; /* init switches */
if ((cmdp = find_cmd (gbuf))) /* lookup command */
stat = cmdp->action (cmdp->arg, cptr); /* if found, exec */
else stat = SCPE_UNK;
else
stat = SCPE_UNK;
stat_nomessage = stat & SCPE_NOMESSAGE; /* extract possible message supression flag */
stat_nomessage = stat_nomessage || (!sim_show_message);/* Apply global suppression */
stat = SCPE_BARE_STATUS(stat); /* remove possible flag */
@ -2805,7 +2806,7 @@ do {
sim_printf("%s> %s\n", do_position(), cptr);
if (*cptr == ':') /* ignore label */
continue;
cptr = get_glyph (cptr, gbuf, 0); /* get command glyph */
cptr = get_glyph_cmd (cptr, gbuf); /* get command glyph */
sim_switches = 0; /* init switches */
sim_gotofile = fpin;
sim_do_echo = echo;
@ -7227,6 +7228,7 @@ return cptr;
/* get_glyph get next glyph (force upper case)
get_glyph_nc get next glyph (no conversion)
get_glyph_quoted get next glyph (potentially enclosed in quotes, no conversion)
get_glyph_cmd get command glyph (force upper case, extract leading !)
get_glyph_gen get next glyph (general case)
Inputs:
@ -7296,6 +7298,16 @@ CONST char *get_glyph_quoted (const char *iptr, char *optr, char mchar)
return (CONST char *)get_glyph_gen (iptr, optr, mchar, FALSE, TRUE, '\\');
}
CONST char *get_glyph_cmd (const char *iptr, char *optr)
{
/* Tolerate "!subprocess" vs. requiring "! subprocess" */
if ((iptr[0] == '!') && (!sim_isspace(iptr[1]))) {
strcpy (optr, "!"); /* return ! as command glyph */
return (CONST char *)(iptr + 1); /* and skip over the leading ! */
}
return (CONST char *)get_glyph_gen (iptr, optr, 0, TRUE, FALSE, 0);
}
/* Trim trailing spaces from a string
Inputs:

1
scp.h
View file

@ -152,6 +152,7 @@ CONST char *get_sim_opt (int32 opt, CONST char *cptr, t_stat *st);
CONST char *get_glyph (const char *iptr, char *optr, char mchar);
CONST char *get_glyph_nc (const char *iptr, char *optr, char mchar);
CONST char *get_glyph_quoted (const char *iptr, char *optr, char mchar);
CONST char *get_glyph_cmd (const char *iptr, char *optr);
t_value get_uint (const char *cptr, uint32 radix, t_value max, t_stat *status);
CONST char *get_range (DEVICE *dptr, CONST char *cptr, t_addr *lo, t_addr *hi,
uint32 rdx, t_addr max, char term);