added a test for confstr()

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21839 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2007-08-06 17:43:59 +00:00
parent cf1539e1a3
commit 902067dc62

View File

@ -0,0 +1,23 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <limits.h>
size_t confstr(int name, char *buf, size_t len);
char string[512];
int main()
{
int i;
size_t size;
for (i=0; i<INT_MAX; i++) {
size = confstr(i, NULL, (size_t) 0);
if (errno != B_BAD_VALUE)
printf("%ld confstr %ld %s\n", i, size, strerror(errno));
if (size != 0) {
size = confstr(i, string, sizeof(string));
printf("%ld value %s\n", i, string);
}
}
}