summaryrefslogtreecommitdiff
path: root/src/regress/lib
diff options
context:
space:
mode:
authormillert <>2002-12-08 19:25:08 +0000
committermillert <>2002-12-08 19:25:08 +0000
commitd11eb7755cffa6a8796c5922ee06499acfcb120c (patch)
treeeebe590fc3b34b8f07c7a54b6a0805724911a1c7 /src/regress/lib
parente2a937d6505165b947df5bec71c8a4f8c66156cc (diff)
downloadopenbsd-d11eb7755cffa6a8796c5922ee06499acfcb120c.tar.gz
openbsd-d11eb7755cffa6a8796c5922ee06499acfcb120c.tar.bz2
openbsd-d11eb7755cffa6a8796c5922ee06499acfcb120c.zip
Test option "-" (BSD extension)
Diffstat (limited to 'src/regress/lib')
-rw-r--r--src/regress/lib/libc/getopt_long/Makefile11
-rw-r--r--src/regress/lib/libc/getopt_long/getopt_long_test.c3
-rw-r--r--src/regress/lib/libc/getopt_long/test.ok12
3 files changed, 16 insertions, 10 deletions
diff --git a/src/regress/lib/libc/getopt_long/Makefile b/src/regress/lib/libc/getopt_long/Makefile
index 7729261079..13a187e190 100644
--- a/src/regress/lib/libc/getopt_long/Makefile
+++ b/src/regress/lib/libc/getopt_long/Makefile
@@ -1,7 +1,8 @@
1# $OpenBSD: Makefile,v 1.3 2002/12/07 19:57:24 millert Exp $ 1# $OpenBSD: Makefile,v 1.4 2002/12/08 19:25:08 millert Exp $
2 2
3NOMAN= 3NOMAN=
4PROG=getopt_long_test 4PROG=getopt_long_test
5CLEANFILES+=test.out
5 6
6# test getopt_long and getopt_long_only 7# test getopt_long and getopt_long_only
7run-regress-${PROG}: ${PROG} 8run-regress-${PROG}: ${PROG}
@@ -9,22 +10,22 @@ run-regress-${PROG}: ${PROG}
9 test -n "$$LONG_ONLY" && unset LONG_ONLY; \ 10 test -n "$$LONG_ONLY" && unset LONG_ONLY; \
10 ./${PROG} myfile --force -f infile -9 ; \ 11 ./${PROG} myfile --force -f infile -9 ; \
11 ./${PROG} onefile twofile --best -Williterate -i foo.in threefile ; \ 12 ./${PROG} onefile twofile --best -Williterate -i foo.in threefile ; \
12 ./${PROG} -1bfast ; \ 13 ./${PROG} -1bfast - ; \
13 ./${PROG} --fast --drinking=guiness -i foo.in somefile ; \ 14 ./${PROG} --fast --drinking=guiness -i foo.in somefile ; \
14 export POSIXLY_CORRECT=1 ; \ 15 export POSIXLY_CORRECT=1 ; \
15 ./${PROG} myfile --force -f infile -9 ; \ 16 ./${PROG} myfile --force -f infile -9 ; \
16 ./${PROG} onefile twofile --best -Williterate -i foo.in threefile ; \ 17 ./${PROG} onefile twofile --best -Williterate -i foo.in threefile ; \
17 ./${PROG} -1bfast ; \ 18 ./${PROG} -1bfast - ; \
18 ./${PROG} --fast --drinking=guiness -i foo.in somefile ; \ 19 ./${PROG} --fast --drinking=guiness -i foo.in somefile ; \
19 unset POSIXLY_CORRECT ; export LONG_ONLY=1 ; \ 20 unset POSIXLY_CORRECT ; export LONG_ONLY=1 ; \
20 ./${PROG} myfile -force -f infile -9 ; \ 21 ./${PROG} myfile -force -f infile -9 ; \
21 ./${PROG} onefile twofile -best -Williterate -i foo.in threefile ; \ 22 ./${PROG} onefile twofile -best -Williterate -i foo.in threefile ; \
22 ./${PROG} -1bfast ; \ 23 ./${PROG} -1bfast - ; \
23 ./${PROG} --fast -drinking=guiness -i foo.in somefile ; \ 24 ./${PROG} --fast -drinking=guiness -i foo.in somefile ; \
24 export POSIXLY_CORRECT=1 ; \ 25 export POSIXLY_CORRECT=1 ; \
25 ./${PROG} myfile -force -f infile -9 ; \ 26 ./${PROG} myfile -force -f infile -9 ; \
26 ./${PROG} onefile twofile -best -Williterate -i foo.in threefile ; \ 27 ./${PROG} onefile twofile -best -Williterate -i foo.in threefile ; \
27 ./${PROG} -1bfast ; \ 28 ./${PROG} -1bfast - ; \
28 ./${PROG} --fast -drinking=guiness -i foo.in somefile ) >test.out 2>&1 29 ./${PROG} --fast -drinking=guiness -i foo.in somefile ) >test.out 2>&1
29 cmp -s ${.OBJDIR}/test.out ${.CURDIR}/test.ok 30 cmp -s ${.OBJDIR}/test.out ${.CURDIR}/test.ok
30 31
diff --git a/src/regress/lib/libc/getopt_long/getopt_long_test.c b/src/regress/lib/libc/getopt_long/getopt_long_test.c
index b15613d982..27a2dc4a5f 100644
--- a/src/regress/lib/libc/getopt_long/getopt_long_test.c
+++ b/src/regress/lib/libc/getopt_long/getopt_long_test.c
@@ -67,7 +67,7 @@ main(int argc, char **argv)
67 goggles = 0; 67 goggles = 0;
68 for (;;) { 68 for (;;) {
69 idx = -1; 69 idx = -1;
70 ch = gl(argc, argv, "19bf:i:hW;", longopts, &idx); 70 ch = gl(argc, argv, "19bf:i:hW;-", longopts, &idx);
71 if (ch == -1) 71 if (ch == -1)
72 break; 72 break;
73 switch (ch) { 73 switch (ch) {
@@ -76,6 +76,7 @@ main(int argc, char **argv)
76 case '9': 76 case '9':
77 case 'h': 77 case 'h':
78 case 'b': 78 case 'b':
79 case '-':
79 if (idx != -1) { 80 if (idx != -1) {
80 if (goggles == 42) 81 if (goggles == 42)
81 printf("option %s, arg %s\n", 82 printf("option %s, arg %s\n",
diff --git a/src/regress/lib/libc/getopt_long/test.ok b/src/regress/lib/libc/getopt_long/test.ok
index 124422f964..9782087f40 100644
--- a/src/regress/lib/libc/getopt_long/test.ok
+++ b/src/regress/lib/libc/getopt_long/test.ok
@@ -10,10 +10,11 @@ option illiterate
10option i, arg foo.in 10option i, arg foo.in
11remaining ARGV: onefile twofile threefile 11remaining ARGV: onefile twofile threefile
12 12
13getopt_long: -1bfast 13getopt_long: -1bfast -
14option 1 14option 1
15option b 15option b
16option f, arg ast 16option f, arg ast
17option -
17 18
18getopt_long: --fast --drinking=guiness -i foo.in somefile 19getopt_long: --fast --drinking=guiness -i foo.in somefile
19option fast 20option fast
@@ -27,10 +28,11 @@ remaining ARGV: myfile --force -f infile -9
27getopt_long (POSIXLY_CORRECT): onefile twofile --best -Williterate -i foo.in threefile 28getopt_long (POSIXLY_CORRECT): onefile twofile --best -Williterate -i foo.in threefile
28remaining ARGV: onefile twofile --best -Williterate -i foo.in threefile 29remaining ARGV: onefile twofile --best -Williterate -i foo.in threefile
29 30
30getopt_long (POSIXLY_CORRECT): -1bfast 31getopt_long (POSIXLY_CORRECT): -1bfast -
31option 1 32option 1
32option b 33option b
33option f, arg ast 34option f, arg ast
35option -
34 36
35getopt_long (POSIXLY_CORRECT): --fast --drinking=guiness -i foo.in somefile 37getopt_long (POSIXLY_CORRECT): --fast --drinking=guiness -i foo.in somefile
36option fast 38option fast
@@ -50,10 +52,11 @@ option illiterate
50option i, arg foo.in 52option i, arg foo.in
51remaining ARGV: onefile twofile threefile 53remaining ARGV: onefile twofile threefile
52 54
53getopt_long_only: -1bfast 55getopt_long_only: -1bfast -
54option 1 56option 1
55option b 57option b
56option fast 58option fast
59option -
57 60
58getopt_long_only: --fast -drinking=guiness -i foo.in somefile 61getopt_long_only: --fast -drinking=guiness -i foo.in somefile
59option fast 62option fast
@@ -67,10 +70,11 @@ remaining ARGV: myfile -force -f infile -9
67getopt_long_only (POSIXLY_CORRECT): onefile twofile -best -Williterate -i foo.in threefile 70getopt_long_only (POSIXLY_CORRECT): onefile twofile -best -Williterate -i foo.in threefile
68remaining ARGV: onefile twofile -best -Williterate -i foo.in threefile 71remaining ARGV: onefile twofile -best -Williterate -i foo.in threefile
69 72
70getopt_long_only (POSIXLY_CORRECT): -1bfast 73getopt_long_only (POSIXLY_CORRECT): -1bfast -
71option 1 74option 1
72option b 75option b
73option fast 76option fast
77option -
74 78
75getopt_long_only (POSIXLY_CORRECT): --fast -drinking=guiness -i foo.in somefile 79getopt_long_only (POSIXLY_CORRECT): --fast -drinking=guiness -i foo.in somefile
76option fast 80option fast