summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-10-12 20:39:33 +0000
committerJim Meyering <jim@meyering.net>2006-10-12 20:39:33 +0000
commit9f70d6021b216fc36b5260a7a18f00f0acc27482 (patch)
tree5b5f6757d68980903bb8f8bf60c9384728dbe887
parent5f60ffcfcfef1a7a126792b7748c7072c8ee20be (diff)
downloadcoreutils-9f70d6021b216fc36b5260a7a18f00f0acc27482.tar.xz
* 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.
-rw-r--r--ChangeLog7
-rw-r--r--configure.ac10
-rw-r--r--src/who.c2
3 files changed, 14 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index d27c9e138..c5b430911 100644
--- 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.
diff --git a/configure.ac b/configure.ac
index 19020f8ef..c3f8b442d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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)
diff --git a/src/who.c b/src/who.c
index 211b08fb7..db3af6e18 100644
--- 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)