Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!smile!alanf From: alanf%smile@Sun.COM (Alan Fargusson @ peace with the world) Newsgroups: comp.lang.c Subject: Re: Using getopt to parse multi-argument options Summary: -x xmin,xmax Message-ID: <85732@sun.uucp> Date: 17 Jan 89 21:57:44 GMT References: <3652@phri.UUCP> <1989Jan16.023712.29002@utzoo.uucp> Sender: news@sun.uucp Lines: 18 In article <1989Jan16.023712.29002@utzoo.uucp>, henry@utzoo.uucp (Henry Spencer) writes: > In article <3652@phri.UUCP> roy@phri.UUCP (Roy Smith) writes: > > I'm writing a program which will take an optional range, in the > >style of graph(1)'s "-x xmin xmax". How do I tell getopt to parse > >something like that? ... > > You can't. The only getopt-compatible way is to require the user to > say "-x 'xmin xmax'" instead, and have your code pull the single argument > apart. This is what the AT&T syntax standard mandates (with the further > flourish that tabs and commas must work as separators, not just spaces, > as I recall). > I think the best way to do this would be to have the user type "-x xmin,xmax", and parse the 'xmin,xmax' yourself. This is what some AT&T software does. - - - - - - - - - - - - - - - - - - - - - Alan Fargusson Sun Microsystems alanf@sun.com ..!sun!alanf