summaryrefslogtreecommitdiff
path: root/src/users.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-03-30 05:23:17 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-03-30 05:23:17 +0000
commit08b59778675d670a6dc3e88ce79311388b0c2385 (patch)
treef7a1463401b852db8fa408df25d0cd0ad5ff53c5 /src/users.c
parent733abad3edff116fffc3151eed98b44c476d14a9 (diff)
downloadcoreutils-08b59778675d670a6dc3e88ce79311388b0c2385.tar.xz
(users): New arg OPTIONS. All uses changed.
(main): Check PIDs when invoked with zero arguments.
Diffstat (limited to 'src/users.c')
-rw-r--r--src/users.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/users.c b/src/users.c
index a8851f348..7f9be7396 100644
--- a/src/users.c
+++ b/src/users.c
@@ -1,5 +1,5 @@
/* GNU's users.
- Copyright (C) 1992-2004 Free Software Foundation, Inc.
+ Copyright (C) 1992-2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -80,15 +80,16 @@ list_entries_users (size_t n, const STRUCT_UTMP *this)
free (u);
}
-/* Display a list of users on the system, according to utmp file FILENAME. */
+/* Display a list of users on the system, according to utmp file FILENAME.
+ Use read_utmp OPTIONS to read FILENAME. */
static void
-users (const char *filename)
+users (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);
list_entries_users (n_users, utmp_buf);
@@ -137,11 +138,11 @@ main (int argc, char **argv)
switch (argc - optind)
{
case 0: /* users */
- users (UTMP_FILE);
+ users (UTMP_FILE, READ_UTMP_CHECK_PIDS);
break;
case 1: /* users <utmp file> */
- users (argv[optind]);
+ users (argv[optind], 0);
break;
default: /* lose */