summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-08-24 08:40:29 +0000
committerJim Meyering <jim@meyering.net>2001-08-24 08:40:29 +0000
commit815dafff5a635c3417fe1ef32437527c44bc71db (patch)
tree7020dcd97bee70349bea8dd88604694b16f2ee43 /src
parent5f6b9742d1b5b4fae22a631fe76a335d5587f4c6 (diff)
downloadcoreutils-815dafff5a635c3417fe1ef32437527c44bc71db.tar.xz
(main): Fail if -l is specified with no username.
Diffstat (limited to 'src')
-rw-r--r--src/pinky.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/pinky.c b/src/pinky.c
index 15d4fde2a..53bc33ef5 100644
--- a/src/pinky.c
+++ b/src/pinky.c
@@ -469,7 +469,7 @@ usage (int status)
printf (_("Usage: %s [OPTION]... [USER]...\n"), program_name);
printf (_("\
\n\
- -l do long format output (you must specify at least one USER)\n\
+ -l produce long format output for the specified USERs\n\
-b omit the user's home directory and shell in long format\n\
-h omit the user's project file in long format\n\
-p omit the user's plan file in long format\n\
@@ -494,6 +494,7 @@ int
main (int argc, char **argv)
{
int optc, longind;
+ int n_users;
program_name = argv[0];
setlocale (LC_ALL, "");
@@ -562,6 +563,15 @@ main (int argc, char **argv)
}
}
+ n_users = argc - optind;
+
+ if (do_short_format == 0 && n_users == 0)
+ {
+ error (0, 0, _("no username specified; at least one must be\
+ specified when using -l"));
+ usage (1);
+ }
+
if (do_short_format)
short_pinky (UTMP_FILE, argc - optind, argv + optind);
else