ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/myhostname.c
Revision: 2.3
Committed: Tue Feb 25 02:47:21 2003 UTC (21 years, 2 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R5
Changes since 2.2: +1 -56 lines
Log Message:
Replaced inline copyright notice with #include "copyright.h"

File Contents

# User Rev Content
1 greg 2.1 #ifndef lint
2 greg 2.2 static const char RCSid[] = "$Id$";
3 greg 2.1 #endif
4     /*
5     * Query system for host name
6 greg 2.2 */
7    
8 greg 2.3 #include "copyright.h"
9 greg 2.1
10     #ifndef BSD
11    
12     #include <sys/utsname.h>
13    
14     char *
15     myhostname()
16     {
17     static struct utsname nambuf;
18    
19     if (!nambuf.nodename[0])
20     uname(&nambuf);
21     return(nambuf.nodename);
22     }
23    
24     #else
25    
26     char *
27     myhostname()
28     {
29     static char hostname[65];
30    
31     if (!hostname[0])
32     gethostname(hostname, sizeof(hostname));
33     return(hostname);
34     }
35    
36     #endif