summaryrefslogtreecommitdiff
path: root/usr.bin/xstr/xstr.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/xstr/xstr.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/xstr/xstr.c')
-rw-r--r--usr.bin/xstr/xstr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/xstr/xstr.c b/usr.bin/xstr/xstr.c
index b51a67e9592..896b13ae3df 100644
--- a/usr.bin/xstr/xstr.c
+++ b/usr.bin/xstr/xstr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xstr.c,v 1.9 2002/02/24 02:25:48 deraadt Exp $ */
+/* $OpenBSD: xstr.c,v 1.10 2002/12/08 16:50:07 millert Exp $ */
/* $NetBSD: xstr.c,v 1.5 1994/12/24 16:57:59 cgd Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)xstr.c 8.1 (Berkeley) 6/9/93";
#endif
-static char rcsid[] = "$OpenBSD: xstr.c,v 1.9 2002/02/24 02:25:48 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: xstr.c,v 1.10 2002/12/08 16:50:07 millert Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -103,7 +103,7 @@ main(int argc, char *argv[])
int c;
int fdesc;
- while ((c = getopt(argc, argv, "-cvl:")) != -1)
+ while ((c = getopt(argc, argv, "cvl:-")) != -1)
switch (c) {
case '-':
readstd++;