possible. It requires a Linux/VT220/ANSI-compatible terminal on the
other end.
+
+ +++ USING AN ALTERNATE CONFIGURATION FILE +++
+
+
It is also possible to load a secondary configuration file, to get to
another menu. To do that, invoke menu.c32 with the name of the
secondary configuration file.
MENU LABEL Another Menu
KERNEL menu.c32
APPEND othermenu.conf
+
+If you specify more than one file, they will all be read, in the order
+specified. However, global APPEND and IPAPPEND will only apply to the
+file currently being processed.
+
+# The file graphics.conf contains common color and layout commands for
+# all menus.
+LABEL othermenu
+ MENU LABEL Another Menu
+ KERNEL vesamenu.c32
+ APPEND graphics.conf othermenu.conf
extern char *menu_background;
-void parse_config(const char *filename);
+void parse_configs(char **argv);
extern int (*draw_background)(const char *filename);
static inline int my_isspace(char c)
}
WIDTH = cols;
- parse_config(argv[1]);
+ parse_configs(argv+1);
/* If anyone has specified negative parameters, consider them
relative to the bottom row of the screen. */
return argb;
}
-void parse_config(const char *filename)
+static void parse_config_file(FILE *f)
{
char line[MAX_LINE], *p, *ep;
- FILE *f;
char *append = NULL;
unsigned int ipappend = 0;
- static struct labeldata ld;
+ struct labeldata ld;
- get_ipappend();
-
- if ( !filename )
- filename = get_config();
-
- f = fopen(filename, "r");
- if ( !f )
- return;
+ memset(&ld, 0, sizeof ld);
while ( fgets(line, sizeof line, f) ) {
p = strchr(line, '\r');
}
record(&ld, append);
+}
+
+static int parse_one_config(const char *filename)
+{
+ FILE *f = fopen(filename, "r");
+ if ( !f )
+ return -1;
+
+ parse_config_file(f);
fclose(f);
+ return 0;
+}
+
+void parse_configs(char **argv)
+{
+ const char *filename;
+
+ get_ipappend();
+
+ if ( !*argv ) {
+ parse_one_config(get_config());
+ } else {
+ while ( (filename = *argv++) )
+ parse_one_config(filename);
+ }
+
+ /* Common postprocessing */
+
if ( ontimeout )
ontimeout = unlabel(ontimeout);
if ( onerror )