Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!ukma!uflorida!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Contents of argv[0] Keywords: start-up code, argv specifications Message-ID: <10743@smoke.BRL.MIL> Date: 16 Aug 89 03:56:16 GMT References: <9002@attctc.Dallas.TX.US> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 20 In article <9002@attctc.Dallas.TX.US> jls@attctc.Dallas.TX.US (Jerome Schneider) writes: >Are there any (proposed) standards for argv[0] syntax? IEEE 1003.2 may have something to say about it, but the only portable-C specification is that IF argc is greater than 0 AND IF argv[0][0] is not the null character THEN argv[0] represents the "program name". As you see, a program name need not even be supplied by the implementation. >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()? I don't think a "_portable_" application should use rindex() at all, nor should it assume that tolower() (not to_lower()) is a meaningful thing to do on environment-supplied text. If you're going to display argv[0] (which is about the only meaningful thing you can do with it), why not just print the whole thing. If you really need to keep the name short and happen to KNOW how to parse pathnames into components, then of course you could do that and print the result. The function used to do that is traditionally named simple().