#include "menu.h"
int nentries = 0;
+int nhidden = 0;
int defentry = 0;
int allowedit = 1; /* Allow edits of the command line */
int timeout = 0;
char *menu_title = "";
char *ontimeout = NULL;
+char *onerror = NULL;
char *menu_master_passwd = NULL;
struct menu_entry menu_entries[MAX_ENTRIES];
+struct menu_entry hide_entries[MAX_ENTRIES];
struct menu_entry *menu_hotkeys[256];
#define astrdup(x) ({ char *__x = (x); \
if ( !a ) a = append;
if ( !a || (a[0] == '-' && !a[1]) ) a = "";
s = a[0] ? " " : "";
- asprintf(&me->cmdline, "%s%s%s%s", ld->kernel, ipoptions, s, a);
+ asprintf(&me->cmdline, "%s%s%s%s", ld->kernel, s, a, ipoptions);
ld->label = NULL;
ld->passwd = NULL;
nentries++;
}
+ else {
+ hide_entries[nhidden].displayname = me->displayname;
+ hide_entries[nhidden].label = me->label;
+ hide_entries[nhidden].cmdline = me->cmdline;
+ hide_entries[nhidden].passwd = me->passwd;
+
+ me->displayname = NULL;
+ me->label = NULL;
+ me->cmdline = NULL;
+ me->passwd = NULL;
+
+ nhidden++;
+ }
}
}
}
}
+ for ( i = 0 ; i < nhidden ; i++ ) {
+ me = &hide_entries[i];
+
+ if ( !strncmp(str, me->label, pos) && !me->label[pos] ) {
+ /* Found matching label */
+ q = malloc(strlen(me->cmdline) + strlen(p) + 1);
+ strcpy(q, me->cmdline);
+ strcat(q, p);
+
+ free(str);
+
+ return q;
+ }
+ }
+
return str;
}
char line[MAX_LINE], *p, *ep;
FILE *f;
char *append = NULL;
+ unsigned int ipappend = 0;
static struct labeldata ld;
get_ipappend();
ld.passwd = strdup(skipspace(p+6));
} else if ( looking_at(p, "shiftkey") ) {
shiftkey = 1;
+ } else if ( looking_at(p, "onerror") ) {
+ onerror = strdup(skipspace(p+7));
} else if ( looking_at(p, "master") ) {
p = skipspace(p+6);
if ( looking_at(p, "passwd") ) {
ld.passwd = NULL;
ld.append = NULL;
ld.menulabel = NULL;
- ld.ipappend = ld.menudefault = ld.menuhide = 0;
+ ld.ipappend = ipappend;
+ ld.menudefault = ld.menuhide = 0;
} else if ( looking_at(p, "kernel") ) {
if ( ld.label ) {
free(ld.kernel);
} else if ( looking_at(p, "totaltimeout") ) {
totaltimeout = (atoll(skipspace(p+13))*CLK_TCK+9)/10;
} else if ( looking_at(p, "ontimeout") ) {
- ontimeout = skipspace(p+9);
+ ontimeout = strdup(skipspace(p+9));
} else if ( looking_at(p, "allowoptions") ) {
allowedit = atoi(skipspace(p+12));
} else if ( looking_at(p, "ipappend") ) {
- ld.ipappend = atoi(skipspace(p+8));
+ if (ld.label)
+ ld.ipappend = atoi(skipspace(p+8));
+ else
+ ipappend = atoi(skipspace(p+8));
} else if ( looking_at(p, "localboot") ) {
ld.kernel = strdup(".localboot");
ld.append = strdup(skipspace(p+9));
if ( ontimeout )
ontimeout = unlabel(ontimeout);
+ if ( onerror )
+ onerror = unlabel(onerror);
}