1 #include <stdio.h> 2 #include <errno.h> 3 #include <string.h> 4 #include <limits.h> 5 6 size_t confstr(int name, char *buf, size_t len); 7 char string[512]; 8 9 int main() 10 { 11 int i; 12 size_t size; 13 for (i=0; i<INT_MAX; i++) { 14 size = confstr(i, NULL, (size_t) 0); 15 if (errno != B_BAD_VALUE) 16 printf("%ld confstr %ld %s\n", i, size, strerror(errno)); 17 if (size != 0) { 18 size = confstr(i, string, sizeof(string)); 19 printf("%ld value %s\n", i, string); 20 } 21 } 22 } 23 24