Path: utzoo!attcan!uunet!lll-winken!sun-barr!newstop!texsun!texbell!sugar!ficc!peter From: peter@ficc.ferranti.com (Peter da Silva) Newsgroups: comp.lang.c Subject: Re: perror - (was Re: redirecting output) Message-ID: <5XE49LB@xds13.ferranti.com> Date: 3 Jul 90 15:32:13 GMT References: <22931@dartvax.Dartmouth.EDU> <1990Jun29.172429.2818@zoo.toronto.edu> <1792@necisa.ho.necisa.oz> Reply-To: peter@ficc.ferranti.com (Peter da Silva) Organization: Xenix Support, FICC Lines: 22 In article <1792@necisa.ho.necisa.oz> boyd@necisa.ho.necisa.oz (Boyd Roberts) writes: > perror(3) is good, but this is better: [ lots of code deleted ] Yep, that's probably better than perror by itself. You should probably call "sysmess" "strerror" and wrap it in a "#ifndef __STDC__" (or a macro derived from __STDC__), but that's a nitpick supreme. 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. How about: my_name = strrchr(argv[0], '/'); if(my_name) my_name++; else my_name = argv[0]; -- Peter da Silva. `-_-' +1 713 274 5180.