summaryrefslogtreecommitdiff
path: root/sessreg.c
diff options
context:
space:
mode:
authorEd Schouten <ed@80386.nl>2011-06-26 14:04:20 +0200
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-06-26 09:30:31 -0700
commit18d68ce74bd810bc09f99a476798b8e4a66ec494 (patch)
treec6defc3bc8077905ada0a235df8fc41ae9f92672 /sessreg.c
parent9e93c5f65a22824f6b4af7ee68944f2226f7efa7 (diff)
Make lastlog work on BSD systems without <lastlog.h>.
FreeBSD 8.x and lower have struct lastlog in <utmp.h>. Add a specific Autoconf check for struct lastlog, where we include both <utmp.h> and <lastlog.h>. Also, change NO_LASTLOG to a definition for the opposite; USE_LASTLOG. This is more consistent with USE_UTMP and USE_UTMPX. Signed-off-by: Ed Schouten <ed@80386.nl> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'sessreg.c')
-rw-r--r--sessreg.c12
1 files changed, 6 insertions, 6 deletions
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);