summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac12
-rw-r--r--sessreg.c12
-rw-r--r--sessreg.h17
3 files changed, 22 insertions, 19 deletions
diff --git a/configure.ac b/configure.ac
index 739abfa..98061b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,7 +41,7 @@ XORG_DEFAULT_OPTIONS
XORG_WITH_LINT
# Checks for header files.
-AC_CHECK_HEADERS([lastlog.h utmp.h utmpx.h sys/param.h])
+AC_CHECK_HEADERS([lastlog.h pwd.h utmp.h utmpx.h sys/param.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_MEMBERS([
@@ -53,6 +53,16 @@ AC_CHECK_MEMBERS([
#include <utmp.h>
])
AC_CHECK_MEMBERS([struct utmpx.ut_syslen], [], [], [#include <utmpx.h>])
+AC_CHECK_TYPES([
+ struct lastlog], [], [],[
+ #include <sys/types.h>
+ #ifdef HAVE_UTMP_H
+ #include <utmp.h>
+ #endif
+ #ifdef HAVE_LASTLOG_H
+ #include <lastlog.h>
+ #endif
+ ])
# Checks for library functions.
AC_CHECK_FUNCS([pututline updwtmpx utmpxname])
diff --git a/sessreg.c b/sessreg.c
index 67c1b6d..d445498 100644
--- a/sessreg.c
+++ b/sessreg.c
@@ -61,7 +61,7 @@
*
* usage: sessreg [ -w <wtmp-file> ] [ -u <utmp-file> ]
* [ -l <line> ]
- * [ -L <lastlog-file> ] / #ifndef NO_LASTLOG
+ * [ -L <lastlog-file> ] / #ifdef USE_LASTLOG
* [ -h <host-name> ] / BSD only
* [ -s <slot-number> ] [ -x Xservers-file ] / BSD only
* [ -t <ttys-file> ] / BSD only
@@ -112,7 +112,7 @@ static int slot_number;
static char *xservers_file, *ttys_file;
static char *user_name;
static int aflag, dflag;
-#ifndef NO_LASTLOG
+#ifdef USE_LASTLOG
static char *llog_file;
static int llog_none, Lflag;
#endif
@@ -130,7 +130,7 @@ usage (int x)
{
if (x) {
fprintf (stderr, "%s: usage %s {-a -d} [-w wtmp-file] [-u utmp-file]", program_name, program_name);
-#ifndef NO_LASTLOG
+#ifdef USE_LASTLOG
fprintf (stderr, " [-L lastlog-file]");
#endif
fprintf (stderr, "\n");
@@ -207,7 +207,7 @@ main (int argc, char **argv)
if (!strcmp (utmp_file, "none"))
utmp_none = 1;
break;
-#ifndef NO_LASTLOG
+#ifdef USE_LASTLOG
case 'L':
llog_file = getstring (&argv, &Lflag);
if (!strcmp (llog_file, "none"))
@@ -266,7 +266,7 @@ main (int argc, char **argv)
#else
utmp_none = 1;
#endif
-#ifndef NO_LASTLOG
+#ifdef USE_LASTLOG
if (!Lflag)
llog_file = LLOG_FILE;
#endif
@@ -348,7 +348,7 @@ main (int argc, char **argv)
}
#endif
}
-#ifndef NO_LASTLOG
+#ifdef USE_LASTLOG
if (aflag && !llog_none) {
int llog;
struct passwd *pwd = getpwnam(user_name);
diff --git a/sessreg.h b/sessreg.h
index 0b93dc7..a5e7f83 100644
--- a/sessreg.h
+++ b/sessreg.h
@@ -67,19 +67,12 @@
# include <sys/param.h>
#endif
-#ifndef HAVE_LASTLOG_H
-# define NO_LASTLOG
-#endif
-
-#ifndef NO_LASTLOG
-# ifdef CSRG_BASED
-# if (BSD < 199103)
-# include <lastlog.h>
-# endif
-# else
-# include <lastlog.h>
+#if defined(HAVE_STRUCT_LASTLOG) && defined(HAVE_PWD_H)
+# ifdef HAVE_LASTLOG_H
+# include <lastlog.h>
# endif
-# include <pwd.h>
+# include <pwd.h>
+# define USE_LASTLOG
#endif
#ifdef CSRG_BASED