Subject: Re: proposal for new ps(1) option -H
To: None <tech-userlevel@netbsd.org>
From: Jan Kryl <loo@bazmek.net>
List: tech-userlevel
Date: 09/06/2007 23:19:12
On 06/09/07 11:16 -0700, Bill Stouder-Studenmund wrote:
> What I don't like about your suggestion is that what I think is the 
> underlying problem still isn't fixed. The underlying issue is that when 
> you add certain command options, such as -s, there's no way to suppress 
> options (columns) that they add. If such an option existed, you could add 
> the -s option, this option, then build your own parsing option using the 
> -o option.
That's not exactly what I wanted. I don't want a mechanism for suppression
of unwanted columns. I want an option, which prints all LWPs in process
independently of selected columns.

Let me demonstrate the problem. Let's say we want to print all lwps and we
are interested in PID,LID and COMMAND (the whole command line) and the terminal
width is 80 characters. Currently you would have to type something like this:

 $ ps axsww | awk '{ print $2" "$5" "$15; }'

If we had -H option, it would be:

 $ ps axHo pid,lid,command

Isn't it wonderfull? :)

> If we add 'H', then sure, we effectively have -s with the normal options.  
> But we still haven't fixed the issue that you can't make a totally custom 
> list of options.

Yes, you can. You can specify -H together with -o and have totally custom
list of columns (as in my previous example). If it is what you thought.

Actually, I think the -s option is pretty bad. There is no other option in
ps, which influences selection of processes and column configuration together.
And it is so for a good reason. The options should be orthogonal, if you know
what I mean. One group of options for process filtering (-a,-x,-p,...)  and 
the other group for specification of output columns (-o,-O,-u,-l,...).
Ideally the -s option should influence only column configuration and whether
the LWPs are printed or not, should be left to -H option. But it is perhaps
too late for such a change, since -s option has been around for some time
already ...

Cheers,
Jan