diff options
author | Marc G. Fournier <scrappy@hub.org> | 1997-12-19 02:27:20 +0000 |
---|---|---|
committer | Marc G. Fournier <scrappy@hub.org> | 1997-12-19 02:27:20 +0000 |
commit | 3ad815fc2a15c96afd29298cff0ad0dfaf7c9fc4 (patch) | |
tree | bc0b93f2438f391952c177cbcfeb6c594ac6d137 /src/backend/port/gethostname.c | |
parent | 5379b84eff3ae207635d7ac9527b0a3f5eb272e7 (diff) |
port.c no longer required...individual functions that were in there are
auto-generated via configure
individual functions in individual files
Diffstat (limited to 'src/backend/port/gethostname.c')
-rw-r--r-- | src/backend/port/gethostname.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/backend/port/gethostname.c b/src/backend/port/gethostname.c new file mode 100644 index 00000000000..2971c795eea --- /dev/null +++ b/src/backend/port/gethostname.c @@ -0,0 +1,20 @@ +#include <sys/types.h> +#include <string.h> + +#include <sys/utsname.h> + +int +gethostname(char *name, int namelen) +{ + static struct utsname mname; + static int called = 0; + + if (!called) + { + called++; + uname(&mname); + } + strncpy(name, mname.nodename, (SYS_NMLN < namelen ? SYS_NMLN : namelen)); + + return (0); +} |