ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/myhostname.c
Revision: 2.1
Committed: Wed Feb 7 16:36:09 1996 UTC (28 years, 2 months ago) by greg
Content type: text/plain
Branch: MAIN
Log Message:
Initial revision

File Contents

# Content
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