summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-05-10 10:41:14 +0000
committerJim Meyering <jim@meyering.net>2003-05-10 10:41:14 +0000
commit9f763671c07592bba130399e71a6fd42a41276c8 (patch)
tree998d9a10af1bb79921046f7e75fdee8d32ac1020 /src
parent06dacc0d6d1561500bd4d883db4b7945553bd603 (diff)
downloadcoreutils-9f763671c07592bba130399e71a6fd42a41276c8.tar.xz
Include error.h.
Diffstat (limited to 'src')
-rw-r--r--src/logname.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/logname.c b/src/logname.c
index d86fab0e8..0a2335c0c 100644
--- a/src/logname.c
+++ b/src/logname.c
@@ -1,5 +1,5 @@
/* logname -- print user's login name
- Copyright (C) 1990-1997, 1999-2002 Free Software Foundation, Inc.
+ Copyright (C) 1990-1997, 1999-2003 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
@@ -22,6 +22,7 @@
#include "system.h"
#include "closeout.h"
+#include "error.h"
#include "long-options.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -85,8 +86,11 @@ main (int argc, char **argv)
}
}
- if (argc - optind != 0)
- usage (EXIT_FAILURE);
+ if (optind < argc)
+ {
+ error (0, 0, _("too many arguments"));
+ usage (EXIT_FAILURE);
+ }
/* POSIX requires using getlogin (or equivalent code). */
cp = getlogin ();