SCP: Allow a bare % at the end of a line for SET THROTTLE nn%

Fix #678
This commit is contained in:
Mark Pizzolato 2019-04-11 12:35:06 -07:00
parent 4babf7f529
commit d12ae2a3f3

7
scp.c
View file

@ -4095,7 +4095,7 @@ return ap;
Token "%0" represents the command file name. Token "%0" represents the command file name.
The input sequence "\%" represents a literal "%", and "\\" represents a The input sequence "%%" represents a literal "%", and "\\" represents a
literal "\". All other character combinations are rendered literally. literal "\". All other character combinations are rendered literally.
Omitted parameters result in null-string substitutions. Omitted parameters result in null-string substitutions.
@ -4201,6 +4201,10 @@ for (; *ip && (op < oend); ) {
} }
++ip; ++ip;
} }
else {
if (*ip == '\0') { /* is this a bare % at end of line? */
*op++ = '%'; /* leave it there as a literal percent sign */
}
else { else {
get_glyph_nc (ip, gbuf, '%'); /* get the literal name */ get_glyph_nc (ip, gbuf, '%'); /* get the literal name */
ap = _sim_get_env_special (gbuf, rbuf, sizeof (rbuf)); ap = _sim_get_env_special (gbuf, rbuf, sizeof (rbuf));
@ -4209,6 +4213,7 @@ for (; *ip && (op < oend); ) {
++ip; ++ip;
} }
} }
}
if (ap) { /* non-null arg? */ if (ap) { /* non-null arg? */
char *expanded = NULL; char *expanded = NULL;