From 3dcd8c4aebf5203dff6e9d4c88414c207e0ab74c Mon Sep 17 00:00:00 2001 From: millert <> Date: Wed, 15 Jan 1997 23:43:43 +0000 Subject: getopt(3) returns -1 when out of args, not EOF, whee! --- src/regress/lib/libc/db/dbtest.c | 2 +- src/regress/lib/libc/regex/main.c | 4 ++-- src/usr.bin/nc/netcat.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/regress/lib/libc/db/dbtest.c b/src/regress/lib/libc/db/dbtest.c index 65587a6fcb..ac9eaa48fd 100644 --- a/src/regress/lib/libc/db/dbtest.c +++ b/src/regress/lib/libc/db/dbtest.c @@ -107,7 +107,7 @@ main(argc, argv) fname = NULL; oflags = O_CREAT | O_RDWR; sflag = 0; - while ((ch = getopt(argc, argv, "f:i:lo:s")) != EOF) + while ((ch = getopt(argc, argv, "f:i:lo:s")) != -1) switch (ch) { case 'f': fname = optarg; diff --git a/src/regress/lib/libc/regex/main.c b/src/regress/lib/libc/regex/main.c index add5e8be10..6e63ffc235 100644 --- a/src/regress/lib/libc/regex/main.c +++ b/src/regress/lib/libc/regex/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.2 1996/12/21 22:23:42 millert Exp $ */ +/* $OpenBSD: main.c,v 1.3 1997/01/15 23:41:07 millert Exp $ */ /* $NetBSD: main.c,v 1.2 1995/04/20 22:39:51 cgd Exp $ */ #include @@ -47,7 +47,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); diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c index 5ceb4f1d2f..f6c10424a7 100644 --- a/src/usr.bin/nc/netcat.c +++ b/src/usr.bin/nc/netcat.c @@ -1389,7 +1389,7 @@ main (argc, argv) /* If your shitbox doesn't have getopt, step into the nineties already. */ /* optarg, optind = next-argv-component [i.e. flag arg]; optopt = last-char */ - while ((x = getopt (argc, argv, "ae:g:G:hi:lno:p:rs:tuvw:z")) != EOF) { + while ((x = getopt (argc, argv, "ae:g:G:hi:lno:p:rs:tuvw:z")) != -1) { /* Debug (("in go: x now %c, optarg %x optind %d", x, optarg, optind)) */ switch (x) { case 'a': -- cgit v1.2.3-55-g6feb