Handle windowtype and CHOOSE config errors

This commit is contained in:
Pasi Kallinen
2017-09-09 13:50:34 +03:00
parent 87f991ecfc
commit cfb09c9bf8
5 changed files with 16 additions and 6 deletions
+4
View File
@@ -2293,6 +2293,10 @@ int src;
section = choose_random_part(bufp, ','); section = choose_random_part(bufp, ',');
if (section) if (section)
config_section_chosen = dupstr(section); config_section_chosen = dupstr(section);
else {
config_error_add("No config section to choose");
retval = 0;
}
} else if (match_varname(buf, "AUTOPICKUP_EXCEPTION", 5)) { } else if (match_varname(buf, "AUTOPICKUP_EXCEPTION", 5)) {
add_autopickup_exception(bufp); add_autopickup_exception(bufp);
} else if (match_varname(buf, "BINDINGS", 4)) { } else if (match_varname(buf, "BINDINGS", 4)) {
+1 -2
View File
@@ -1200,9 +1200,8 @@ int iscompound; /* 0 == boolean option, 1 == compound */
* For now just return. * For now just return.
*/ */
#else /* !MAC */ #else /* !MAC */
raw_printf("\nWarning - %s option specified multiple times: %s.\n", config_error_add("%s option specified multiple times: %s.\n",
iscompound ? "compound" : "boolean", opts); iscompound ? "compound" : "boolean", opts);
wait_synch();
#endif /* ?MAC */ #endif /* ?MAC */
return; return;
} }
+7 -4
View File
@@ -238,22 +238,25 @@ const char *s;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (!winchoices[1].procs) { if (!winchoices[1].procs) {
raw_printf("Window type %s not recognized. The only choice is: %s.", config_error_add("Window type %s not recognized. The only choice is: %s",
s, winchoices[0].procs->name); s, winchoices[0].procs->name);
} else { } else {
raw_printf("Window type %s not recognized. Choices are:", s); char buf[BUFSZ];
boolean first = TRUE;
buf[0] = '\0';
for (i = 0; winchoices[i].procs; i++) { for (i = 0; winchoices[i].procs; i++) {
if ('+' == winchoices[i].procs->name[0]) if ('+' == winchoices[i].procs->name[0])
continue; continue;
if ('-' == winchoices[i].procs->name[0]) if ('-' == winchoices[i].procs->name[0])
continue; continue;
raw_printf(" %s", winchoices[i].procs->name); Sprintf(eos(buf), "%s%s", first ? "" : ",", winchoices[i].procs->name);
first = FALSE;
} }
config_error_add("Window type %s not recognized. Choices are: %s", s, buf);
} }
if (windowprocs.win_raw_print == def_raw_print) if (windowprocs.win_raw_print == def_raw_print)
nh_terminate(EXIT_SUCCESS); nh_terminate(EXIT_SUCCESS);
wait_synch();
} }
#ifdef WINCHAIN #ifdef WINCHAIN
+2
View File
@@ -776,7 +776,9 @@ char *argv[];
NHWinMainInit(); NHWinMainInit();
} }
*/ */
config_error_init(FALSE, "command line");
choose_windows(&argv[0][2]); choose_windows(&argv[0][2]);
config_error_done();
break; break;
#endif #endif
case '@': case '@':
+2
View File
@@ -405,7 +405,9 @@ char *argv[];
} }
break; break;
case 'w': /* windowtype */ case 'w': /* windowtype */
config_error_init(FALSE, "command line");
choose_windows(&argv[0][2]); choose_windows(&argv[0][2]);
config_error_done();
break; break;
case '@': case '@':
flags.randomall = 1; flags.randomall = 1;