[comp.unix.questions] Flags with more than one letter

harold@fmrco (Harold Naparst) (04/10/91)

How do you pass flags to main() with more than one letter?
I am using getopt, and it only allows flags with one letter.
Is there another option parsing program I should know 
about ?


-- 
Harold Naparst               |  (uunet!fmrco!harold) 
Fidelity Investments         |  (617)-570-2587
82 Devonshire St., #I40B     |  The opinions expressed herein are not those
Boston, MA  02109            |  of my employer.

jik@athena.mit.edu (Jonathan I. Kamens) (04/12/91)

In article <1991Apr10.132106.4122@fmrco>, harold@fmrco (Harold Naparst) writes:
|> How do you pass flags to main() with more than one letter?
|> I am using getopt, and it only allows flags with one letter.
|> Is there another option parsing program I should know 
|> about ?

  There is no other option parsing package in the standard Unix distribution. 
There is, however, the "parseargs" package which was posted recently to
comp.sources.misc.  If you don't know how to check comp.sources.misc and the
other Usenet source archives to find things like this, or you don't know how
to get sources from the archives, you can find out by reading the article
which you can retrieve using the instructions at the end of this message.

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710
-- 
        Subject: (DRAFT) Information about finding sources (READ THIS BEFORE POSTING)
        Newsgroups: comp.sources.wanted,alt.sources.wanted

        Available via anonymous ftp from pit-manager.mit.edu (18.72.1.58)
        in the file

        /pub/usenet/comp.sources.wanted/(DRAFT)_Information_about_finding_sources_(READ_THIS_BEFORE_POSTING)

        Available from mail-server@pit-manager.mit.edu by sending a message
        containing

        send usenet/comp.sources.wanted/(DRAFT)_Information_about_finding_sources_(READ_THIS_BEFORE_POSTING)

        Send a message containing "help" to get general information about the
        mail server.

art@pilikia.pegasus.com (Art Neilson) (04/13/91)

In article <1991Apr10.132106.4122@fmrco> harold@fmrco (Harold Naparst) writes:
>How do you pass flags to main() with more than one letter?
>I am using getopt, and it only allows flags with one letter.
>Is there another option parsing program I should know 
>about ?

The GNU version of getopt does what you want.  If you can't find it
or don't have access to an archive site, I'll mail it to you.  Send
me email requesting it.
-- 
Arthur W. Neilson III		| INET: art@pilikia.pegasus.com
Bank of Hawaii Tech Support	| UUCP: uunet!ucsd!nosc!pilikia!art

gwyn@smoke.brl.mil (Doug Gwyn) (04/16/91)

In article <1991Apr10.132106.4122@fmrco> harold@fmrco (Harold Naparst) writes:
>How do you pass flags to main() with more than one letter?
>I am using getopt, and it only allows flags with one letter.
>Is there another option parsing program I should know 
>about ?

There are three parts to the answer:
	(1) getopt() implements the official Command Syntax Standard,
	to which your applications should conform if at all feasible.
	(2) There have been more elaborate argument parsers posted to
	the net from time to time.
	(3) Any C program can examine its arguments directly; consult
	any decent C textbook for examples.