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:
parent
cf1539e1a3
commit
902067dc62
23
src/tests/system/libroot/posix/test_confstr.c
Normal file
23
src/tests/system/libroot/posix/test_confstr.c
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user