diff options
Diffstat (limited to '')
| -rw-r--r-- | src/regress/lib/libc/getopt_long/Makefile | 11 | ||||
| -rw-r--r-- | src/regress/lib/libc/getopt_long/getopt_long_test.c | 3 | ||||
| -rw-r--r-- | src/regress/lib/libc/getopt_long/test.ok | 12 |
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 | ||
| 3 | NOMAN= | 3 | NOMAN= |
| 4 | PROG=getopt_long_test | 4 | PROG=getopt_long_test |
| 5 | CLEANFILES+=test.out | ||
| 5 | 6 | ||
| 6 | # test getopt_long and getopt_long_only | 7 | # test getopt_long and getopt_long_only |
| 7 | run-regress-${PROG}: ${PROG} | 8 | run-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 | |||
| 10 | option i, arg foo.in | 10 | option i, arg foo.in |
| 11 | remaining ARGV: onefile twofile threefile | 11 | remaining ARGV: onefile twofile threefile |
| 12 | 12 | ||
| 13 | getopt_long: -1bfast | 13 | getopt_long: -1bfast - |
| 14 | option 1 | 14 | option 1 |
| 15 | option b | 15 | option b |
| 16 | option f, arg ast | 16 | option f, arg ast |
| 17 | option - | ||
| 17 | 18 | ||
| 18 | getopt_long: --fast --drinking=guiness -i foo.in somefile | 19 | getopt_long: --fast --drinking=guiness -i foo.in somefile |
| 19 | option fast | 20 | option fast |
| @@ -27,10 +28,11 @@ remaining ARGV: myfile --force -f infile -9 | |||
| 27 | getopt_long (POSIXLY_CORRECT): onefile twofile --best -Williterate -i foo.in threefile | 28 | getopt_long (POSIXLY_CORRECT): onefile twofile --best -Williterate -i foo.in threefile |
| 28 | remaining ARGV: onefile twofile --best -Williterate -i foo.in threefile | 29 | remaining ARGV: onefile twofile --best -Williterate -i foo.in threefile |
| 29 | 30 | ||
| 30 | getopt_long (POSIXLY_CORRECT): -1bfast | 31 | getopt_long (POSIXLY_CORRECT): -1bfast - |
| 31 | option 1 | 32 | option 1 |
| 32 | option b | 33 | option b |
| 33 | option f, arg ast | 34 | option f, arg ast |
| 35 | option - | ||
| 34 | 36 | ||
| 35 | getopt_long (POSIXLY_CORRECT): --fast --drinking=guiness -i foo.in somefile | 37 | getopt_long (POSIXLY_CORRECT): --fast --drinking=guiness -i foo.in somefile |
| 36 | option fast | 38 | option fast |
| @@ -50,10 +52,11 @@ option illiterate | |||
| 50 | option i, arg foo.in | 52 | option i, arg foo.in |
| 51 | remaining ARGV: onefile twofile threefile | 53 | remaining ARGV: onefile twofile threefile |
| 52 | 54 | ||
| 53 | getopt_long_only: -1bfast | 55 | getopt_long_only: -1bfast - |
| 54 | option 1 | 56 | option 1 |
| 55 | option b | 57 | option b |
| 56 | option fast | 58 | option fast |
| 59 | option - | ||
| 57 | 60 | ||
| 58 | getopt_long_only: --fast -drinking=guiness -i foo.in somefile | 61 | getopt_long_only: --fast -drinking=guiness -i foo.in somefile |
| 59 | option fast | 62 | option fast |
| @@ -67,10 +70,11 @@ remaining ARGV: myfile -force -f infile -9 | |||
| 67 | getopt_long_only (POSIXLY_CORRECT): onefile twofile -best -Williterate -i foo.in threefile | 70 | getopt_long_only (POSIXLY_CORRECT): onefile twofile -best -Williterate -i foo.in threefile |
| 68 | remaining ARGV: onefile twofile -best -Williterate -i foo.in threefile | 71 | remaining ARGV: onefile twofile -best -Williterate -i foo.in threefile |
| 69 | 72 | ||
| 70 | getopt_long_only (POSIXLY_CORRECT): -1bfast | 73 | getopt_long_only (POSIXLY_CORRECT): -1bfast - |
| 71 | option 1 | 74 | option 1 |
| 72 | option b | 75 | option b |
| 73 | option fast | 76 | option fast |
| 77 | option - | ||
| 74 | 78 | ||
| 75 | getopt_long_only (POSIXLY_CORRECT): --fast -drinking=guiness -i foo.in somefile | 79 | getopt_long_only (POSIXLY_CORRECT): --fast -drinking=guiness -i foo.in somefile |
| 76 | option fast | 80 | option fast |
