procstat: Fix regression after 365880.
Basically it reverts one chunk that reversed the parsing logic, making legacy variants of invocation, like `procstat -a -f', non-operational. Reported and tested by: Dewayne Geraghty <dewayne@heuristicsystems.com.au> Sponsored by: The FreeBSD Foundation MFC after: 3 days
This commit is contained in:
parent
5f0601fd19
commit
34d7dd1561
@ -425,9 +425,7 @@ main(int argc, char *argv[])
|
|||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
if (cmd == NULL && argv[0] != NULL)
|
if (cmd == NULL && argv[0] != NULL && (cmd = getcmd(argv[0])) != NULL) {
|
||||||
cmd = getcmd(argv[0]);
|
|
||||||
if (cmd != NULL) {
|
|
||||||
if ((procstat_opts & PS_SUBCOMMAND_OPTS) != 0)
|
if ((procstat_opts & PS_SUBCOMMAND_OPTS) != 0)
|
||||||
usage(cmd);
|
usage(cmd);
|
||||||
if (cmd->opt != NULL) {
|
if (cmd->opt != NULL) {
|
||||||
@ -443,12 +441,13 @@ main(int argc, char *argv[])
|
|||||||
argv += 1;
|
argv += 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cmd = getcmd("basic");
|
if (cmd == NULL)
|
||||||
|
cmd = getcmd("basic");
|
||||||
|
if (cmd->cmd != procstat_files &&
|
||||||
|
(procstat_opts & PS_OPT_CAPABILITIES) != 0 &&
|
||||||
|
(cmd->cmp & PS_MODE_COMPAT) == 0)
|
||||||
|
usage(cmd);
|
||||||
}
|
}
|
||||||
if (cmd->cmd != procstat_files &&
|
|
||||||
(procstat_opts & PS_OPT_CAPABILITIES) != 0 &&
|
|
||||||
(cmd->cmp & PS_MODE_COMPAT) == 0)
|
|
||||||
usage(cmd);
|
|
||||||
|
|
||||||
/* Must specify either the -a flag or a list of pids. */
|
/* Must specify either the -a flag or a list of pids. */
|
||||||
if (!(aflag == 1 && argc == 0) && !(aflag == 0 && argc > 0))
|
if (!(aflag == 1 && argc == 0) && !(aflag == 0 && argc > 0))
|
||||||
|
Loading…
Reference in New Issue
Block a user