Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!ames!uhccux!virtue!comp.vuw.ac.nz!munnari.oz.au!bunyip!metro!cluster!necisa!boyd From: boyd@necisa.ho.necisa.oz (Boyd Roberts) Newsgroups: comp.lang.c Subject: Re: perror - (was Re: redirecting output) Message-ID: <1795@necisa.ho.necisa.oz> Date: 6 Jul 90 03:53:39 GMT References: <22931@dartvax.Dartmouth.EDU> <1990Jun29.172429.2818@zoo.toronto.edu> <1792@necisa.ho.necisa.oz> <5XE49LB@xds13.ferranti.com> Organization: NEC Information Systems Australia Pty. Ltd. Lines: 20 In article <5XE49LB@xds13.ferranti.com> peter@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@necisa.ho.necisa.oz.au ``When the going gets wierd, the weird turn pro...''