1
0
mirror of https://github.com/simh/simh.git synced 2026-02-27 17:13:44 +00:00

SCP: Remove switches from startup argv list when they are digested

export commonly used set_dev_enbdis API in scp.h
This commit is contained in:
Mark Pizzolato
2023-03-04 13:32:59 -10:00
parent 2c9dce6cf2
commit bdf28cf7f8
2 changed files with 9 additions and 0 deletions

8
scp.c
View File

@@ -2903,12 +2903,20 @@ for (i = 1; i < argc; i++) { /* loop thru args */
if (argv[i] == NULL) /* paranoia */
continue;
if ((*argv[i] == '-') && lookswitch) { /* switch? */
int arg;
if (get_switches (argv[i], &sw, NULL) == SW_ERROR) {
fprintf (stderr, "Invalid switch %s\n", argv[i]);
free (targv);
return EXIT_FAILURE;
}
sim_switches = sim_switches | sw;
/* Remove digested switch special argument to avoid confusion later */
for (arg = i + 1; argv[arg] != NULL; arg++)
argv[arg - 1] = argv[arg];
argv[arg] = NULL;
--argc;
--i;
}
else {
if ((strlen (argv[i]) + strlen (cbuf) + 3) >= sizeof(cbuf)) {

1
scp.h
View File

@@ -243,6 +243,7 @@ CONST char *match_ext (CONST char *fnam, const char *ext);
int sim_cmp_string (const char *s1, const char *s2);
t_stat sim_fetch_binary_file (const char *filename, const char *filepath, size_t size, unsigned int checksum);
t_stat show_version (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat set_dev_enbdis (DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat set_dev_debug (DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat show_dev_debug (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
t_stat sim_add_debug_flags (DEVICE *dptr, DEBTAB *debflags);