Subject: Re: sysv ps(1) implementation [was: ps(1) sysv silliness]
To: Simon Burge <>
From: Andrew Brown <>
List: tech-userlevel
Date: 06/10/2000 16:58:55
>> 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...

seems to me that it doesn't need to be so.  you ought to be able to
have one big getopt loop that handled all switched (unless there are
options that require args in one that conflict with non-argument
switches in the other (hmm...'u' comes to mind).

   while (ch = getopt(argc, argv, "...reallylonglist...")) {
   switch (ch) {
   case 'B': behavior=BSD; break;
   case 'V': behavior=SYSV (or whatever); break;
   if (behavior==SYSV) {
	   complain about various non-sysv options...
   else {
	   complain about various non-bsd options...
   do stuff

and i'm sure something could be worked out so that 'u' got handled
properly...perhaps by 

   char *foov[],*uarg=NULL;
   int fooc;
   while (fooc) {
	   while (getopt(...)) {
	   switch (ch) {
	   case 'u': opt_u=1; uarg=optarg; break;
	   if (bsd and uarg) {
   do complaint checking

ps - can someone please explain to me why (a) /usr/ucb/ps under
solaris seems to run much more slowly (takes longer to run) and (b)
why "/usr/bin/ps -ef" prints the command line while "/usr/ucb/ps
auxww" prints the setproctitle() stuff?

|-----< "CODE WARRIOR" >-----|             * "ah!  i see you have the internet (Andrew Brown)                that goes *ping*!"       * "information is power -- share the wealth."