Tweeks to option lettering ... to allow 51 options per menu. Also

to generate an error if there are more.  (Checkpoint before furthur
changes to recognize more keypad keys.)
This commit is contained in:
phil 1998-06-25 19:57:10 +00:00
parent e997d4ac60
commit 0c35cc0adb
2 changed files with 21 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: mdb.c,v 1.6 1998/06/25 09:58:57 phil Exp $ */
/* $NetBSD: mdb.c,v 1.7 1998/06/25 19:57:10 phil Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -209,9 +209,20 @@ write_menu_file (char *initcode)
toptn = menus[i]->info->optns;
opt_ch = 'a';
while (toptn != NULL) {
(void) fprintf (out_file, "\t\"%c: %s,\n", opt_ch++,
(void) fprintf (out_file, "\t\"%c: %s,\n", opt_ch,
toptn->name+1);
toptn = toptn->next;
if (opt_ch == 'z')
opt_ch = 'A';
else if (opt_ch == 'x')
opt_ch = 'y';
else if (opt_ch == 'Z') {
(void) fprintf (stderr, "Menu %s has "
"too many options.\n",
menus[i]->info->title);
exit (1);
} else
opt_ch++;
}
(void) fprintf (out_file, "\t(char *)NULL\n};\n\n");
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: menu_sys.def,v 1.7 1998/06/25 09:58:57 phil Exp $ */
/* $NetBSD: menu_sys.def,v 1.8 1998/06/25 19:57:10 phil Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -402,7 +402,13 @@ static void process_req (struct menudesc *m, int num, int req)
m->cursel = m->numopts;
refresh = 1;
} else {
ch = ch - 'a';
if (ch > 'z')
ch = 255;
if (ch >= 'a') {
if (ch > 'x') ch--;
ch = ch - 'a';
} else
ch = 25 + ch - 'A';
if (ch < 0 || ch >= m->numopts)
mbeep();
else {