Contents of argv[0]

ody davidsen at sungod.crd.ge.com
Tue Aug 15 23:59:01 AEST 1989


In article <9002 at attctc.Dallas.TX.US> jls at attctc.Dallas.TX.US (Jerome Schneider) writes:

| Are there any (proposed) standards for argv[0] syntax?  If not, should a
| _portable_ application always rindex() argv[0] for a path delimiter before
| optionally (under DOS and OS half) converting the name to_lower()?

  If the program is portable you would have no way to know what the
path delimiter is... since the set includes "/" for UNIX, "\" for
MS-DOS, ":[]" for VMS, ":<>" for TOPS, etc. Since some systems allow
ugly things like "$#_%" in filenames, you are better off not trying to
identify all the possibilities.

  You could put in some conditional code to do things for common
operating systems if you wanted to display the last level of the name,
and if you were being portable you would use strrchr (I don't see rindex
in the ANSI standard, at least in the index or 4.11).
	bill davidsen		(davidsen at crdos1.crd.GE.COM)
  {uunet | philabs}!crdgw1!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.lang.c mailing list