Initial revision.
This commit is contained in:
parent
def805e9dc
commit
8aed19714a
1 changed files with 18 additions and 0 deletions
18
tests/test-gethostname.cxx
Normal file
18
tests/test-gethostname.cxx
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined( unix ) || defined( __CYGWIN__ )
|
||||||
|
# include <unistd.h> // for gethostname()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
#if defined( unix ) || defined( __CYGWIN__ )
|
||||||
|
char name[256];
|
||||||
|
gethostname( name, 256 );
|
||||||
|
printf("hostname = %s\n", name);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in a new issue