aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-10-06 21:20:39 +0000
committerUlrich Drepper <drepper@redhat.com>2003-10-06 21:20:39 +0000
commitb7129dfbc1f5cea432e97dbe6e1556581af9682e (patch)
treec42c622b57154bf4ccd0055e368dca8931e7be9f
parentb631be849dd67f0633d0b1adf16b099bd240e2e5 (diff)
downloadglibc-b7129dfbc1f5cea432e97dbe6e1556581af9682e.zip
glibc-b7129dfbc1f5cea432e97dbe6e1556581af9682e.tar.gz
glibc-b7129dfbc1f5cea432e97dbe6e1556581af9682e.tar.bz2
Fix warnings. Better error message for missing -c argument.
-rw-r--r--manual/examples/testopt.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/manual/examples/testopt.c b/manual/examples/testopt.c
index 94baf4d..44ca8e4 100644
--- a/manual/examples/testopt.c
+++ b/manual/examples/testopt.c
@@ -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,