X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=src%2Frrd_getopt.c;h=dbb3f3f76dd76630b112c01e875adcf657d2a2af;hp=d03b456e8297cc8d7446c848b56fa77ef9c8578a;hb=85cd3f3afae48026843bea34d2d0d1056ee9dda5;hpb=7d0d6b07c9f5bd5dfd99aa7fe9826eebf2181f1f diff --git a/src/rrd_getopt.c b/src/rrd_getopt.c index d03b456..dbb3f3f 100644 --- a/src/rrd_getopt.c +++ b/src/rrd_getopt.c @@ -30,11 +30,8 @@ #define _NO_PROTO #endif -#ifdef HAVE_CONFIG_H -#include "../rrd_config.h" -#endif -#if !defined (__STDC__) || !__STDC__ +#if !defined WIN32 && (!defined (__STDC__) || !__STDC__) /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const @@ -42,6 +39,14 @@ #endif #endif + +#ifdef HAVE_CONFIG_H +#include "../rrd_config.h" +#endif + +#include "rrd_i18n.h" + + #include /* Comment out all this code if we are using the GNU C Library, and are not @@ -85,17 +90,6 @@ #define getpid() GetCurrentProcessId() #endif -#ifndef _ -/* This is for other GNU distributions with internationalized messages. - When compiling libc, the _ macro is predefined. */ -#ifdef HAVE_LIBINTL_H -# include -# define _(msgid) gettext (msgid) -#else -# define _(msgid) (msgid) -#endif -#endif - /* 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. @@ -190,7 +184,7 @@ int optopt = '?'; of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return -1 with `optind' != ARGC. */ -static const enum { +static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; @@ -214,11 +208,7 @@ static char *posixly_correct; char *getenv( ); -static char *my_index( - str, - chr) - const char *str; - int chr; +static char* my_index(const char* str, int chr) { while (*str) { if (*str == chr) @@ -295,9 +285,7 @@ static void exchange( char **); #endif -static void exchange( - argv) - char **argv; +static void exchange(char** argv) { int bottom = first_nonopt; int middle = last_nonopt; @@ -353,13 +341,9 @@ static const char *_getopt_initialize( char *const *, const char *); #endif -static const char *_getopt_initialize( - argc, - argv, - optstring) - int argc; - char *const *argv; - const char *optstring; +static const char* _getopt_initialize(int argc, + char** argv, + const char* optstring) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped @@ -462,19 +446,12 @@ static const char *_getopt_initialize( If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ -int _getopt_internal( - argc, - argv, - optstring, - longopts, - longind, - long_only) - int argc; - char *const *argv; - const char *optstring; - const struct option *longopts; - int *longind; - int long_only; +int _getopt_internal(int argc, + char** argv, + const char *optstring, + const struct option *longopts, + int* longind, + int long_only) { optarg = NULL; @@ -875,12 +852,9 @@ int _getopt_internal( } int getopt( - argc, - argv, - optstring) - int argc; - char *const *argv; - const char *optstring; + int argc, + char** argv, + const char* optstring) { return _getopt_internal(argc, argv, optstring, (const struct option *) 0, (int *) 0, 0);