+2011-07-23 Nicolas François <nicolas.francois@centraliens.net>
+
+ * src/faillog.c: Add annotations to indicate that usage() does not
+ return.
+ * src/faillog.c: Fix message: this is faillog, not lastlog.
+ * src/faillog.c: Check that there are no extra arguments after
+ parsing the options.
+
2011-07-23 Nicolas François <nicolas.francois@centraliens.net>
* src/chgpasswd.c: Add annotations to indicate that usage() does
* Copyright (c) 1989 - 1993, Julianne Frances Haugh
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
* Copyright (c) 2002 - 2006, Tomasz Kłoczko
- * Copyright (c) 2007 - 2010, Nicolas François
+ * Copyright (c) 2007 - 2011, Nicolas François
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "exitcodes.h"
/* local function prototypes */
-static void usage (int status);
+static /*@noreturn@*/void usage (int status);
static void print_one (/*@null@*/const struct passwd *pw, bool force);
static void set_locktime (long locktime);
static bool set_locktime_one (uid_t uid, long locktime);
#define NOW (time((time_t *) 0))
-static void usage (int status)
+static /*@noreturn@*/void usage (int status)
{
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
(void) fprintf (usageout,
break;
case 'h':
usage (E_SUCCESS);
- break;
+ /*@notreached@*/break;
case 'l':
if (getlong (optarg, &fail_locktime) == 0) {
fprintf (stderr,
&umin, &has_umin,
&umax, &has_umax) == 0) {
fprintf (stderr,
- _("lastlog: Unknown user or range: %s\n"),
+ _("faillog: Unknown user or range: %s\n"),
optarg);
exit (E_BAD_ARG);
}
usage (E_USAGE);
}
}
+ if (argc > optind) {
+ fprintf (stderr,
+ _("faillog: unexpected argument: %s\n"),
+ argv[optind]);
+ usage (EXIT_FAILURE);
+ }
}
if (tflg && (lflg || mflg || rflg)) {