1 |
/* Copyright (c) 1996 Regents of the University of California */ |
2 |
|
3 |
#ifndef lint |
4 |
static char SCCSid[] = "$SunId$ LBL"; |
5 |
#endif |
6 |
|
7 |
/* |
8 |
* Query system for host name |
9 |
*/ |
10 |
|
11 |
#ifndef BSD |
12 |
|
13 |
#include <sys/utsname.h> |
14 |
|
15 |
char * |
16 |
myhostname() |
17 |
{ |
18 |
static struct utsname nambuf; |
19 |
|
20 |
if (!nambuf.nodename[0]) |
21 |
uname(&nambuf); |
22 |
return(nambuf.nodename); |
23 |
} |
24 |
|
25 |
#else |
26 |
|
27 |
char * |
28 |
myhostname() |
29 |
{ |
30 |
static char hostname[65]; |
31 |
|
32 |
if (!hostname[0]) |
33 |
gethostname(hostname, sizeof(hostname)); |
34 |
return(hostname); |
35 |
} |
36 |
|
37 |
#endif |