summaryrefslogtreecommitdiff
path: root/src/uptime.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-03-30 05:22:30 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-03-30 05:22:30 +0000
commit733abad3edff116fffc3151eed98b44c476d14a9 (patch)
treee13f077f30650c8e0b5b6bb623c7391557988409 /src/uptime.c
parent6584af72c9de1b08619f1839b32f17746b34ac3b (diff)
downloadcoreutils-733abad3edff116fffc3151eed98b44c476d14a9.tar.gz
coreutils-733abad3edff116fffc3151eed98b44c476d14a9.tar.bz2
coreutils-733abad3edff116fffc3151eed98b44c476d14a9.zip
(uptime): New arg OPTIONS. All uses changed.
(main): Check PIDs when invoked with zero arguments.
Diffstat (limited to 'src/uptime.c')
-rw-r--r--src/uptime.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/uptime.c b/src/uptime.c
index 35fc5b79d..eaa3f7f07 100644
--- a/src/uptime.c
+++ b/src/uptime.c
@@ -154,15 +154,16 @@ print_uptime (size_t n, const STRUCT_UTMP *this)
}
/* Display the system uptime and the number of users on the system,
- according to utmp file FILENAME. */
+ according to utmp file FILENAME. Use read_utmp OPTIONS to read the
+ utmp file. */
static void
-uptime (const char *filename)
+uptime (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);
print_uptime (n_users, utmp_buf);
@@ -211,11 +212,11 @@ main (int argc, char **argv)
switch (argc - optind)
{
case 0: /* uptime */
- uptime (UTMP_FILE);
+ uptime (UTMP_FILE, READ_UTMP_CHECK_PIDS);
break;
case 1: /* uptime <utmp file> */
- uptime (argv[optind]);
+ uptime (argv[optind], 0);
break;
default: /* lose */