Subject: Re: sysv ps(1) implementation [was: ps(1) sysv silliness]
To: Klaus Klein <kleink@uni-trier.de>
From: Simon Burge <simonb@netbsd.org>
List: tech-userlevel
Date: 06/10/2000 15:30:28
Klaus Klein wrote:

> While it's always nice to see a discussion about this, let me toss in
> a piece of information:
> 
> IEEE Std. 1003-200x (the next revision of POSIX) ...

Is 1003-200x available for browsing anywhere?

> ... will have a System V
> influenced ps command in its XSI open group, so it'll make sense to
> consider the implications for a moment. With the acceptance of that
> standard in the forseeable future it might make sense to make an
> implementation of this the 'default' utility, moving the existing
> version into a non-default path; something like a /usr/ucb/ comes to
> mind...  It's also worth noting that the echo utility will need a
> similar treatment.

Overall from the discussion so far, it seems that it's pretty much
necessary to have two separate programs.

From a space-saving POV, if one of them is dynamically loaded we won't
be adding that much space - a stripped dynamic ps(1) is around 40kB on
alpha and 30kB on i386.  However, I'd still like to entertain the idea
of just having one static binary in /bin with a switch to choose which
style to use, and the other program being a small shell script.

As noted, I gaffed before by saying that we could use -A to select SysV
behaviour; obviously any letter that is used for any purpose won't do.
The set of unused letters is "bBDEFHiIJkqQRXYzZ" - perhaps -B for BSD
and -X for XSI?  This way, either /usr/xpg4/ps is "exec /bin/ps -X $*"
or /usr/ucb/ps is "exec /bin/ps -B $*". For code simplicity, we could
state that if -B or -X appears it must be the first option...

> About supporting both BSD and System V style options in a single
> executable: please take into consideration that there are at least
> three command line options (-e, -p, -u) whose use differs between
> 'our' BSD implementation and System V.

The options are currently handled by two different getopt loops, so this
isn't a problem.  FWIW, "aegjloptuU" appear in both...

Simon.