Path: utzoo!utgpu!watmath!att!dptg!rutgers!tut.cis.ohio-state.edu!brutus.cs.uiuc.edu!apple!vsi1!wyse!bob From: bob@wyse.wyse.com (Bob McGowen Wyse Technology Training) Newsgroups: comp.lang.c Subject: Re: Contents of argv[0] Keywords: start-up code, argv specifications Message-ID: <2364@wyse.wyse.com> Date: 15 Aug 89 17:13:53 GMT References: <9002@attctc.Dallas.TX.US> <1681@crdgw1.crd.ge.com> Sender: news@wyse.wyse.com Reply-To: bob@wyse.UUCP (Bob McGowen Wyse Technology Training) Organization: Wyse Technology Lines: 27 In article <1681@crdgw1.crd.ge.com> davidsen@crdos1.UUCP (bill davidsen) writes: >In article <9002@attctc.Dallas.TX.US> jls@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 ---some deleted--- How about proposing a new function to be called basename(), obviously coded for the environment which the compiler was running under? It would return a pointer to a string which would be the name of the program. For example, in shell programming where root (with no current dir in the PATH) must run the script as {absolute|relative path}name, $0 will include the path used to invoke the script. I have started using the basename command to guarantee that the name I use in usage/error messages is just the name of the script. Bob McGowan (standard disclaimer, these are my own ...) Customer Education, Wyse Technology, San Jose, CA ..!uunet!wyse!bob bob@wyse.com