Contents of argv[0]

Guido van Rossum guido at piring.cwi.nl
Thu Aug 17 23:07:49 AEST 1989


chris at mimsy.UUCP (Chris Torek) writes:

>In article <10743 at smoke.BRL.MIL> gwyn at 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 at cwi.nl or mcvax!guido or guido%cwi.nl at uunet.uu.net
"Repo man has all night, every night."



More information about the Comp.lang.c mailing list