Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!dogie!uwvax!per2!dag From: dag@per2.UUCP (Daniel A. Glasser) Newsgroups: comp.sys.atari.st Subject: ARGV definition (MWC) Keywords: Extended Arguments MWC ARGV Pexec Message-ID: <845@per2.UUCP> Date: 12 Apr 89 19:49:46 GMT Reply-To: rec@mwc.uucp (Roger Critchlow @ Mark Williams Company) Organization: On behalf of Mark Williams Company Lines: 60 This is posted for a friend who works at Mark Williams Company and does not have direct access to news. Please E-mail replies to rec@mwc.uucp. -------------------------------------------------------- Subject: ARGV definition For those who don't have MWC documentation, or do but don't RTFM, here is the definition of the MWC argument passing convention. I'm quoting from the 1986 manual, but the text, and the convention, hasn't changed in substance. This is the from the article for 'crts0.o' which I found by following the cross-references from 'argv'. "The runtime startup module, crts0.o, is the first code executed when "your program is run. As its first action, it parses the environment "string list passed by TOS into a vector of string pointers. This "vector is saved in the variable external char **environ, for the use "of the library routine getenv(), and passed as the parameter char ** "envp[], for the information of the function main(). " "If the environment vector contains a parameter named ARGV, then the "run time start-up assumes that the program was executed by msh (or "by some other program that agrees that programs should have arguments), "and that the remainder of the environment vector is an argument vector "that should be passed as the parameter char *argv[] to the function "main(). " "If the argument ARGV has a value, such as ARGV=CCAP??, then the "value should consist of characters from the set [CAPF?]. The char- "acters describe the origin of the system file handles as Console, "Auxiliary port, Printer port, File, or unknown. The runtime startup "stores the value of ARGV, if it exists, into the external variable "char *_iovector for the use of the routines that emulate the "functions of the COHERENT operating system. " "If no ARGV parameter is found in the environment, then the run time "start-up program assumes that the program was executed by a simple "GEMDOS Pexec(). The buffer cmdtail is parsed to form the argument "vector for main(). ARGV[0] is supplied by the external variable "char _cmdname[], which should be supplied by your program, or it "will be set to ? by the library. The value of the variable _iovector "will be set to the default CCAP?????????????????????????;. The only change which I can detect in the latest revision of the manual is that the crack about '(or by some other program which agrees that programs should have arguments)' has been toned down. I've always been a little caustic on this subject, :-). The only change in the implementation not yet noted in the article is that the default value of argv[0] is now the empty string in accordance with the draft proposed ANS c language. Quoted material is Copyright (c) 1986 by Mark Williams Company. -- rec -- -------- End of forwarded posting ---------- -- _____________________________________________________________________________ Daniel A. Glasser One of those things that goes uwvax!per2!dag "BUMP!!!(ouch)" in the night. ---Persoft, Inc.---------465 Science Drive-------Madison, WI 53711-----------