* configure.ac: Avoid compiler warnings about default return
authorJim Meyering <jim@meyering.net>
Thu, 12 Oct 2006 20:39:33 +0000 (20:39 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 12 Oct 2006 20:39:33 +0000 (20:39 +0000)
type in function definitions and unused variables in tests.
* src/who.c (print_user) [HAVE_UT_HOST]: hostlen is only needed
if this is #defined.

ChangeLog
configure.ac
src/who.c

index d27c9e1..c5b4309 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-10-12  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * configure.ac: Avoid compiler warnings about default return
+       type in function definitions and unused variables in tests.
+       * src/who.c (print_user) [HAVE_UT_HOST]: hostlen is only needed
+       if this is #defined.
+
 2006-10-12  Jim Meyering  <jim@meyering.net>
 
        * configure.ac: Reflect s/gl_MACROS/coreutils_MACROS/ renaming.
index 19020f8..c3f8b44 100644 (file)
@@ -59,14 +59,14 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
 # include <stdlib.h>
 #endif
 extern char **environ;
-unset_TZ ()
+void unset_TZ (void)
 {
   char **from, **to;
   for (to = from = environ; (*to = *from); from++)
     if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
       to++;
 }
-main()
+int main()
 {
   time_t now = time ((time_t *) 0);
   int hour_GMT0, hour_unset;
@@ -147,7 +147,7 @@ coreutils_DUMMY_1
 AC_MSG_CHECKING(ut_host in struct utmp)
 AC_CACHE_VAL(su_cv_func_ut_host_in_utmp,
 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
-#include <utmp.h>]], [[struct utmp ut; ut.ut_host;]])],
+#include <utmp.h>]], [[struct utmp ut; return !sizeof ut.ut_host;]])],
   [su_cv_func_ut_host_in_utmp=yes],
   [su_cv_func_ut_host_in_utmp=no])])
 AC_MSG_RESULT($su_cv_func_ut_host_in_utmp)
@@ -160,7 +160,7 @@ if test -z "$have_ut_host"; then
   AC_MSG_CHECKING(ut_host in struct utmpx)
   AC_CACHE_VAL(su_cv_func_ut_host_in_utmpx,
   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
-#include <utmpx.h>]], [[struct utmpx ut; ut.ut_host;]])],
+#include <utmpx.h>]], [[struct utmpx ut; return !sizeof ut.ut_host;]])],
     [su_cv_func_ut_host_in_utmpx=yes],
     [su_cv_func_ut_host_in_utmpx=no])])
   AC_MSG_RESULT($su_cv_func_ut_host_in_utmpx)
@@ -202,7 +202,7 @@ yes
 #define _XOPEN_SOURCE
 #endif
 #include <sys/types.h>
-#include <termios.h>]], [[struct termios t; t.c_line;]])],
+#include <termios.h>]], [[struct termios t; return !sizeof t.c_line;]])],
     [su_cv_sys_c_line_in_termios=yes],
     [su_cv_sys_c_line_in_termios=no])])
   AC_MSG_RESULT($su_cv_sys_c_line_in_termios)
index 211b08f..db3af6e 100644 (file)
--- a/src/who.c
+++ b/src/who.c
@@ -320,7 +320,9 @@ print_user (const STRUCT_UTMP *utmp_ent, time_t boottime)
   char mesg;
   char idlestr[IDLESTR_LEN + 1];
   static char *hoststr;
+#if HAVE_UT_HOST
   static size_t hostlen;
+#endif
 
 #define DEV_DIR_WITH_TRAILING_SLASH "/dev/"
 #define DEV_DIR_LEN (sizeof (DEV_DIR_WITH_TRAILING_SLASH) - 1)