Check getopt(3) for -1, not EOF

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Check getopt(3) for -1, not EOF

Alexey Dobriyan-2
Index: lib/libcurses/tinfo/captoinfo.c
===================================================================
RCS file: /cvs/src/lib/libcurses/tinfo/captoinfo.c,v
retrieving revision 1.12
diff -u -p -r1.12 captoinfo.c
--- lib/libcurses/tinfo/captoinfo.c 2003/10/15 23:33:48 1.12
+++ lib/libcurses/tinfo/captoinfo.c 2006/03/08 22:17:15
@@ -807,7 +807,7 @@ main(int argc, char *argv[])
 {
     int c, tc = FALSE;
 
-    while ((c = getopt(argc, argv, "c")) != EOF)
+    while ((c = getopt(argc, argv, "c")) != -1)
  switch (c) {
  case 'c':
     tc = TRUE;
Index: usr.bin/mklocale/yacc.y
===================================================================
RCS file: /cvs/src/usr.bin/mklocale/yacc.y,v
retrieving revision 1.1
diff -u -p -r1.1 yacc.y
--- usr.bin/mklocale/yacc.y 2005/08/07 10:06:25 1.1
+++ usr.bin/mklocale/yacc.y 2006/03/08 22:27:20
@@ -245,7 +245,7 @@ main(int ac, char *av[])
     extern char *optarg;
     extern int optind;
 
-    while ((x = getopt(ac, av, "do:")) != EOF) {
+    while ((x = getopt(ac, av, "do:")) != -1) {
  switch(x) {
  case 'd':
     debug = 1;
Index: usr.sbin/httpd/src/regex/main.c
===================================================================
RCS file: /cvs/src/usr.sbin/httpd/src/regex/main.c,v
retrieving revision 1.4
diff -u -p -r1.4 main.c
--- usr.sbin/httpd/src/regex/main.c 2004/12/02 19:42:48 1.4
+++ usr.sbin/httpd/src/regex/main.c 2006/03/08 22:30:02
@@ -42,7 +42,7 @@ char *argv[];
 
  progname = argv[0];
 
- while ((c = getopt(argc, argv, "c:e:S:E:x")) != EOF)
+ while ((c = getopt(argc, argv, "c:e:S:E:x")) != -1)
  switch (c) {
  case 'c': /* compile options */
  copts = options('c', optarg);