#if READ_UTMP_SUPPORTED
-/* Is the utmp entry U desired by the user who asked for OPTIONS? */
+/* Is the utmp entry UT desired by the user who asked for OPTIONS? */
static bool
-desirable_utmp_entry (STRUCT_UTMP const *u, int options)
+desirable_utmp_entry (STRUCT_UTMP const *ut, int options)
{
- bool user_proc = IS_USER_PROCESS (u);
+ bool user_proc = IS_USER_PROCESS (ut);
if ((options & READ_UTMP_USER_PROCESS) && !user_proc)
return false;
if ((options & READ_UTMP_CHECK_PIDS)
&& user_proc
- && 0 < UT_PID (u)
- && (kill (UT_PID (u), 0) < 0 && errno == ESRCH))
+ && 0 < UT_PID (ut)
+ && (kill (UT_PID (ut), 0) < 0 && errno == ESRCH))
return false;
return true;
}
idx_t n_read = 0;
idx_t n_alloc = 0;
STRUCT_UTMP *utmp = NULL;
- STRUCT_UTMP *u;
+ STRUCT_UTMP *ut;
/* Ignore the return value for now.
Solaris' utmpname returns 1 upon success -- which is contrary
SET_UTMP_ENT ();
- while ((u = GET_UTMP_ENT ()) != NULL)
- if (desirable_utmp_entry (u, options))
+ while ((ut = GET_UTMP_ENT ()) != NULL)
+ if (desirable_utmp_entry (ut, options))
{
if (n_read == n_alloc)
utmp = xpalloc (utmp, &n_alloc, 1, -1, sizeof *utmp);
- copy_utmp_entry (&utmp[n_read++], u);
+ copy_utmp_entry (&utmp[n_read++], ut);
}
END_UTMP_ENT ();
# endif
# include <utmpx.h>
# define UTMP_STRUCT_NAME utmpx
-# define UT_TIME_MEMBER(UT_PTR) ((UT_PTR)->ut_tv.tv_sec)
+# define UT_TIME_MEMBER(UT) ((UT)->ut_tv.tv_sec)
# define SET_UTMP_ENT setutxent
# define GET_UTMP_ENT getutxent
# define END_UTMP_ENT endutxent
# endif
# if HAVE_STRUCT_UTMPX_UT_EXIT_E_TERMINATION
-# define UT_EXIT_E_TERMINATION(U) ((U)->ut_exit.e_termination)
+# define UT_EXIT_E_TERMINATION(UT) ((UT)->ut_exit.e_termination)
# else
# if HAVE_STRUCT_UTMPX_UT_EXIT_UT_TERMINATION
-# define UT_EXIT_E_TERMINATION(U) ((U)->ut_exit.ut_termination)
+# define UT_EXIT_E_TERMINATION(UT) ((UT)->ut_exit.ut_termination)
# else
-# define UT_EXIT_E_TERMINATION(U) 0
+# define UT_EXIT_E_TERMINATION(UT) 0
# endif
# endif
# if HAVE_STRUCT_UTMPX_UT_EXIT_E_EXIT
-# define UT_EXIT_E_EXIT(U) ((U)->ut_exit.e_exit)
+# define UT_EXIT_E_EXIT(UT) ((UT)->ut_exit.e_exit)
# else
# if HAVE_STRUCT_UTMPX_UT_EXIT_UT_EXIT
-# define UT_EXIT_E_EXIT(U) ((U)->ut_exit.ut_exit)
+# define UT_EXIT_E_EXIT(UT) ((UT)->ut_exit.ut_exit)
# else
-# define UT_EXIT_E_EXIT(U) 0
+# define UT_EXIT_E_EXIT(UT) 0
# endif
# endif
struct utmp *getutent (void);
# endif
# define UTMP_STRUCT_NAME utmp
-# define UT_TIME_MEMBER(UT_PTR) ((UT_PTR)->ut_time)
+# define UT_TIME_MEMBER(UT) ((UT)->ut_time)
# define SET_UTMP_ENT setutent
# define GET_UTMP_ENT getutent
# define END_UTMP_ENT endutent
# endif
# if HAVE_STRUCT_UTMP_UT_EXIT_E_TERMINATION
-# define UT_EXIT_E_TERMINATION(U) ((U)->ut_exit.e_termination)
+# define UT_EXIT_E_TERMINATION(UT) ((UT)->ut_exit.e_termination)
# else
# if HAVE_STRUCT_UTMP_UT_EXIT_UT_TERMINATION
-# define UT_EXIT_E_TERMINATION(U) ((U)->ut_exit.ut_termination)
+# define UT_EXIT_E_TERMINATION(UT) ((UT)->ut_exit.ut_termination)
# else
-# define UT_EXIT_E_TERMINATION(U) 0
+# define UT_EXIT_E_TERMINATION(UT) 0
# endif
# endif
# if HAVE_STRUCT_UTMP_UT_EXIT_E_EXIT
-# define UT_EXIT_E_EXIT(U) ((U)->ut_exit.e_exit)
+# define UT_EXIT_E_EXIT(UT) ((UT)->ut_exit.e_exit)
# else
# if HAVE_STRUCT_UTMP_UT_EXIT_UT_EXIT
-# define UT_EXIT_E_EXIT(U) ((U)->ut_exit.ut_exit)
+# define UT_EXIT_E_EXIT(UT) ((UT)->ut_exit.ut_exit)
# else
-# define UT_EXIT_E_EXIT(U) 0
+# define UT_EXIT_E_EXIT(UT) 0
# endif
# endif
struct timeval ut_tv;
};
# define UTMP_STRUCT_NAME gl_utmp
-# define UT_TIME_MEMBER(UT_PTR) ((UT_PTR)->ut_tv.tv_sec)
-# define UT_EXIT_E_TERMINATION(U) 0
-# define UT_EXIT_E_EXIT(U) 0
+# define UT_TIME_MEMBER(UT) ((UT)->ut_tv.tv_sec)
+# define UT_EXIT_E_TERMINATION(UT) 0
+# define UT_EXIT_E_EXIT(UT) 0
# endif
# if HAVE_UTMPX_H
# if HAVE_STRUCT_UTMPX_UT_USER
-# define UT_USER(Utmp) ((Utmp)->ut_user)
+# define UT_USER(UT) ((UT)->ut_user)
# endif
# if HAVE_STRUCT_UTMPX_UT_NAME
# undef UT_USER
-# define UT_USER(Utmp) ((Utmp)->ut_name)
+# define UT_USER(UT) ((UT)->ut_name)
# endif
# elif HAVE_UTMP_H
# if HAVE_STRUCT_UTMP_UT_USER
-# define UT_USER(Utmp) ((Utmp)->ut_user)
+# define UT_USER(UT) ((UT)->ut_user)
# endif
# if HAVE_STRUCT_UTMP_UT_NAME
# undef UT_USER
-# define UT_USER(Utmp) ((Utmp)->ut_name)
+# define UT_USER(UT) ((UT)->ut_name)
# endif
# else /* dummy fallback */
-# define UT_USER(Utmp) ((Utmp)->ut_user)
+# define UT_USER(UT) ((UT)->ut_user)
# endif
/* Accessor macro for the member named ut_pid. */
# if HAVE_STRUCT_XTMP_UT_PID
-# define UT_PID(U) ((U)->ut_pid)
+# define UT_PID(UT) ((UT)->ut_pid)
# else
-# define UT_PID(U) 0
+# define UT_PID(UT) 0
# endif
/* Accessor macros for the member named ut_type. */
# if HAVE_STRUCT_UTMP_UT_TYPE || HAVE_STRUCT_UTMPX_UT_TYPE
-# define UT_TYPE_EQ(U, V) ((U)->ut_type == (V))
+# define UT_TYPE_EQ(UT, V) ((UT)->ut_type == (V))
# define UT_TYPE_NOT_DEFINED 0
# else
-# define UT_TYPE_EQ(U, V) 0
+# define UT_TYPE_EQ(UT, V) 0
# define UT_TYPE_NOT_DEFINED 1
# endif
# ifdef BOOT_TIME
-# define UT_TYPE_BOOT_TIME(U) UT_TYPE_EQ (U, BOOT_TIME)
+# define UT_TYPE_BOOT_TIME(UT) UT_TYPE_EQ (UT, BOOT_TIME)
# else
-# define UT_TYPE_BOOT_TIME(U) 0
+# define UT_TYPE_BOOT_TIME(UT) 0
# endif
# ifdef USER_PROCESS
-# define UT_TYPE_USER_PROCESS(U) UT_TYPE_EQ (U, USER_PROCESS)
+# define UT_TYPE_USER_PROCESS(UT) UT_TYPE_EQ (UT, USER_PROCESS)
# else
-# define UT_TYPE_USER_PROCESS(U) 0
+# define UT_TYPE_USER_PROCESS(UT) 0
# endif
-/* Determines whether an entry *U corresponds to a user process. */
-# define IS_USER_PROCESS(U) \
- (UT_USER (U)[0] \
- && (UT_TYPE_USER_PROCESS (U) \
- || (UT_TYPE_NOT_DEFINED && UT_TIME_MEMBER (U) != 0)))
+/* Determines whether an entry *UT corresponds to a user process. */
+# define IS_USER_PROCESS(UT) \
+ (UT_USER (UT)[0] \
+ && (UT_TYPE_USER_PROCESS (UT) \
+ || (UT_TYPE_NOT_DEFINED && UT_TIME_MEMBER (UT) != 0)))
/* Define if read_utmp is not just a dummy. */
# if HAVE_UTMPX_H || HAVE_UTMP_H