[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Check getopt(3) for -1, not EOF
- To: bugs_(_at_)_openbsd_(_dot_)_org
- Subject: Check getopt(3) for -1, not EOF
- From: Alexey Dobriyan <adobriyan_(_at_)_gmail_(_dot_)_com>
- Date: Thu, 9 Mar 2006 01:57:36 +0300
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);
Visit your host, monkey.org