Path: utzoo!utgpu!watmath!att!bellcore!texbell!wuarchive!wugate!uunet!mcvax!piring.cwi.nl!guido From: guido@piring.cwi.nl (Guido van Rossum) Newsgroups: comp.lang.c Subject: Re: Contents of argv[0] Keywords: start-up code, argv specifications Message-ID: <8337@boring.cwi.nl> Date: 17 Aug 89 13:07:49 GMT References: <9002@attctc.Dallas.TX.US> <10743@smoke.BRL.MIL> <19112@mimsy.UUCP> Sender: news@cwi.nl Lines: 22 chris@mimsy.UUCP (Chris Torek) writes: >In article <10743@smoke.BRL.MIL> gwyn@smoke.BRL.MIL (Doug Gwyn) writes: >same answer: print the whole thing. The only bad effect is that >occasionally someone will see more detail than needed. Well, there's esthetics... I don't really like usage messages like this: usage: /tmp_mnt/ober/ufs1/amoeba/guido/bin/dpv [-d] [-f funnytab] [+page] ditroff-output-file Which is why I strip initial path components if I find them. (The C code I use happens to use a default if there is no argv[0], it is a null pointer or an empty string, or ends in a slash, which is probably not a big loss. My shell scripts use `basename $0`.) I also seem to remember that some shells (csh?) prefix argv[0] with the directory in $PATH where the command was found, and some don't. -- Guido van Rossum, Centre for Mathematics and Computer Science (CWI), Amsterdam guido@cwi.nl or mcvax!guido or guido%cwi.nl@uunet.uu.net "Repo man has all night, every night."