diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-05-02 22:34:30 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-05-02 22:34:30 +0000 |
commit | d2bf827b492fd08772a7208fa5db84654f591951 (patch) | |
tree | f2f2a36c6f9a37ba7c3cbefcd4e9a5be546ec9e1 /regress/lib/libc/strerror/strerror_test.c | |
parent | 067a0e384f8d9de19fcf53e2523939a6937cb882 (diff) |
more tests, okay millert@ (we probably don't pass them all yet, and will
after the strerror_r code is committed).
Diffstat (limited to 'regress/lib/libc/strerror/strerror_test.c')
-rw-r--r-- | regress/lib/libc/strerror/strerror_test.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/regress/lib/libc/strerror/strerror_test.c b/regress/lib/libc/strerror/strerror_test.c index 5b74df3a6a2..061cda6fc31 100644 --- a/regress/lib/libc/strerror/strerror_test.c +++ b/regress/lib/libc/strerror/strerror_test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strerror_test.c,v 1.1 2004/04/30 17:15:12 espie Exp $ */ +/* $OpenBSD: strerror_test.c,v 1.2 2004/05/02 22:34:29 espie Exp $ */ /* * Copyright (c) 2004 Marc Espie <espie@cvs.openbsd.org> * @@ -17,12 +17,32 @@ #include <string.h> #include <stdio.h> #include <limits.h> -int main() +#include <errno.h> + +void +check_strerror_r(int val) +{ + char buffer[NL_TEXTMAX]; + int i, r; + + memset(buffer, 0, sizeof(buffer)); + (void)strerror_r(val, NULL, 0); /* XXX */ + for (i = 0; i < 25; i++) { + r = strerror_r(val, buffer, i); + printf("%d %d %lu: %s\n", i, r, strlen(buffer), buffer); + } +} + +int +main() { printf("%s\n", strerror(21345)); printf("%s\n", strerror(-21345)); printf("%s\n", strerror(0)); printf("%s\n", strerror(INT_MAX)); printf("%s\n", strerror(INT_MIN)); + printf("%s\n", strerror(EPERM)); + check_strerror_r(EPERM); + check_strerror_r(21345); return 0; } |