File: test-gethostname.cxx

package info (click to toggle)
flightgear 1:2016.4.4+dfsg-3+deb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 48,512 kB
  • ctags: 71,727
  • sloc: cpp: 195,395; ansic: 177,152; sh: 13,661; perl: 4,475; python: 2,381; asm: 642; makefile: 398; java: 314; xml: 85
file content (18 lines) | stat: -rw-r--r-- 328 bytes parent folder | download | duplicates (9)
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;
}