diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/regress/lib/libc/strerror/strerror_test.c | 24 | ||||
| -rw-r--r-- | src/regress/lib/libc/strerror/valid.ok | 51 |
2 files changed, 73 insertions, 2 deletions
diff --git a/src/regress/lib/libc/strerror/strerror_test.c b/src/regress/lib/libc/strerror/strerror_test.c index 5b74df3a6a..061cda6fc3 100644 --- a/src/regress/lib/libc/strerror/strerror_test.c +++ b/src/regress/lib/libc/strerror/strerror_test.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: strerror_test.c,v 1.1 2004/04/30 17:15:12 espie Exp $ */ | 1 | /* $OpenBSD: strerror_test.c,v 1.2 2004/05/02 22:34:29 espie Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2004 Marc Espie <espie@cvs.openbsd.org> | 3 | * Copyright (c) 2004 Marc Espie <espie@cvs.openbsd.org> |
| 4 | * | 4 | * |
| @@ -17,12 +17,32 @@ | |||
| 17 | #include <string.h> | 17 | #include <string.h> |
| 18 | #include <stdio.h> | 18 | #include <stdio.h> |
| 19 | #include <limits.h> | 19 | #include <limits.h> |
| 20 | int main() | 20 | #include <errno.h> |
| 21 | |||
| 22 | void | ||
| 23 | check_strerror_r(int val) | ||
| 24 | { | ||
| 25 | char buffer[NL_TEXTMAX]; | ||
| 26 | int i, r; | ||
| 27 | |||
| 28 | memset(buffer, 0, sizeof(buffer)); | ||
| 29 | (void)strerror_r(val, NULL, 0); /* XXX */ | ||
| 30 | for (i = 0; i < 25; i++) { | ||
| 31 | r = strerror_r(val, buffer, i); | ||
| 32 | printf("%d %d %lu: %s\n", i, r, strlen(buffer), buffer); | ||
| 33 | } | ||
| 34 | } | ||
| 35 | |||
| 36 | int | ||
| 37 | main() | ||
| 21 | { | 38 | { |
| 22 | printf("%s\n", strerror(21345)); | 39 | printf("%s\n", strerror(21345)); |
| 23 | printf("%s\n", strerror(-21345)); | 40 | printf("%s\n", strerror(-21345)); |
| 24 | printf("%s\n", strerror(0)); | 41 | printf("%s\n", strerror(0)); |
| 25 | printf("%s\n", strerror(INT_MAX)); | 42 | printf("%s\n", strerror(INT_MAX)); |
| 26 | printf("%s\n", strerror(INT_MIN)); | 43 | printf("%s\n", strerror(INT_MIN)); |
| 44 | printf("%s\n", strerror(EPERM)); | ||
| 45 | check_strerror_r(EPERM); | ||
| 46 | check_strerror_r(21345); | ||
| 27 | return 0; | 47 | return 0; |
| 28 | } | 48 | } |
diff --git a/src/regress/lib/libc/strerror/valid.ok b/src/regress/lib/libc/strerror/valid.ok index 25b39d3afb..9f7529e97e 100644 --- a/src/regress/lib/libc/strerror/valid.ok +++ b/src/regress/lib/libc/strerror/valid.ok | |||
| @@ -3,3 +3,54 @@ Unknown error: -21345 | |||
| 3 | Undefined error: 0 | 3 | Undefined error: 0 |
| 4 | Unknown error: 2147483647 | 4 | Unknown error: 2147483647 |
| 5 | Unknown error: -2147483648 | 5 | Unknown error: -2147483648 |
| 6 | Operation not permitted | ||
| 7 | 0 34 0: | ||
| 8 | 1 34 0: | ||
| 9 | 2 34 1: O | ||
| 10 | 3 34 2: Op | ||
| 11 | 4 34 3: Ope | ||
| 12 | 5 34 4: Oper | ||
| 13 | 6 34 5: Opera | ||
| 14 | 7 34 6: Operat | ||
| 15 | 8 34 7: Operati | ||
| 16 | 9 34 8: Operatio | ||
| 17 | 10 34 9: Operation | ||
| 18 | 11 34 10: Operation | ||
| 19 | 12 34 11: Operation n | ||
| 20 | 13 34 12: Operation no | ||
| 21 | 14 34 13: Operation not | ||
| 22 | 15 34 14: Operation not | ||
| 23 | 16 34 15: Operation not p | ||
| 24 | 17 34 16: Operation not pe | ||
| 25 | 18 34 17: Operation not per | ||
| 26 | 19 34 18: Operation not perm | ||
| 27 | 20 34 19: Operation not permi | ||
| 28 | 21 34 20: Operation not permit | ||
| 29 | 22 34 21: Operation not permitt | ||
| 30 | 23 34 22: Operation not permitte | ||
| 31 | 24 0 23: Operation not permitted | ||
| 32 | 0 22 0: | ||
| 33 | 1 22 0: | ||
| 34 | 2 22 1: U | ||
| 35 | 3 22 2: Un | ||
| 36 | 4 22 3: Unk | ||
| 37 | 5 22 4: Unkn | ||
| 38 | 6 22 5: Unkno | ||
| 39 | 7 22 6: Unknow | ||
| 40 | 8 22 7: Unknown | ||
| 41 | 9 22 8: Unknown | ||
| 42 | 10 22 9: Unknown e | ||
| 43 | 11 22 10: Unknown er | ||
| 44 | 12 22 11: Unknown err | ||
| 45 | 13 22 12: Unknown erro | ||
| 46 | 14 22 13: Unknown error | ||
| 47 | 15 22 14: Unknown error: | ||
| 48 | 16 22 15: Unknown error: | ||
| 49 | 17 22 16: Unknown error: 2 | ||
| 50 | 18 22 17: Unknown error: 21 | ||
| 51 | 19 22 18: Unknown error: 213 | ||
| 52 | 20 22 19: Unknown error: 2134 | ||
| 53 | 21 22 20: Unknown error: 21345 | ||
| 54 | 22 22 20: Unknown error: 21345 | ||
| 55 | 23 22 20: Unknown error: 21345 | ||
| 56 | 24 22 20: Unknown error: 21345 | ||
