Print an error message if the configuration file seems empty.
authorhpa <hpa>
Tue, 4 Jan 2005 03:04:00 +0000 (03:04 +0000)
committerhpa <hpa>
Tue, 4 Jan 2005 03:04:00 +0000 (03:04 +0000)
com32/modules/Makefile
com32/modules/menu.c

index 8f7ff0a..23efeb5 100644 (file)
@@ -20,14 +20,14 @@ gcc_ok   = $(shell if gcc $(1) -c -x c /dev/null -o /dev/null 2>/dev/null; \
 
 M32     := $(call gcc_ok,-m32,)
 
-CC         = gcc $(M32)
+CC         = gcc
 LD         = ld -m elf_i386
 AR        = ar
 NASM      = nasm
 RANLIB    = ranlib
-CFLAGS     = -mregparm=3 -DREGPARM=3 -W -Wall -march=i386 -Os -fomit-frame-pointer -I../libutil/include -I../include  -D__COM32__
-LNXCFLAGS  = -W -Wall -march=i386 -Os -g -I../libutil/include
-LNXSFLAGS  = -march=i386
+CFLAGS     = $(M32) -mregparm=3 -DREGPARM=3 -W -Wall -march=i386 -Os -fomit-frame-pointer -I../libutil/include -I../include  -D__COM32__
+LNXCFLAGS  = -W -Wall -O -g -I../libutil/include
+LNXSFLAGS  = -g
 LNXLDFLAGS = -g
 SFLAGS     = -D__COM32__ -march=i386
 LDFLAGS    = -T ../lib/com32.ld
index 9b91868..039e55c 100644 (file)
@@ -1,7 +1,7 @@
 #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
@@ -399,7 +399,8 @@ void __attribute__((noreturn)) execute(const char *cmdline)
 
 int main(int argc, char *argv[])
 {
-  const char *cmdline;
+  const char *cmdline = NULL;
+  int err = 0;
 
   (void)argc;
 
@@ -408,10 +409,16 @@ int main(int argc, char *argv[])
 
   parse_config(argv[1]);
 
-  cmdline = run_menu();
+  if ( !nentries ) {
+    fputs("No LABEL entries found in configuration file!\n", stdout);
+    err = 1;
+  } else {
+    cmdline = run_menu();
+  }
+
   printf("\033[?25h\033[%d;1H\033[0m", END_ROW);
   if ( cmdline )
     execute(cmdline);
   else
-    return 0;
+    return err;
 }