diff options
author | espie <> | 2004-05-02 22:34:29 +0000 |
---|---|---|
committer | espie <> | 2004-05-02 22:34:29 +0000 |
commit | 3b9905250348125fe22a21c5b8f4eb7ae5fbcded (patch) | |
tree | 5e4ecef0cbee45c8cee844c1add146964065720a /src/regress/lib/libc/strerror/strerror_test.c | |
parent | 020a840ea33d9a0972e79af8e8d5b08fd704ff84 (diff) | |
download | openbsd-3b9905250348125fe22a21c5b8f4eb7ae5fbcded.tar.gz openbsd-3b9905250348125fe22a21c5b8f4eb7ae5fbcded.tar.bz2 openbsd-3b9905250348125fe22a21c5b8f4eb7ae5fbcded.zip |
more tests, okay millert@ (we probably don't pass them all yet, and will
after the strerror_r code is committed).
Diffstat (limited to 'src/regress/lib/libc/strerror/strerror_test.c')
-rw-r--r-- | src/regress/lib/libc/strerror/strerror_test.c | 24 |
1 files changed, 22 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 | } |