test_suite/attic/test-gethostname.cxx
raw| 1 | #ifdef HAVE_CONFIG_H |
| 2 | # include <config.h> |
| 3 | #endif |
| 4 | |
| 5 | #if defined( unix ) || defined( __CYGWIN__ ) |
| 6 | # include <unistd.h> // for gethostname() |
| 7 | #endif |
| 8 | |
| 9 | #include <stdio.h> |
| 10 | |
| 11 | int main() { |
| 12 | #if defined( unix ) || defined( __CYGWIN__ ) |
| 13 | char name[256]; |
| 14 | gethostname( name, 256 ); |
| 15 | printf("hostname = %s\n", name); |
| 16 | #endif |
| 17 | return 0; |
| 18 | } |