Thank you for your patch, I commited the following instead.  It will
error out earlier, and keep the parsing routines in one place.

2010-07-10  Alfred M. Szmidt  <[email protected]>

        * ifconfig/options.c (parse_opt_set_default_format): Abort if no
        output format could be found.

diff --git a/ifconfig/options.c b/ifconfig/options.c
index 3e3a196..752aa47 100644
--- a/ifconfig/options.c
+++ b/ifconfig/options.c
@@ -376,15 +376,10 @@ parse_opt_set_default_format (const char *format)
     format = system_default_format ? system_default_format : "default";
 
   for (frm = formats; frm->name; frm++)
-    {
-      if (!strcmp (format, frm->name))
-       {
-         default_format = frm->templ;
-         return;
-       }
-    }
-
-  default_format = format;
+    if (!strcmp (format, frm->name)) break;
+  if (frm == NULL || frm->templ == NULL)
+    error (EXIT_FAILURE, 0, "%s: unknown output format", format);
+  default_format = frm->templ;
 }
 
 static int

Reply via email to