summaryrefslogtreecommitdiff
path: root/usr.bin/env/env.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-12-08 16:50:08 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-12-08 16:50:08 +0000
commitc5a38b6fdf1c2335f7f5558976e478f12d297990 (patch)
treea24f21bafd589dbe349a9eb8ce3651b05695577c /usr.bin/env/env.c
parent575d3fc4197705961dd3a1a91780df758087ebec (diff)
GNU semantics say that if optstring begins with '-' then
each non-option shall be treated as arguments to option '\1'. BSD getopt match '-' in optstring with a '-' on the command line. This is used to support deprecated options like "su -" that would otherwise prevent the use of getopt(). Resolving this simply requires that the leading '-' be moved somewhere else (I moved it to the end of optstring) since position within optstring is not meaningful.
Diffstat (limited to 'usr.bin/env/env.c')
-rw-r--r--usr.bin/env/env.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/env/env.c b/usr.bin/env/env.c
index 2f6fe09a0e6..eda66a36569 100644
--- a/usr.bin/env/env.c
+++ b/usr.bin/env/env.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: env.c,v 1.7 2002/02/16 21:27:45 millert Exp $ */
+/* $OpenBSD: env.c,v 1.8 2002/12/08 16:50:07 millert Exp $ */
/*
* Copyright (c) 1988, 1993, 1994
@@ -41,7 +41,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "@(#)env.c 8.3 (Berkeley) 4/2/94";*/
-static char rcsid[] = "$OpenBSD: env.c,v 1.7 2002/02/16 21:27:45 millert Exp $";
+static char rcsid[] = "$OpenBSD: env.c,v 1.8 2002/12/08 16:50:07 millert Exp $";
#endif /* not lint */
#include <err.h>
@@ -66,7 +66,7 @@ main(argc, argv)
setlocale(LC_ALL, "");
- while ((ch = getopt(argc, argv, "-i")) != -1)
+ while ((ch = getopt(argc, argv, "i-")) != -1)
switch((char)ch) {
case '-': /* obsolete */
case 'i':