diff options
author | max99x <max99x@gmail.com> | 2011-07-23 05:49:48 +0300 |
---|---|---|
committer | max99x <max99x@gmail.com> | 2011-07-23 05:49:48 +0300 |
commit | 136756f734ecf14a28736900075d561e981e973e (patch) | |
tree | cf33472ea6550c6486ec7722facf34d98a16a51d /tests/unistd/confstr.c | |
parent | 586d229ec311daa5e89781eb6da822989e677789 (diff) |
Added unistd tests; fixed a lot of unistd bugs and deficiencies.
Diffstat (limited to 'tests/unistd/confstr.c')
-rw-r--r-- | tests/unistd/confstr.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/unistd/confstr.c b/tests/unistd/confstr.c new file mode 100644 index 00000000..5c96c89c --- /dev/null +++ b/tests/unistd/confstr.c @@ -0,0 +1,55 @@ +#include <stdio.h> +#include <errno.h> +#include <unistd.h> + +int main() { + int vals[] = { + _CS_PATH, + _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS, + _CS_GNU_LIBC_VERSION, + _CS_GNU_LIBPTHREAD_VERSION, + _CS_POSIX_V6_ILP32_OFF32_LIBS, + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + _CS_POSIX_V6_LP64_OFF64_LIBS, + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS + }; + char* names[] = { + "_CS_PATH", + "_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS", + "_CS_GNU_LIBC_VERSION", + "_CS_GNU_LIBPTHREAD_VERSION", + "_CS_POSIX_V6_ILP32_OFF32_LIBS", + "_CS_POSIX_V6_ILP32_OFFBIG_LIBS", + "_CS_POSIX_V6_LP64_OFF64_CFLAGS", + "_CS_POSIX_V6_LP64_OFF64_LDFLAGS", + "_CS_POSIX_V6_LP64_OFF64_LIBS", + "_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS", + "_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS", + "_CS_POSIX_V6_LPBIG_OFFBIG_LIBS", + "_CS_POSIX_V6_ILP32_OFF32_CFLAGS", + "_CS_POSIX_V6_ILP32_OFF32_LDFLAGS", + "_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS", + "_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS" + }; + char buffer[256]; + + for (int i = 0; i < sizeof vals / sizeof vals[0]; i++) { + printf("ret: %d\n", confstr(vals[i], buffer, 256)); + printf("%s: %s\n", names[i], buffer); + printf("errno: %d\n\n", errno); + errno = 0; + } + + printf("(invalid) ret: %d\n", confstr(-123, buffer, 256)); + printf("errno: %d\n", errno); + + return 0; +} |