Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!brutus.cs.uiuc.edu!wuarchive!texbell!sugar!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.lang.c Subject: Re: Contents of argv[0] Keywords: start-up code, argv specifications Message-ID: <5722@ficc.uu.net> Date: 16 Aug 89 17:47:17 GMT References: <9002@attctc.Dallas.TX.US> <1681@crdgw1.crd.ge.com> <1705@crdgw1.crd.ge.com> Organization: Xenix Support, FICC Lines: 51 You don't want basename(). You want something like: parse_file(name, buffer) char *name; struct filename *buffer; Parses the elements of name into the buffer. name will be modified as necessary to null-terminate the elements of buffer. Returns the actual number of elements found in the name... missing or meaningless elements will contain null pointers. int build_file(buffer, filename); char *buffer; struct filename *filename; Converts the filename into a character string acceptable to the host operating system. Missing elements will be defaulted or ignored. Meaningless elements will be ignored. Returns the length of the resulting name. With: struct filename { char *machine; char *volume; char *project; char *user; char *path[MAXPATH]; char *filename; char *extension; char *version; }; On UNIX this would extract path and filename. On MS-DOS this would extract the volume, path, filename, and extension. On RSX this would extract the volume, project, user, filename, and extension. And so on... There should also be an additional function: struct filename *file_defaults(); Which just returns a filename containing the default values for the current host, current directory, and so on, with nulls in meaningless elements. Any elements I'm missing? -- Peter da Silva, Xenix Support, Ferranti International Controls Corporation. Business: peter@ficc.uu.net, +1 713 274 5180. | "The sentence I am now Personal: peter@sugar.hackercorp.com. `-_-' | writing is the sentence Quote: Have you hugged your wolf today? 'U` | you are now reading"