mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-08 05:16:52 +02:00
968d7733a1
places that were including the wrong files.
25 lines
387 B
C
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;
|
|
}
|