diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-12-08 19:25:09 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-12-08 19:25:09 +0000 |
commit | 827d9d54bf141c93a08704b62bf09e69c56c292f (patch) | |
tree | 3c05ed97cd6157cc08599cfad7d48d8edb70f598 /regress | |
parent | b0a579947e75a434b54d5f36f52c26ed0c1f9e84 (diff) |
Test option "-" (BSD extension)
Diffstat (limited to 'regress')
-rw-r--r-- | regress/lib/libc/getopt_long/Makefile | 11 | ||||
-rw-r--r-- | regress/lib/libc/getopt_long/getopt_long_test.c | 3 | ||||
-rw-r--r-- | regress/lib/libc/getopt_long/test.ok | 12 |
3 files changed, 16 insertions, 10 deletions
diff --git a/regress/lib/libc/getopt_long/Makefile b/regress/lib/libc/getopt_long/Makefile index 77292610792..13a187e190a 100644 --- a/regress/lib/libc/getopt_long/Makefile +++ b/regress/lib/libc/getopt_long/Makefile @@ -1,7 +1,8 @@ -# $OpenBSD: Makefile,v 1.3 2002/12/07 19:57:24 millert Exp $ +# $OpenBSD: Makefile,v 1.4 2002/12/08 19:25:08 millert Exp $ NOMAN= PROG=getopt_long_test +CLEANFILES+=test.out # test getopt_long and getopt_long_only run-regress-${PROG}: ${PROG} @@ -9,22 +10,22 @@ run-regress-${PROG}: ${PROG} test -n "$$LONG_ONLY" && unset LONG_ONLY; \ ./${PROG} myfile --force -f infile -9 ; \ ./${PROG} onefile twofile --best -Williterate -i foo.in threefile ; \ - ./${PROG} -1bfast ; \ + ./${PROG} -1bfast - ; \ ./${PROG} --fast --drinking=guiness -i foo.in somefile ; \ export POSIXLY_CORRECT=1 ; \ ./${PROG} myfile --force -f infile -9 ; \ ./${PROG} onefile twofile --best -Williterate -i foo.in threefile ; \ - ./${PROG} -1bfast ; \ + ./${PROG} -1bfast - ; \ ./${PROG} --fast --drinking=guiness -i foo.in somefile ; \ unset POSIXLY_CORRECT ; export LONG_ONLY=1 ; \ ./${PROG} myfile -force -f infile -9 ; \ ./${PROG} onefile twofile -best -Williterate -i foo.in threefile ; \ - ./${PROG} -1bfast ; \ + ./${PROG} -1bfast - ; \ ./${PROG} --fast -drinking=guiness -i foo.in somefile ; \ export POSIXLY_CORRECT=1 ; \ ./${PROG} myfile -force -f infile -9 ; \ ./${PROG} onefile twofile -best -Williterate -i foo.in threefile ; \ - ./${PROG} -1bfast ; \ + ./${PROG} -1bfast - ; \ ./${PROG} --fast -drinking=guiness -i foo.in somefile ) >test.out 2>&1 cmp -s ${.OBJDIR}/test.out ${.CURDIR}/test.ok diff --git a/regress/lib/libc/getopt_long/getopt_long_test.c b/regress/lib/libc/getopt_long/getopt_long_test.c index b15613d9826..27a2dc4a5fc 100644 --- a/regress/lib/libc/getopt_long/getopt_long_test.c +++ b/regress/lib/libc/getopt_long/getopt_long_test.c @@ -67,7 +67,7 @@ main(int argc, char **argv) goggles = 0; for (;;) { idx = -1; - ch = gl(argc, argv, "19bf:i:hW;", longopts, &idx); + ch = gl(argc, argv, "19bf:i:hW;-", longopts, &idx); if (ch == -1) break; switch (ch) { @@ -76,6 +76,7 @@ main(int argc, char **argv) case '9': case 'h': case 'b': + case '-': if (idx != -1) { if (goggles == 42) printf("option %s, arg %s\n", diff --git a/regress/lib/libc/getopt_long/test.ok b/regress/lib/libc/getopt_long/test.ok index 124422f964d..9782087f409 100644 --- a/regress/lib/libc/getopt_long/test.ok +++ b/regress/lib/libc/getopt_long/test.ok @@ -10,10 +10,11 @@ option illiterate option i, arg foo.in remaining ARGV: onefile twofile threefile -getopt_long: -1bfast +getopt_long: -1bfast - option 1 option b option f, arg ast +option - getopt_long: --fast --drinking=guiness -i foo.in somefile option fast @@ -27,10 +28,11 @@ remaining ARGV: myfile --force -f infile -9 getopt_long (POSIXLY_CORRECT): onefile twofile --best -Williterate -i foo.in threefile remaining ARGV: onefile twofile --best -Williterate -i foo.in threefile -getopt_long (POSIXLY_CORRECT): -1bfast +getopt_long (POSIXLY_CORRECT): -1bfast - option 1 option b option f, arg ast +option - getopt_long (POSIXLY_CORRECT): --fast --drinking=guiness -i foo.in somefile option fast @@ -50,10 +52,11 @@ option illiterate option i, arg foo.in remaining ARGV: onefile twofile threefile -getopt_long_only: -1bfast +getopt_long_only: -1bfast - option 1 option b option fast +option - getopt_long_only: --fast -drinking=guiness -i foo.in somefile option fast @@ -67,10 +70,11 @@ remaining ARGV: myfile -force -f infile -9 getopt_long_only (POSIXLY_CORRECT): onefile twofile -best -Williterate -i foo.in threefile remaining ARGV: onefile twofile -best -Williterate -i foo.in threefile -getopt_long_only (POSIXLY_CORRECT): -1bfast +getopt_long_only (POSIXLY_CORRECT): -1bfast - option 1 option b option fast +option - getopt_long_only (POSIXLY_CORRECT): --fast -drinking=guiness -i foo.in somefile option fast |