]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(main): Fail if -l is specified with no username.
authorJim Meyering <jim@meyering.net>
Fri, 24 Aug 2001 08:40:29 +0000 (08:40 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 24 Aug 2001 08:40:29 +0000 (08:40 +0000)
src/pinky.c

index 15d4fde2ac876c4c2a7f2a195e0b2e1825560df9..53bc33ef5532270ca8e06a9654f1748b6f9d01f0 100644 (file)
@@ -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