X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=lib%2Fgetopt.c;h=a6782ed667b46fccfb2a01b76ed18b5d4dcff591;hp=fce2f0c7ce69110616d5f08ea5f8e623805b01b1;hb=eda71798749e8b0abf5e8b3cbc11da82aa607f00;hpb=4c85542894f7fca823b119b05e07179deb24229a diff --git a/lib/getopt.c b/lib/getopt.c index fce2f0c7..a6782ed6 100644 --- a/lib/getopt.c +++ b/lib/getopt.c @@ -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 @@ -85,8 +89,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #define getpid() GetCurrentProcessId() #endif -#include "gettext.h" - /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. @@ -690,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);