diff options
author | Elliott Hughes <enh@google.com> | 2016-09-28 11:00:30 -0700 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2016-09-29 13:41:35 -0500 |
commit | 703c49e0cb9718b4bfad9fcee45329c972aab12e (patch) | |
tree | c0857571b5a5acf1a6b78f0b111a4d8cf5cf686a /toys | |
parent | 2b66afffb8b51a4e68b508be1858dcde7706142e (diff) | |
download | toybox-703c49e0cb9718b4bfad9fcee45329c972aab12e.tar.gz |
Accept extra ps arguments as additional pids.
POSIX says nothing, but traditional ps lets you say "ps 123" in addition
to "ps -p 123". (You can mix and match too: "ps -p 123,124 666 667" works
fine.)
Bug: 31778761
Diffstat (limited to 'toys')
-rw-r--r-- | toys/posix/ps.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/toys/posix/ps.c b/toys/posix/ps.c index bb6bcbad..011a43e3 100644 --- a/toys/posix/ps.c +++ b/toys/posix/ps.c @@ -1151,6 +1151,7 @@ static void shared_main(void) void ps_main(void) { + char **arg; struct dirtree *dt; char *not_o; int i; @@ -1170,6 +1171,10 @@ void ps_main(void) comma_args(TT.ps.k, &TT.kfields, "bad -k", parse_ko); dlist_terminate(TT.kfields); + // It's undocumented, but traditionally extra arguments are extra -p args + for (arg = toys.optargs; *arg; arg++) + if (parse_rest(&TT.pp, *arg, strlen(*arg))) error_exit_raw(*arg); + // Figure out which fields to display not_o = "%sTTY,TIME,CMD"; if (toys.optflags&FLAG_f) |