Kyle McDonald <[EMAIL PROTECTED]> wrote:
> >>> The simple plan is this:
> >>>
> >>> - if called with an argument which does not start with "-",
> >>> be /usr/ucb/ps
> >>> - if called with an argument starting with "-" behave like ucb ps
> >>> or bin/ps depending on how the program was invoked
> >>>
> >> The first is right; the second I'm not so sure. How I've had this for the
> >> last decade (and is similar to the way that some other ps implementations
> >> seemed to behave) is that if there's an argument starting with "-", be
> >> /usr/bin/ps.
> >>
> >
> > I would say: if the first arg start with "-", be /usr/bin/ps, else be
> > /usr/ucb/ps
> >
> >
> If invoked as /usr/bin/ps, or found through PATH=/usr/bin:....
> Then yes. definitely.
Well, if /usr/ucb/ps is kept, it may be nice to allow "options" to start with
'-' if explicitly called as /usr/ucb/ps.
> But since /usr/ucb/ps currently takes 'aux' or '-aux' (for example) then
> if invoked as /usr/ucb/ps, or found through PATH=/usr/ucb:..., then I
> think it's correct to continue the /usr/ucb behavior.
invoked as /usr/ucb/ps is a too weak condition for 100% compatibility.
The only way I see is to use getexecname() to find whether the user is
interested in BSD behavior.
As the standard ps does not allow "options" without '-', it makes sense to
use:
if (strcmp(getexecname(), "/usr/ucb/ps") == 0 ||
(argc > 1 && argv[1][0] != '-'))
do_BSD = TRUE;
Jörg
--
EMail:[EMAIL PROTECTED] (home) Jörg Schilling D-13353 Berlin
[EMAIL PROTECTED] (uni)
[EMAIL PROTECTED] (work) Blog: http://schily.blogspot.com/
URL: http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code