X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=src%2Frrd_getopt.c;h=7d157a0ee41bd0efe5760b7a8fc4d0e1ea8723fc;hp=f973471c0f016e3c11da534f6a22969c300260d1;hb=4e8787fdbff3ddd4044e19cf37b9e3a54b5ef0cb;hpb=1287bb0b2b8677c7206f3100676372043a54084c diff --git a/src/rrd_getopt.c b/src/rrd_getopt.c index f973471..7d157a0 100644 --- a/src/rrd_getopt.c +++ b/src/rrd_getopt.c @@ -39,10 +39,11 @@ #endif #endif - +#ifndef WIN32 #ifdef HAVE_CONFIG_H #include "../rrd_config.h" #endif +#endif #include "rrd_i18n.h" @@ -274,7 +275,8 @@ static char *const *original_argv; to getopt is that one passed to the process. */ static void store_args( int argc, - char *const *argv) __attribute__ ((unused)); + char *const *argv); + static void store_args( int argc, char *const *argv) @@ -359,7 +361,7 @@ static const char *_getopt_initialize( const char *); #endif static const char* _getopt_initialize(int argc, - char** argv, + char* const* argv, const char* optstring) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 @@ -394,7 +396,7 @@ static const char* _getopt_initialize(int argc, considered as options. */ char var[100]; - sprintf(var, "_%d_GNU_nonoption_argv_flags_", getpid()); + snprintf(var, sizeof var, "_%d_GNU_nonoption_argv_flags_", getpid()); nonoption_flags = getenv(var); if (nonoption_flags == NULL) nonoption_flags_len = 0; @@ -464,7 +466,11 @@ static const char* _getopt_initialize(int argc, long-named options. */ int _getopt_internal(int argc, +#ifdef WIN32 char** argv, +#else // WIN32 + char* const* argv, +#endif //WIN32 const char *optstring, const struct option *longopts, int* longind, @@ -868,15 +874,6 @@ int _getopt_internal(int argc, } } -int getopt( - int argc, - char** argv, - const char* optstring) -{ - return _getopt_internal(argc, argv, optstring, - (const struct option *) 0, (int *) 0, 0); -} - #endif /* Not ELIDE_CODE. */ #ifdef TEST