X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fgetopt.c;h=d63887e5374a96e190ab27a924ad53e166223919;hp=b2f88b42305f174aa1ebe0668501e6a8da401ac3;hb=d4410d0cce40929db9a0ce7042ef962f1867234d;hpb=35b1c25093a478d20e01f0ff391c9cdc9c41c2b8 diff --git a/src/getopt.c b/src/getopt.c index b2f88b42..d63887e5 100644 --- a/src/getopt.c +++ b/src/getopt.c @@ -31,7 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #endif #ifdef HAVE_CONFIG_H -#include +#include "../config.h" #endif #if !defined (__STDC__) || !__STDC__ @@ -44,6 +44,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #include +#ifdef HAVE_STRING_H +#include +#endif + /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling @@ -688,16 +692,18 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) else { if (opterr) - if (argv[optind - 1][1] == '-') - /* --option */ - fprintf (stderr, - "%s: option `--%s' doesn't allow an argument\n", - argv[0], pfound->name); - else - /* +option or -option */ - fprintf (stderr, - "%s: option `%c%s' doesn't allow an argument\n", - argv[0], argv[optind - 1][0], pfound->name); + { + if (argv[optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + "%s: option `--%s' doesn't allow an argument\n", + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + "%s: option `%c%s' doesn't allow an argument\n", + argv[0], argv[optind - 1][0], pfound->name); + } nextchar += strlen (nextchar);