From: markus schnalke Date: Mon, 26 Mar 2012 19:37:26 +0000 (+0200) Subject: Deprecate uname() in favour of (Posix) gethostname(). X-Git-Tag: mmh-thesis-end~189 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=b6fbaae87d9cf00b74d94050c10ba3e700545178;p=mmh Deprecate uname() in favour of (Posix) gethostname(). Merged from nmh. Thanks to Lyndon Nerenberg and Ken Hornstein. --- diff --git a/configure.ac b/configure.ac index cb5a79a..4bedb05 100644 --- a/configure.ac +++ b/configure.ac @@ -343,7 +343,7 @@ AC_HEADER_TIOCGWINSZ AC_CHECK_HEADERS(string.h memory.h stdlib.h unistd.h errno.h fcntl.h \ limits.h crypt.h termcap.h termio.h termios.h locale.h \ langinfo.h wchar.h wctype.h iconv.h netdb.h \ - sys/param.h sys/time.h sys/utsname.h sys/stream.h \ + sys/param.h sys/time.h sys/stream.h \ arpa/inet.h arpa/ftp.h) dnl @@ -367,7 +367,7 @@ dnl CHECK FUNCTIONS dnl --------------- AC_CHECK_LIB(mkstemp,mkstemp) AC_CHECK_FUNCS(waitpid sigaction sigprocmask sigblock sigsetmask \ - sighold sigrelse lstat uname tzset mkstemp \ + sighold sigrelse lstat tzset mkstemp \ getutent nl_langinfo mbtowc wcwidth) dnl sigsetjmp may be a macro diff --git a/sbr/mts.c b/sbr/mts.c index a464493..7c70e46 100644 --- a/sbr/mts.c +++ b/sbr/mts.c @@ -14,10 +14,6 @@ #include #include -#ifdef HAVE_SYS_UTSNAME_H -# include -#endif - #define NOTOK (-1) #define OK 0 @@ -39,25 +35,16 @@ LocalName(void) { static char buffer[BUFSIZ] = ""; struct addrinfo hints, *res; -#ifdef HAVE_UNAME - struct utsname name; -#endif /* check if we have cached the local name */ if (buffer[0]) return buffer; memset(buffer, 0, sizeof(buffer)); -#ifdef HAVE_UNAME - /* first get our local name */ - uname(&name); - strncpy(buffer, name.nodename, sizeof(buffer) - 1); -#else /* first get our local name */ gethostname(buffer, sizeof(buffer) - 1); -#endif - /* now fully qualify our name */ + /* now fully qualify our name */ memset(&hints, 0, sizeof(hints)); hints.ai_flags = AI_CANONNAME; hints.ai_family = PF_UNSPEC;