diff options
| author | Richard M. Stallman | 1993-05-26 23:14:00 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-05-26 23:14:00 +0000 |
| commit | f8a803133207d0e8de24a4703d714c0e1b06659d (patch) | |
| tree | 090356626f0a07a77023aef8c2cadbfcd6f1150b /src | |
| parent | c12710e962f40ef17c65672c1b78c762ce2a8ed1 (diff) | |
| download | emacs-f8a803133207d0e8de24a4703d714c0e1b06659d.tar.gz emacs-f8a803133207d0e8de24a4703d714c0e1b06659d.zip | |
[HAVE_SOCKETS]: Include socket.h, netdb.h.
(get_system_name) [HAVE_SOCKETS]: Use gethostbyname.
Diffstat (limited to 'src')
| -rw-r--r-- | src/sysdep.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/sysdep.c b/src/sysdep.c index cc003ee8202..300ad654f1e 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -1712,6 +1712,17 @@ static struct utsname get_system_name_name; | |||
| 1712 | #endif /* not HAVE_GETHOSTNAME */ | 1712 | #endif /* not HAVE_GETHOSTNAME */ |
| 1713 | #endif /* USG */ | 1713 | #endif /* USG */ |
| 1714 | 1714 | ||
| 1715 | #ifndef BSD4_1 | ||
| 1716 | #ifndef USG | ||
| 1717 | #ifndef VMS | ||
| 1718 | #ifdef HAVE_SOCKETS | ||
| 1719 | #include <sys/socket.h> | ||
| 1720 | #include <netdb.h> | ||
| 1721 | #endif /* HAVE_SOCKETS */ | ||
| 1722 | #endif /* not VMS */ | ||
| 1723 | #endif /* not USG */ | ||
| 1724 | #endif /* not BSD4_1 */ | ||
| 1725 | |||
| 1715 | char * | 1726 | char * |
| 1716 | get_system_name () | 1727 | get_system_name () |
| 1717 | { | 1728 | { |
| @@ -1742,6 +1753,20 @@ get_system_name () | |||
| 1742 | strcpy (system_name_saved, sp); | 1753 | strcpy (system_name_saved, sp); |
| 1743 | #else /* not VMS */ | 1754 | #else /* not VMS */ |
| 1744 | gethostname (system_name_saved, sizeof (system_name_saved)); | 1755 | gethostname (system_name_saved, sizeof (system_name_saved)); |
| 1756 | #ifdef HAVE_SOCKETS | ||
| 1757 | /* Turn the hostname into the official, fully-qualified hostname. | ||
| 1758 | Don't do this if we're going to dump; this can confuse system | ||
| 1759 | libraries on some machines and make the dumped emacs core dump. */ | ||
| 1760 | #ifndef CANNOT_DUMP | ||
| 1761 | if (initialized) | ||
| 1762 | #endif /* not CANNOT_DUMP */ | ||
| 1763 | { | ||
| 1764 | struct hostent *hp; | ||
| 1765 | hp = gethostbyname (system_name_saved); | ||
| 1766 | if (hp && strlen (hp->h_name) < sizeof(system_name_saved)) | ||
| 1767 | strcpy (system_name_saved, hp->h_name); | ||
| 1768 | } | ||
| 1769 | #endif /* HAVE_SOCKETS */ | ||
| 1745 | #endif /* not VMS */ | 1770 | #endif /* not VMS */ |
| 1746 | return system_name_saved; | 1771 | return system_name_saved; |
| 1747 | #endif /* not USG, not 4.1 */ | 1772 | #endif /* not USG, not 4.1 */ |