Contents of argv[0]

Jerome Schneider jls at attctc.Dallas.TX.US
Tue Aug 15 13:38:08 AEST 1989


Both K&R and H&S document the argv[0] string as "the name of the program".
This definition doesn't seem to mandate (or exclude) the presence of a path
component in the string.  A few  *nix programs use rindex() or strrchr() to
scan for '/', implying (to me at least) that _some_ implementations consider
"name" to include such information.  The DOS Microsoft C (5.x) startup code
constructs the full path name for argv[0] (in upper case, no less!).  
 
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()?
 
-- 
Jerome Schneider              UUCP: killer.DALLAS.TX.US!jls (guest account)
Aspen Technology Group        Ft. Collins, CO    Voice: (303) 484-8466



More information about the Comp.lang.c mailing list