[Toybox] BSD style options for ps.

Rob Landley rob at landley.net
Mon Jan 21 10:54:28 PST 2019


I'm trying to add basic "ps ax" support to toybox because that's a hardwired
habit for me, and I've got the plumbing to do it and I've even started, but this
(from the ps man page) is kinda horrible:

       Note that "ps -aux" is distinct from "ps aux".  The POSIX and UNIX
       standards require that "ps -aux" print all processes owned by a user
       named "x", as well as printing all processes that would be selected by
       the -a option.  If the user named "x" does not exist, this ps may
       interpret the command as "ps aux" instead and print a warning.

I don't currently have a way to tell lib/args.c that -u shouldn't collect its
arguments when working in non-dash mode. I can change how I _interpret_ flags
based on whether you did "ps ax" or "ps -ax", but having long ago made this parse:

  tar cvCfz dirname file.tar.gz stuff...

While also getting this right:

  tar -cvCdir -ffile.tar.gz -z stuff...

Then the way lib/args.c works: "ps aux boing" will consume the "boing" as an
argument to the -u, and barf if it's not there...

Hey Ed: you're the BSD expert around here. What is the _desired_ behavior and
expected usage patterns? (Alas I can't really regression test against a thousand
old scripts doing weird things with ps, it's usually used more interactively...)

Rob



More information about the Toybox mailing list