Commit 51bd7bfc authored by Craig Small's avatar Craig Small
Browse files

ps: Fix table option handling and -ad

This was to fix an issue with "ps -ad".

Not sure why, but options such as -a -d a x g are called table options.

Their parsing and handling was... an interesting read.

Essentially a bitmask was jammed together depending on the options and
then for each process you had a shifted point which matched (or not) a
various details of a process to be displayed.

It took *many* readings of that code to understand what its doing and
there isn't much efficiency about it; you have to evaluate the process
details first, before matching. I'm stil not 100% sure I have covered
all scenarios; it's that opaque.

Instead of some bitwise madness, I have used (hopefully) sensibly named
boolean variables and evaluated them before matching process details,
so if you don't care about the tty, don't look at it with early return
(e.g. if you want to match euid and tty, and euid match fails, don't bother
to check tty).

I'm still not 100% happy with the select setup but the function chooses
t...
parent fcc12efb
Loading
Loading
Loading
Loading