[PATCH] No extern declarations of optarg & co if getopt.h isavailable

Corinna Vinschen vinschen at redhat.com
Thu Sep 11 17:27:52 EST 2003

On Thu, Sep 11, 2003 at 02:44:06PM +1000, Darren Tucker wrote:
> Damien Miller wrote:
> > Corinna Vinschen wrote:
> > > This could be easily circumvented by either not declaring the variables
> > > at all in these main() funcs, or by surrounding the declarations with
> > >
> > >   #ifndef HAVE_GETOPT_H
> > >       extern char *optarg;
> > >       ...
> > >   #endif

Please don't take that serious.  I had an apparently bad day yesterday
and took warnings of the linker as errors.  Actually the applications
do link ok, the linker throws just a warning like this:

  Info: resolving _optarg by linking to __imp__optarg (auto-import)

However, Darren's patch is IMHO cleaner than the unconditional extern
declarations and it works fine on Cygwin.

Sorry again for the uprising,

Corinna Vinschen
Cygwin Developer
Red Hat, Inc.

More information about the openssh-unix-dev mailing list