Go to the documentation of this file.00001 #include <unistd.h>
00002 #include <grass/gis.h>
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <grass/config.h>
00015
00016 #ifndef HAVE_GETHOSTNAME
00017 #ifdef HAVE_SYS_UTSNAME_H
00018 #include <sys/utsname.h>
00019 static struct utsname attname;
00020 #endif
00021 #endif
00022
00023 char *G__machine_name(void)
00024 {
00025 static char name[128];
00026
00027 *name = 0;
00028
00029 #ifdef HAVE_GETHOSTNAME
00030 gethostname(name, sizeof(name));
00031 name[sizeof(name) - 1] = 0;
00032 #else
00033 #ifdef HAVE_SYS_UTSNAME_H
00034 uname(&attname);
00035 strcpy(name, attname.nodename);
00036 #endif
00037 #endif
00038
00039 return (name);
00040 }