summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/last/last.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c
index 221f6db..07844a6 100644
--- a/usr.bin/last/last.c
+++ b/usr.bin/last/last.c
@@ -138,11 +138,10 @@ main(int argc, char *argv[])
* a number after a dash.
*/
if (maxrec == -1) {
- p = argv[optind - 1];
- if (p[0] == '-' && p[1] == ch && !p[2])
- maxrec = atol(++p);
- else
- maxrec = atol(argv[optind] + 1);
+ p = strchr(argv[optind - 1], ch);
+ if (p == NULL)
+ p = strchr(argv[optind], ch);
+ maxrec = atol(p);
if (!maxrec)
exit(0);
}
OpenPOWER on IntegriCloud