#define IDLESTR_LEN 6
#if HAVE_STRUCT_XTMP_UT_PID
-# define UT_PID(U) ((U)->ut_pid)
# define PIDSTR_DECL_AND_INIT(Var, Utmp_ent) \
char Var[INT_STRLEN_BOUND (Utmp_ent->ut_pid) + 1]; \
sprintf (Var, "%ld", (long int) (Utmp_ent->ut_pid))
#else
-# define UT_PID(U) 0
# define PIDSTR_DECL_AND_INIT(Var, Utmp_ent) \
const char *Var = ""
#endif
}
}
-/* Display a list of who is on the system, according to utmp file filename. */
+/* Display a list of who is on the system, according to utmp file FILENAME.
+ Use read_utmp OPTIONS to read the file. */
static void
-who (const char *filename)
+who (const char *filename, int options)
{
size_t n_users;
STRUCT_UTMP *utmp_buf;
- if (read_utmp (filename, &n_users, &utmp_buf) != 0)
+ if (read_utmp (filename, &n_users, &utmp_buf, options) != 0)
error (EXIT_FAILURE, errno, "%s", filename);
if (short_list)
switch (argc - optind)
{
+ case 2: /* who <blurf> <glop> */
+ my_line_only = true;
+ /* Fall through. */
case -1:
case 0: /* who */
- who (UTMP_FILE);
+ who (UTMP_FILE, READ_UTMP_CHECK_PIDS);
break;
case 1: /* who <utmp file> */
- who (argv[optind]);
- break;
-
- case 2: /* who <blurf> <glop> */
- my_line_only = true;
- who (UTMP_FILE);
+ who (argv[optind], 0);
break;
default: /* lose */