perror - (was Re: redirecting output)

Boyd Roberts boyd at necisa.ho.necisa.oz
Fri Jul 6 13:53:39 AEST 1990


In article <5XE49LB at xds13.ferranti.com> peter at ficc.ferranti.com (Peter da Silva) writes:
> But one thing:
>
>> 	if ((my_name = strrchr(argv[0], '/')) == NULLSTR || *++my_name == '\0')
>> 		my_name = argv[0];
>
>First, this is needlessly obscure. Second, it modifies argv[0], which is not
>ps-friendly on UNIX.
>

1: `my_name' is modified.  It _points_ into argv[0]!  argv[0] is _not_ modified!

2: `ps' on UNIX doesn't necessarily look at the user processes stack!

3: Sure, it's not ANSI, it's C!


Boyd Roberts			boyd at necisa.ho.necisa.oz.au

``When the going gets wierd, the weird turn pro...''



More information about the Comp.lang.c mailing list