Subject: Re: sysv ps(1) implementation [was: ps(1) sysv silliness]
To: Simon Burge <simonb@NetBSD.ORG>
From: Andrew Brown <atatat@atatdot.net>
List: tech-userlevel
Date: 06/11/2000 15:22:48
>>    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
>
>It's not really that simple.  For example, the common options "egjluU"
>are handled differently and "aopt" are the same.  You'd also need to
>remember which options had been specifid to do the "complain about..."
>bit.  Plus I've already done it with the separate getopts :-)

e is a binary switch both ways.  so are j and l.  U takes an argument
both ways.  g doesn't seem to be a netbsd switch.  a, o, p, and t are
handled the same way, so that's great.

my point was that you can have opt_j, opt_l, opt_U, arg_U, opt_g,
opt_a, etc, and use the options in both modes.

as to the complaints section...

	if (behavior==BSD && (opt_f || opt_g || ...))
		errx("bsd behavior invalid");

no?

of course...if you've already done it the other way...don't you have
to prescan the options for the -[BV] switch?  do you insist that it be
the first one?  what if i wanted to do "ps -uaxww"?

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
andrew@crossbar.com       * "information is power -- share the wealth."