From 3ba14d85abede72a40c5ba8fe18d1a2e1625d19e Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Mon, 19 Jan 2009 15:47:29 -0200 Subject: Ansification and compile warning fixes. This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and all gcc 4.3 and sparse warnings. --- .gitignore | 4 ++++ Makefile.am | 2 +- configure.ac | 10 +++++++--- sessreg.c | 26 +++++++++++++------------- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 3b4eb4d..b28b26e 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,7 @@ sessreg sessreg.1 stamp-h1 *~ +*.o +ChangeLog +sessreg-*.tar.* +tags diff --git a/Makefile.am b/Makefile.am index 8a7f6e3..4620843 100644 --- a/Makefile.am +++ b/Makefile.am @@ -78,6 +78,6 @@ MAINTAINERCLEANFILES=ChangeLog .PHONY: ChangeLog ChangeLog: - git-log > ChangeLog + $(CHANGELOG_CMD) dist-hook: ChangeLog diff --git a/configure.ac b/configure.ac index 26a4140..3d07a58 100644 --- a/configure.ac +++ b/configure.ac @@ -29,13 +29,15 @@ AM_MAINTAINER_MODE AM_CONFIG_HEADER(config.h) -# Require xorg-macros version 1.1.0 or newer for XORG_WITH_LINT macro -m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.1 or later before running autoconf/autogen])]) -XORG_MACROS_VERSION(1.1) +# Require xorg-macros: XORG_CWARNFLAGS, XORG_CHANGELOG +m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.2 or later before running autoconf/autogen])]) +XORG_MACROS_VERSION(1.2) AC_PROG_CC AC_PROG_INSTALL +XORG_CWARNFLAGS + AC_CHECK_HEADERS([lastlog.h utmpx.h sys/param.h]) AC_CHECK_MEMBER([struct utmpx.ut_syslen], HAVE_SYSLEN=1, @@ -48,6 +50,7 @@ AC_SYS_LARGEFILE # Checks for pkg-config packages PKG_CHECK_MODULES(SESSREG, xproto) +SESSREG_CFLAGS="$CWARNFLAGS $SESSREG_CFLAGS" AC_SUBST(SESSREG_CFLAGS) # Allow checking code with lint, sparse, etc. @@ -55,5 +58,6 @@ XORG_WITH_LINT XORG_MANPAGE_SECTIONS XORG_RELEASE_VERSION +XORG_CHANGELOG AC_OUTPUT([Makefile]) diff --git a/sessreg.c b/sessreg.c index eed1816..bdd82bf 100644 --- a/sessreg.c +++ b/sessreg.c @@ -96,28 +96,28 @@ static void set_utmpx (struct utmpx *u, const char *line, const char *user, const char *host, Time_t date, int addp); #endif -int wflag, uflag, lflag; -char *wtmp_file, *utmp_file, *line; +static int wflag, uflag, lflag; +static char *wtmp_file, *utmp_file, *line; #ifdef USE_UTMPX static char *wtmpx_file = NULL, *utmpx_file = NULL; #endif -int utmp_none, wtmp_none; +static int utmp_none, wtmp_none; /* * BSD specific variables. To make life much easier for Xstartup/Xreset * maintainers, these arguments are accepted but ignored for sysV */ -int hflag, sflag, xflag, tflag; -char *host_name = NULL; -int slot_number; -char *xservers_file, *ttys_file; -char *user_name; -int aflag, dflag; +static int hflag, sflag, xflag, tflag; +static char *host_name = NULL; +static int slot_number; +static char *xservers_file, *ttys_file; +static char *user_name; +static int aflag, dflag; #ifndef NO_LASTLOG -char *llog_file; -int llog_none, Lflag; +static char *llog_file; +static int llog_none, Lflag; #endif -char *program_name; +static char *program_name; #ifndef SYSV static int findslot (char *line_name, char *host_name, int addp, int slot); @@ -239,7 +239,7 @@ main (int argc, char **argv) } } usage (!(user_name = *argv++)); - usage (*argv != 0); + usage (*argv != NULL); /* * complain if neither aflag nor dflag are set, * or if both are set. -- cgit v1.2.3