From 3b9905250348125fe22a21c5b8f4eb7ae5fbcded Mon Sep 17 00:00:00 2001 From: espie <> Date: Sun, 2 May 2004 22:34:29 +0000 Subject: more tests, okay millert@ (we probably don't pass them all yet, and will after the strerror_r code is committed). --- src/regress/lib/libc/strerror/strerror_test.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/regress/lib/libc/strerror/strerror_test.c') 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 @@ -/* $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 * @@ -17,12 +17,32 @@ #include #include #include -int main() +#include + +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; } -- cgit v1.2.3-55-g6feb