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 *
00024 G__machine_name()
00025 {
00026 static char name[128];
00027
00028 *name = 0;
00029
00030 #ifdef HAVE_GETHOSTNAME
00031 gethostname(name, sizeof(name));
00032 name[sizeof(name)-1] = 0;
00033 #else
00034 #ifdef HAVE_SYS_UTSNAME_H
00035 uname (&attname);
00036 strcpy (name, attname.nodename);
00037 #endif
00038 #endif
00039
00040 return (name);
00041 }