Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1a 12/4/83; site rlgvax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!eagle!harpo!seismo!rlgvax!guy From: guy@rlgvax.UUCP (Guy Harris) Newsgroups: net.cog-eng,net.unix-wizards,net.unix Subject: Re: standards, tools, history: options=? (-foo vs. foo=yes) Message-ID: <1825@rlgvax.UUCP> Date: Sat, 24-Mar-84 19:22:38 EST Article-I.D.: rlgvax.1825 Posted: Sat Mar 24 19:22:38 1984 Date-Received: Sun, 25-Mar-84 13:36:21 EST References: <46@circe.UUCP> Organization: CCI Office Systems Group, Reston, VA Lines: 40 > Getopt, the parser referred to by several people was a first attempt at > this, but it was never released. Gee, our System III and System V manuals have pages GETOPT(3C) which describes that resembles the proposed AT&T standard an *awful* lot, and they also have a manual page GETOPT(1) for a command which lets shell files use this - hey, we even got the *source* to them on our S3 and S5 distributions! In other words, a parser that implements 90% of the standard is available to anyone with a license for S3 or any later release - it's on your tape. It implements the following rules of the standard: - rule 3 (one-letter option names, which is a historical crock - note "f77"'s "onetrip" option (which is in itself a historical crock forced on us by implementors of pre-F77 Fortran compilers, but we won't get into that)) - rule 4 (options must be delimited by "-") - rule 5 (options with no arguments may be grouped behind one delimiter - this is the history that forces rule 3) - rule 7 (option arguments cannot be optional) - rule 8, partially (groups of option-arguments following an option must be separated by commas or separated by white space and quoted) - rule 9 (all options precede operands on the command line) - rule 10 ("--" may be used to delimit the end of the options) Rule 6 (the first option-argument following an option must be preceded by white space) is not supported by "getopt"; it permits "foo -ofrobozz" or "foo -o frobozz". It supports Rule 8 to the extent that the option-argument must be recognized by the shell's lexical analyzer as one token. All other rules are supported by the code that uses "getopt". Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy