Subject: sysv ps(1) implementation [was: ps(1) sysv silliness]
To: None <tech-userlevel@netbsd.org>
From: Simon Burge <simonb@netbsd.org>
List: tech-userlevel
Date: 06/09/2000 00:24:45
Jarom?r Dole?ek wrote:
> I think such feature would be useful.
It seems that way. I've been quite surprised by the support this
this, and not even a private flame either!
> I think that following
> should be done
I'll respond to these in reverse order.
> 3) if ps not run as ps-sysv nor the flag is given, ps should
> process it's arguments and if it finds a svrish one (such
> as -f), switch to SysV-style and restart the argument parsing
> process - this should be pretty streightforward and easy
> implement, and should DTRT in most cases
At the moment, I have (broken up a little so the letters line up):
GETOPTSTR "a cC e g hjKlLM:mN: O:o:p: r STt:U:u vW:w x"
SYSVGETOPTSTR "aA defg:G: j lL n: o:p:P s t:U:u: y"
so the presence of -'AdfGnP' would automatically switch to SysV mode.
> 2) a flag should be added to force either behaviour
ITOH Yasufumi suggested -B to force BSD mode and -A to force AT&T (or
SysV) mode - it's a pity that BSD already pinched -S. Since -B isn't
used anywhere and -A is only used on SysV mode this will be easy.
> 1) when ps is run as ps-sysv, it should use the SysV-style
> arguments
I would really like for people to be able to do something like
'alias ps ps-sysv' so that they can just type "ps -<sysv opts>"
and the right thing happens - just looking for ps-sysv in __progname
wont work in this situation. I'm already convinced that checking
an environment variable is not the right thing either for reasons
that ITOH pointed out. Maybe this is best done by a script called
/usr/bin/ps-sysv:
#!/bin/sh
exec ps -A "$@"
Any better suggestions?
Simon.