SCP: Properly report errors in malformed SET ENV -P commands
This commit is contained in:
parent
52817a58b9
commit
857934d40e
1 changed files with 4 additions and 0 deletions
4
scp.c
4
scp.c
|
@ -5091,10 +5091,14 @@ if (sim_switches & SWMASK ('P')) {
|
||||||
if (prompt[0] == '\0')
|
if (prompt[0] == '\0')
|
||||||
return sim_messagef (SCPE_2FARG, "Missing Prompt and Environment Variable Name\n");
|
return sim_messagef (SCPE_2FARG, "Missing Prompt and Environment Variable Name\n");
|
||||||
if ((prompt[0] == '"') || (prompt[0] == '\'')) {
|
if ((prompt[0] == '"') || (prompt[0] == '\'')) {
|
||||||
|
if (strlen (prompt) < 3)
|
||||||
|
return sim_messagef (SCPE_ARG, "Invalid Prompt\n");
|
||||||
prompt[strlen (prompt) - 1] = '\0';
|
prompt[strlen (prompt) - 1] = '\0';
|
||||||
memmove (prompt, prompt + 1, strlen (prompt));
|
memmove (prompt, prompt + 1, strlen (prompt));
|
||||||
}
|
}
|
||||||
deflt = get_glyph (cptr, varname, '='); /* get environment variable name */
|
deflt = get_glyph (cptr, varname, '='); /* get environment variable name */
|
||||||
|
if (varname[0] == '\0')
|
||||||
|
return sim_messagef (SCPE_2FARG, "Missing Environment Variable Name\n");
|
||||||
if (deflt == NULL)
|
if (deflt == NULL)
|
||||||
deflt = "";
|
deflt = "";
|
||||||
if (*deflt) {
|
if (*deflt) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue