mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-23 17:34:00 +03:00
journalctl: allow both "-n 55" and "-n55" on the command line, as equivalent syntaxes
https://bugs.freedesktop.org/show_bug.cgi?id=60596
This commit is contained in:
parent
8b55b8c4e7
commit
96088db02b
@ -244,8 +244,25 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
log_error("Failed to parse lines '%s'", optarg);
|
||||
return -EINVAL;
|
||||
}
|
||||
} else
|
||||
arg_lines = 10;
|
||||
} else {
|
||||
int n;
|
||||
|
||||
/* Hmm, no argument? Maybe the next
|
||||
* word on the command line is
|
||||
* supposed to be the argument? Let's
|
||||
* see if there is one, and is
|
||||
* parsable as a positive
|
||||
* integer... */
|
||||
|
||||
if (optind < argc &&
|
||||
safe_atoi(argv[optind], &n) >= 0 &&
|
||||
n >= 0) {
|
||||
|
||||
arg_lines = n;
|
||||
optind++;
|
||||
} else
|
||||
arg_lines = 10;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user