Path: utzoo!attcan!uunet!unisoft!bdt!david From: david@bdt.UUCP (David Beckemeyer) Newsgroups: comp.sys.atari.st Subject: Re: argv[0] and Sozobon C Summary: argv[0] MT C-Shell, MWC, and the ST Message-ID: <529@bdt.UUCP> Date: 15 Mar 89 20:02:06 GMT References: <737@stag.UUCP> Reply-To: david@bdt.UUCP (David Beckemeyer) Organization: Beckemeyer Development Tools, Oakland, CA Lines: 60 I've seen enough un-truths about this subject already so here is the story behind argv[0] and MT C-Shell. First the history that got us here: Way back in 1986 I developed and released the first version of MT C-Shell V1.0. This was before MWC, back when the only C compilers were the DRI/Alcyon package from Atari and Megamax. neither of these implemented argv[0] handling at the time (they just full it it with some static string). MT C-Shell needed more than the 128 bytes that Pexec gives you for arguments, so I invented a method for passing a larger number of arguments, using the enviroment space. This was the first method of extended arguement passing and argv[0] handling. Along comes Mark Williams Co. and MWC. They implement another (incompatible) method for passing argv[0] and extended arguments also using the enviroment space. Since they're bigger than I am (and because they're way was probably better than mine anyway) I adopt MT C-Shell and all my utilities to be compatible with this newly established argument passing method. At this time Mark Williams Co., myself, and representatives from Manx and Megamax approach Atari with the idea of defining a "standard" method for extended arguments. Since Atari basically said "we don't care what you do," we simply agreed that the MWC method would be the de-facto "standard". MT C-Shell Versions 1.10 and above and Micro C-Shell Versions 2.70 and above use this MWC "standard" method of argv[0] and extendend argument passing. The "conversion" programs that are often talked about only apply to *very* old versions of MT C-Shell and Micro C-Shell (prior to V1.10 MT and V2.70 Micro C-Shell, or about Fall 1986). Probably nobody needs these conversion programs anymore; they cloud the issue. After all this, many new compilers and libraries have arisen for the ST. It seems that along with them came some more techniques for argument passing. MT C-Shell does not support any methods other than that adopted in 1986 (the MWC format). I do *not* have plans to implement other methods of argument passing, unless one is *finally* adopted as the "official" standard. The method used by MT C-Shell and MWC starts with an environment variable ARGV, whose value is a "iovector" describing the standard handles. After this the arguments are appended (each null terminated) starting with argv[0]. The list of arguments is terminated with a empty string (a double null), which marks the end of the enviromnent. The basepage "tail" is also filled with the first 127 bytes of the arguments in standard TOS Pexec format, without argv[0]. The ARGV variable is placed after the "real" environment variables and is always followed by the command arguments. I do not know if Sozobon C is compatible with this method or not. -- David Beckemeyer (david@bdt.UUCP) | "Lester Moore - Four slugs from a .44 Beckemeyer Development Tools | no Les, no more." 478 Santa Clara Ave. Oakland, CA 94610 | - Headstone at Boot Hill UUCP: {uunet,ucbvax}!unisoft!bdt!david | Tombstone, AZ