summaryrefslogtreecommitdiff
path: root/src/users.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/users.c')
-rw-r--r--src/users.c51
1 files changed, 24 insertions, 27 deletions
diff --git a/src/users.c b/src/users.c
index dba4701..d5c86f3 100644
--- a/src/users.c
+++ b/src/users.c
@@ -1,10 +1,10 @@
/* GNU's users.
- Copyright (C) 1992-2005 Free Software Foundation, Inc.
+ Copyright (C) 1992-2016 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ 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
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -12,8 +12,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by jla; revised by djm */
@@ -29,13 +28,12 @@
#include "quote.h"
#include "readutmp.h"
-/* The official name of this program (e.g., no `g' prefix). */
+/* The official name of this program (e.g., no 'g' prefix). */
#define PROGRAM_NAME "users"
-#define AUTHORS "Joseph Arceneaux", "David MacKenzie"
-
-/* The name this program was run with. */
-char *program_name;
+#define AUTHORS \
+ proper_name ("Joseph Arceneaux"), \
+ proper_name ("David MacKenzie")
static int
userid_compare (const void *v_a, const void *v_b)
@@ -55,14 +53,14 @@ list_entries_users (size_t n, const STRUCT_UTMP *this)
while (n--)
{
if (IS_USER_PROCESS (this))
- {
- char *trimmed_name;
+ {
+ char *trimmed_name;
- trimmed_name = extract_trimmed_name (this);
+ trimmed_name = extract_trimmed_name (this);
- u[n_entries] = trimmed_name;
- ++n_entries;
- }
+ u[n_entries] = trimmed_name;
+ ++n_entries;
+ }
this++;
}
@@ -90,7 +88,7 @@ users (const char *filename, int options)
STRUCT_UTMP *utmp_buf;
if (read_utmp (filename, &n_users, &utmp_buf, options) != 0)
- error (EXIT_FAILURE, errno, "%s", filename);
+ error (EXIT_FAILURE, errno, "%s", quotef (filename));
list_entries_users (n_users, utmp_buf);
@@ -101,20 +99,19 @@ void
usage (int status)
{
if (status != EXIT_SUCCESS)
- fprintf (stderr, _("Try `%s --help' for more information.\n"),
- program_name);
+ emit_try_help ();
else
{
- printf (_("Usage: %s [OPTION]... [ FILE ]\n"), program_name);
+ printf (_("Usage: %s [OPTION]... [FILE]\n"), program_name);
printf (_("\
Output who is currently logged in according to FILE.\n\
If FILE is not specified, use %s. %s as FILE is common.\n\
\n\
"),
- UTMP_FILE, WTMP_FILE);
+ UTMP_FILE, WTMP_FILE);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
- printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
+ emit_ancillary_info (PROGRAM_NAME);
}
exit (status);
}
@@ -123,15 +120,15 @@ int
main (int argc, char **argv)
{
initialize_main (&argc, &argv);
- program_name = argv[0];
+ set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
atexit (close_stdout);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- usage, AUTHORS, (char const *) NULL);
+ parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
+ usage, AUTHORS, (char const *) NULL);
if (getopt_long (argc, argv, "", NULL, NULL) != -1)
usage (EXIT_FAILURE);
@@ -150,5 +147,5 @@ main (int argc, char **argv)
usage (EXIT_FAILURE);
}
- exit (EXIT_SUCCESS);
+ return EXIT_SUCCESS;
}