Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!henry.jpl.nasa.gov!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: getopt Message-ID: <6587@jpl-devvax.JPL.NASA.GOV> Date: 12 Dec 89 23:38:46 GMT References: <6584@jpl-devvax.JPL.NASA.GOV> <4644@itivax.iti.org> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 33 In article <4644@itivax.iti.org> scs@itivax.iti.org (Steve Simmons) writes: : There do exist a number of switches which take optional trailing : arguements with a default assumed when the trailer isn't there. The : getopt() function distributed by AT&T handles this correctly, with : optarg (I think that's the name) being NULL. Way back when AT&T was : suggesting a standard for switch parsing, this was allowed. : : A real-world example: : : cc -O : : means optimse the program to level 2, while : : cc -O3 : : means use level 3. Way back when AT&T was suggesting a standard for switch parsing, cc -O3 would mean the same as two separate switches: cc -O -3 They were requiring space between a switch and any option so that they could do switch bundling. Someplace here I've got the brochure they were handing out at Usenix at the time. Just to put this into perspective, I never use getopt, either in C or in perl. I suppose this could be construed as a character flaw. Larry