dnl ---------------
dnl CHECK FUNCTIONS
dnl ---------------
-AC_CHECK_FUNCS(writev lstat getutent nl_langinfo)
+AC_CHECK_FUNCS(writev lstat nl_langinfo)
dnl Check for multibyte character set support
if test "x$ac_cv_header_wchar_h" = "xyes" -a "x$ac_cv_header_wctype_h" = "xyes" \
dnl CHECK STRUCTURES
dnl ----------------
-AC_CHECK_MEMBERS(struct utmp.ut_type,,,[#include <utmp.h>])
-
AC_STRUCT_DIRENT_D_TYPE
dnl Where is <signal.h> located? Needed as input for signames.awk
#include <signal.h>
#include <fcntl.h>
-#include <utmp.h>
-
-#ifndef HAVE_GETUTENT
-# ifndef UTMP_FILE
-# ifdef _PATH_UTMP
-# define UTMP_FILE _PATH_UTMP
-# else
-# define UTMP_FILE "/etc/utmp"
-# endif
-# endif
-#endif
+#include <utmpx.h>
#define SCANFMT \
"%2(hour{dtimenow}):%02(min{dtimenow}): %<(size)%5(size) %>%<{encrypted}E%>\
int md, vecp = 0;
char *cp, *user, buf[BUFSIZ], tty[BUFSIZ];
char **argp, **arguments, *vec[MAXARGS];
-#ifdef HAVE_GETUTENT
- struct utmp * utp;
-#else
- struct utmp ut;
- register FILE *uf;
-#endif
-
+ struct utmpx *utp;
#ifdef LOCALE
setlocale(LC_ALL, "");
#endif
user = getusername();
-#ifdef HAVE_GETUTENT
- setutent();
- while ((utp = getutent()) != NULL) {
- if (
-#ifdef HAVE_STRUCT_UTMP_UT_TYPE
- utp->ut_type == USER_PROCESS
- &&
-#endif
- utp->ut_name[0] != 0
+ setutxent();
+ while ((utp = getutxent()) != NULL) {
+ if (utp->ut_type == USER_PROCESS && utp->ut_user[0] != 0
&& utp->ut_line[0] != 0
- && strncmp (user, utp->ut_name, sizeof(utp->ut_name)) == 0) {
+ && strncmp (user, utp->ut_user, sizeof(utp->ut_user)) == 0) {
strncpy (tty, utp->ut_line, sizeof(utp->ut_line));
alert (tty, md);
}
}
- endutent();
-#else
- if ((uf = fopen (UTMP_FILE, "r")) == NULL)
- exit (RCV_MBX);
- while (fread ((char *) &ut, sizeof(ut), 1, uf) == 1)
- if (ut.ut_name[0] != 0
- && strncmp (user, ut.ut_name, sizeof(ut.ut_name)) == 0) {
- strncpy (tty, ut.ut_line, sizeof(ut.ut_line));
- alert (tty, md);
- }
- fclose (uf);
-#endif
+ endutxent();
exit (RCV_MOK);
return 0; /* dead code to satisfy the compiler */
#include NDBM_HEADER
#endif
-#include <utmp.h>
-
-#ifndef HAVE_GETUTENT
-# ifndef UTMP_FILE
-# ifdef _PATH_UTMP
-# define UTMP_FILE _PATH_UTMP
-# else
-# define UTMP_FILE "/etc/utmp"
-# endif
-# endif
-#endif
+#include <utmpx.h>
static struct swit switches[] = {
#define ADDRSW 0
* logged in.
*/
-#ifdef HAVE_GETUTENT
static int
logged_in (void)
{
- struct utmp * utp;
+ struct utmpx *utp;
if (utmped)
return utmped;
- setutent();
+ setutxent();
- while ((utp = getutent()) != NULL) {
- if (
-#ifdef HAVE_STRUCT_UTMP_UT_TYPE
- utp->ut_type == USER_PROCESS
- &&
-#endif
- utp->ut_name[0] != 0
- && strncmp (user, utp->ut_name, sizeof(utp->ut_name)) == 0) {
+ while ((utp = getutxent()) != NULL) {
+ if ( utp->ut_type == USER_PROCESS && utp->ut_user[0] != 0
+ && strncmp (user, utp->ut_user, sizeof(utp->ut_user)) == 0) {
if (debug)
continue;
- endutent();
+ endutxent();
return (utmped = DONE);
}
}
- endutent();
+ endutxent();
return (utmped = NOTOK);
}
-#else
-static int
-logged_in (void)
-{
- struct utmp ut;
- FILE *uf;
-
- if (utmped)
- return utmped;
-
- if ((uf = fopen (UTMP_FILE, "r")) == NULL)
- return NOTOK;
-
- while (fread ((char *) &ut, sizeof(ut), 1, uf) == 1) {
- if (ut.ut_name[0] != 0
- && strncmp (user, ut.ut_name, sizeof(ut.ut_name)) == 0) {
- if (debug)
- continue;
- fclose (uf);
- return (utmped = DONE);
- }
- }
-
- fclose (uf);
- return (utmped = NOTOK);
-}
-#endif
#define check(t,a,b) if (t < a || t > b) return -1
#define cmpar(h1,m1,h2,m2) if (h1 < h2 || (h1 == h2 && m1 < m2)) return 0