SCP: Properly report errors in malformed SET ENV -P commands

This commit is contained in:
Mark Pizzolato 2019-02-19 12:11:29 -08:00
parent 52817a58b9
commit 857934d40e

4
scp.c
View file

@ -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) {