#ifndef __CONFIG_H__
#define __CONFIG_H__
+/*
+ * These values correspond to the "default" and "ui" commands
+ * respectively. "ui" takes precendence over "default".
+ */
+#define LEVEL_DEFAULT 1
+#define LEVEL_UI 2
+
extern short uappendlen; //bytes in append= command
extern short ontimeoutlen; //bytes in ontimeout command
extern short onerrorlen; //bytes in onerror command
extern short displaycon; //conio.inc
extern short nohalt; //idle.inc
+extern char *default_cmd; //"default" command line
+
#endif /* __CONFIG_H__ */
short displaycon = 1; //conio.inc
short nohalt = 1; //idle.inc
+char *default_cmd = NULL; //"default" command line
/* Empty refstring */
const char *empty_string;
else
ipappend = atoi(skipspace(p + 8));
} else if (looking_at(p, "default")) {
- /* default could be a kernel image or another label */
- refstr_put(globaldefault);
- globaldefault = refstrdup(skipspace(p + 7));
+ /* default could be a kernel image or another label */
+ refstr_put(globaldefault);
+ globaldefault = refstrdup(skipspace(p + 7));
+
+ /*
+ * On the chance that "default" is actually a kernel image
+ * and not a label, store a copy of it, but only if we
+ * haven't seen a "ui" command. "ui" commands take
+ * precendence over "default" commands.
+ */
+ if (defaultlevel < LEVEL_UI) {
+ defaultlevel = LEVEL_DEFAULT;
+ refstr_put(default_cmd);
+ default_cmd = refstrdup(globaldefault);
+ }
} else if (looking_at(p, "ui")) {
has_ui = 1;
+ defaultlevel = LEVEL_UI;
+ refstr_put(default_cmd);
+ default_cmd = refstrdup(skipspace(p + 2));
}
/*