Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!crdgw1!sungod!davidsen From: davidsen@sungod.crd.ge.com (ody) Newsgroups: comp.lang.c Subject: Re: Contents of argv[0] Keywords: start-up code, argv specifications Message-ID: <1681@crdgw1.crd.ge.com> Date: 15 Aug 89 13:59:01 GMT References: <9002@attctc.Dallas.TX.US> Sender: news@crdgw1.crd.ge.com Reply-To: davidsen@crdos1.UUCP (bill davidsen) Organization: General Electric Corp. R&D, Schenectady, NY Lines: 19 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 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@crdos1.crd.GE.COM) {uunet | philabs}!crdgw1!crdos1!davidsen "Stupidity, like virtue, is its own reward" -me