diff options
Diffstat (limited to 'src/regress/lib/libc/strerror/strerror_test.c')
| -rw-r--r-- | src/regress/lib/libc/strerror/strerror_test.c | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/src/regress/lib/libc/strerror/strerror_test.c b/src/regress/lib/libc/strerror/strerror_test.c deleted file mode 100644 index 23b542f1ee..0000000000 --- a/src/regress/lib/libc/strerror/strerror_test.c +++ /dev/null | |||
| @@ -1,65 +0,0 @@ | |||
| 1 | /* $OpenBSD: strerror_test.c,v 1.5 2015/09/14 06:31:25 guenther Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2004 Marc Espie <espie@cvs.openbsd.org> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | #include <signal.h> | ||
| 18 | #include <string.h> | ||
| 19 | #include <stdio.h> | ||
| 20 | #include <limits.h> | ||
| 21 | #include <errno.h> | ||
| 22 | |||
| 23 | void | ||
| 24 | check_strerror_r(int val) | ||
| 25 | { | ||
| 26 | char buffer[NL_TEXTMAX + 1]; | ||
| 27 | int i, r; | ||
| 28 | |||
| 29 | memset(buffer, 'X', sizeof(buffer) - 1); | ||
| 30 | buffer[sizeof(buffer) - 1] = '\0'; | ||
| 31 | (void)strerror_r(val, NULL, 0); /* XXX */ | ||
| 32 | for (i = 0; i < 25; i++) { | ||
| 33 | r = strerror_r(val, buffer, i); | ||
| 34 | printf("%d %d %zu: %s\n", i, r, strlen(buffer), buffer); | ||
| 35 | } | ||
| 36 | } | ||
| 37 | |||
| 38 | void | ||
| 39 | check_strsignal(int val) | ||
| 40 | { | ||
| 41 | printf("%s\n", strsignal(val)); | ||
| 42 | } | ||
| 43 | |||
| 44 | int | ||
| 45 | main() | ||
| 46 | { | ||
| 47 | printf("%s\n", strerror(21345)); | ||
| 48 | printf("%s\n", strerror(-21345)); | ||
| 49 | printf("%s\n", strerror(0)); | ||
| 50 | printf("%s\n", strerror(INT_MAX)); | ||
| 51 | printf("%s\n", strerror(INT_MIN)); | ||
| 52 | printf("%s\n", strerror(EPERM)); | ||
| 53 | check_strerror_r(EPERM); | ||
| 54 | check_strerror_r(21345); | ||
| 55 | check_strsignal(-1); | ||
| 56 | check_strsignal(0); | ||
| 57 | check_strsignal(10); | ||
| 58 | check_strsignal(NSIG-1); | ||
| 59 | check_strsignal(NSIG); | ||
| 60 | check_strsignal(100); | ||
| 61 | check_strsignal(INT_MAX); | ||
| 62 | check_strsignal(INT_MIN); | ||
| 63 | check_strsignal(UINT_MAX); | ||
| 64 | return 0; | ||
| 65 | } | ||
