File: test-gethostname.cxx

package info (click to toggle)
flightgear 0.9.6-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 9,948 kB
  • ctags: 17,555
  • sloc: cpp: 90,696; ansic: 5,266; sh: 3,488; makefile: 840; perl: 680; python: 106
file content (18 lines) | stat: -rw-r--r-- 328 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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;
}