work.
+MENU WIDTH 80
+MENU MARGIN 10
+MENU PASSWORDMARGIN 3
+MENU ROWS 12
+MENU TABMSGROW 18
+MENU CMDLINEROW 20
+MENU ENDROW 24
+MENU PASSWORDROW 11
+
+ These options control the layout of the menu on the screen.
+ The values above are the defaults.
+
+
The menu system honours the TIMEOUT command; if TIMEOUT is specified
it will execute the ONTIMEOUT command if one exists, otherwise it will
pick the default menu option.
static const struct menu_attrib *menu_attrib = &default_attrib;
-#define WIDTH 80
-#define MARGIN 10
-#define PASSWD_MARGIN 3
-#define MENU_ROWS 12
-#define TABMSG_ROW 18
-#define CMDLINE_ROW 20
-#define END_ROW 24
-#define PASSWD_ROW 11
+struct menu_parameter mparm[] = {
+ { "width", 80 },
+ { "margin", 10 },
+ { "passwordmargin", 3 },
+ { "rows", 12 },
+ { "tabmsgrow", 18 },
+ { "cmdlinerow", 20 },
+ { "endrow", 24 },
+ { "passwordrow", 11 },
+ { NULL, 0 }
+};
+
+#define WIDTH mparm[0].value
+#define MARGIN mparm[1].value
+#define PASSWD_MARGIN mparm[2].value
+#define MENU_ROWS mparm[3].value
+#define TABMSG_ROW mparm[4].value
+#define CMDLINE_ROW mparm[5].value
+#define END_ROW mparm[6].value
+#define PASSWD_ROW mparm[7].value
static char *
pad_line(const char *text, int align, int width)
#ident "$Id$"
/* ----------------------------------------------------------------------- *
*
- * Copyright 2004 H. Peter Anvin - All Rights Reserved
+ * Copyright 2004-2005 H. Peter Anvin - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
extern struct menu_entry menu_entries[];
extern struct menu_entry *menu_hotkeys[256];
+struct menu_parameter {
+ const char *name;
+ int value;
+};
+
+extern struct menu_parameter mparm[];
+
extern int nentries;
extern int defentry;
extern int allowedit;
ld.passwd = strdup(skipspace(p+6));
} else if ( looking_at(p, "master") ) {
p = skipspace(p+6);
- if ( looking_at (p, "passwd") ) {
+ if ( looking_at(p, "passwd") ) {
menu_master_passwd = strdup(skipspace(p+6));
}
} else {
- /* Unknown, ignore for now */
+ /* Unknown, check for parameters */
+ struct menu_parameter *pp;
+ for ( pp = mparm ; pp->name ; pp++ ) {
+ if ( looking_at(p, pp->name) ) {
+ p = skipspace(p+strlen(pp->name));
+ pp->value = atoi(p);
+ break;
+ }
+ }
}
} else if ( looking_at(p, "append") ) {
char *a = strdup(skipspace(p+6));