postgresql/src/backend/port/gethostname.c
Peter Eisentraut 968d7733a1 Rename config.h to pg_config.h and os.h to pg_config_os.h, fix a number of
places that were including the wrong files.
2001-08-24 14:07:50 +00:00

25 lines
387 B
C

/* $Id: gethostname.c,v 1.5 2001/08/24 14:07:49 petere Exp $ */
#include "c.h"
#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;
}