diff options
| author | Richard M. Stallman | 1992-10-29 10:44:50 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1992-10-29 10:44:50 +0000 |
| commit | e36ba278378a67b25e3d21fdba36e79de7b2c57a (patch) | |
| tree | 2ef8c407743ffbc709bbe8e2c902fd62f0ae3057 /src | |
| parent | 94aa5d2d372132906a20ede91a1bd928c4447e5c (diff) | |
| download | emacs-e36ba278378a67b25e3d21fdba36e79de7b2c57a.tar.gz emacs-e36ba278378a67b25e3d21fdba36e79de7b2c57a.zip | |
(get_system_name): Use gethostname for USG systems
if HAVE_GETHOSTNAME is defined.
Diffstat (limited to 'src')
| -rw-r--r-- | src/sysdep.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/sysdep.c b/src/sysdep.c index 6197eabef8d..ecacfa8b3d3 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -1539,17 +1539,27 @@ end_of_data () | |||
| 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; |