* NEWS, configure.in: Added configure option --enable-utmpx,
disabled by default. This defines USE_UTMPX, which should be used
instead of HAVE_UTMPX_H.
+ * libmisc/utmp.c: Replace HAVE_UTMPX_H by USE_UTMPX.
+ * libmisc/utmp.c: Removed old comment on HAVE_STRUCT_UTMP_UT_ID
+ and UTMPX support.
2009-04-27 Nicolas François <nicolas.francois@centraliens.net>
#include <utmp.h>
-// FIXME: disable UTMPX on Linux in configure.in
-// Maybe define an intermediate USE_UTMPX to replace HAVE_UTMPX_H,
-// which would be defined if HAVE_UTMPX_H is defined on non-Linux.
-#if HAVE_UTMPX_H
+#if USE_UTMPX
#include <utmpx.h>
#endif
}
#endif /* ! HAVE_UPDWTMP */
-#ifdef HAVE_UTMPX_H
+#ifdef USE_UTMPX
#ifndef HAVE_UPDWTMPX
static void updwtmpx (const char *filename, const struct utmpx *utx)
{
}
}
#endif /* ! HAVE_UPDWTMPX */
-#endif /* ! HAVE_UTMPX_H */
+#endif /* ! USE_UTMPX */
/*
* The returned structure shall be freed by the caller.
*/
/*@only@*/struct utmp *prepare_utmp (const char *name,
- const char *line,
- const char *host,
- /*@null@*/const struct utmp *ut)
+ const char *line,
+ const char *host,
+ /*@null@*/const struct utmp *ut)
{
struct timeval tv;
char *hostname = NULL;
return err;
}
-#ifdef HAVE_UTMPX_H
+#ifdef USE_UTMPX
/*
* prepare_utmpx - the UTMPX version for prepare_utmp
*/
/*@only@*/struct utmpx *prepare_utmpx (const char *name,
- const char *line,
- const char *host,
- /*@null@*/const struct utmp *ut)
+ const char *line,
+ const char *host,
+ /*@null@*/const struct utmp *ut)
{
struct timeval tv;
char *hostname = NULL;
utxent->ut_type = USER_PROCESS;
utxent->ut_pid = getpid ();
strncpy (utxent->ut_line, line, sizeof (utxent->ut_line));
-#ifndef HAVE_STRUCT_UTMP_UT_ID
-// FIXME: move to configure.in
-# error "No support for systems with utmpx and no ut_id field in utmp"
-#endif /* !HAVE_STRUCT_UTMP_UT_ID */
+ /* existence of ut->ut_id is enforced by configure */
if (NULL != ut) {
strncpy (utxent->ut_id, ut->ut_id, sizeof (utxent->ut_id));
} else {
return err;
}
-#endif /* HAVE_UTMPX_H */
+#endif /* USE_UTMPX */