comparison src/sysdep.c @ 1496:f9010847a5f5

(get_system_name): Use gethostname for USG systems if HAVE_GETHOSTNAME is defined.
author Richard M. Stallman <rms@gnu.org>
date Thu, 29 Oct 1992 10:44:50 +0000
parents bc1acd76b294
children d978f163d9a4
comparison
equal deleted inserted replaced
1495:f17665e7347e 1496:f9010847a5f5
1537 1537
1538 #ifdef BSD4_1 1538 #ifdef BSD4_1
1539 #include <whoami.h> 1539 #include <whoami.h>
1540 #endif 1540 #endif
1541 1541
1542 /* Can't have this within the function since `static' is #defined to
1543 nothing for some USG systems. */
1542 #ifdef USG 1544 #ifdef USG
1543 /* Can't have this within the function since `static' is #defined to nothing */ 1545 #ifdef HAVE_GETHOSTNAME
1546 static char get_system_name_name[256];
1547 #else /* not HAVE_GETHOSTNAME */
1544 static struct utsname get_system_name_name; 1548 static struct utsname get_system_name_name;
1545 #endif 1549 #endif /* not HAVE_GETHOSTNAME */
1550 #endif /* USG */
1546 1551
1547 char * 1552 char *
1548 get_system_name () 1553 get_system_name ()
1549 { 1554 {
1550 #ifdef USG 1555 #ifdef USG
1556 #ifdef HAVE_GETHOSTNAME
1557 gethostname (get_system_name_name, sizeof (get_system_name_name));
1558 return get_system_name_name;
1559 #else /* not HAVE_GETHOSTNAME */
1551 uname (&get_system_name_name); 1560 uname (&get_system_name_name);
1552 return (get_system_name_name.nodename); 1561 return (get_system_name_name.nodename);
1562 #endif /* not HAVE_GETHOSTNAME */
1553 #else /* Not USG */ 1563 #else /* Not USG */
1554 #ifdef BSD4_1 1564 #ifdef BSD4_1
1555 return sysname; 1565 return sysname;
1556 #else /* not USG, not 4.1 */ 1566 #else /* not USG, not 4.1 */
1557 static char system_name_saved[32]; 1567 static char system_name_saved[32];