]> sourceware.org Git - glibc.git/commitdiff
Fix warnings. Better error message for missing -c argument.
authorUlrich Drepper <drepper@redhat.com>
Mon, 6 Oct 2003 21:20:39 +0000 (21:20 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 6 Oct 2003 21:20:39 +0000 (21:20 +0000)
manual/examples/testopt.c

index 94baf4db553327f7f73751cb7f8cf4127c2dc3a6..44ca8e4ad0a2cb985567f91cbb65d0b0dd6a6633 100644 (file)
@@ -1,8 +1,10 @@
 /*@group*/
-#include <unistd.h>
+#include <ctype.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
 
-int 
+int
 main (int argc, char **argv)
 {
   int aflag = 0;
@@ -28,7 +30,9 @@ main (int argc, char **argv)
         cvalue = optarg;
         break;
       case '?':
-        if (isprint (optopt))
+        if (optopt == 'c')
+          fprintf (stderr, "Option -%c requires an argument.\n", optopt);
+        else if (isprint (optopt))
           fprintf (stderr, "Unknown option `-%c'.\n", optopt);
         else
           fprintf (stderr,
This page took 0.048098 seconds and 5 git commands to generate.