From: Brandon S. Allbery (bsa@kf8nh.wariat.org)
Date: 08/04/93


From: bsa@kf8nh.wariat.org (Brandon S. Allbery)
Subject: Re: getopt() - Anyone ?
Date: Wed, 4 Aug 1993 22:25:31 GMT

In article <1993Jul30.134026.20924@tcpg02.ny.jpmorgan.com> cae@cae.ny.jpmorgan.com (Caleb Epstein) writes:
>gordon@tradent.wimsey.com (Gordon Soukoreff) wrote:
> Yup. getopt() is definitely in libc. I believe getopt_long()
>is as well. I'm not in the same borough as my Linux box right now so
>I can't check for sure. What is optopt()? I've never heard of it.

optopt is a global variable, not a function.

AT&T's "freed" getopt() implementation defines several global variables.
optarg[] and optind are documented and well known. The others are:

* optopt: the current option character (same as the return value)
* opterr: normally 1; if 0, suppresses the normal printfs to stderr on
    invalid options

They didn't used to be documented, but some systems do document it now.
Nevertheless, using those globals will result in incompatible programs.

++Brandon

-- 
Brandon S. Allbery         kf8nh@kf8nh.ampr.org          bsa@kf8nh.wariat.org