From: Morgan Deters Date: Sat, 19 Jan 2013 16:27:03 +0000 (-0500) Subject: Fix an options-processing bug on some platforms (e.g., MacOS). X-Git-Tag: cvc5-1.0.0~7391^2~32 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cc8532543332bda3d0630f0b0816a131d49e57eb;p=cvc5.git Fix an options-processing bug on some platforms (e.g., MacOS). --- diff --git a/src/options/options_template.cpp b/src/options/options_template.cpp index d7cd8813b..48834d803 100644 --- a/src/options/options_template.cpp +++ b/src/options/options_template.cpp @@ -356,7 +356,7 @@ std::vector Options::parseOptions(int argc, char* main_argv[]) thro // This can be = 1 in newer GNU getopt, but older (< 2007) require = 0. optind = 0; #if HAVE_DECL_OPTRESET - optreset = 1; // on BSD getopt() (e.g. Mac OS), might also need this + optreset = 1; // on BSD getopt() (e.g. Mac OS), might need this #endif /* HAVE_DECL_OPTRESET */ // find the base name of the program @@ -386,7 +386,9 @@ std::vector Options::parseOptions(int argc, char* main_argv[]) thro Debug("preemptGetopt") << "top of loop, extra_optind == " << extra_optind << ", extra_argc == " << extra_argc << std::endl; if((extra_optind == 0 ? 1 : extra_optind) < extra_argc) { #if HAVE_DECL_OPTRESET - optreset = 1; // on BSD getopt() (e.g. Mac OS), might also need this + if(optind_ref != &extra_optind) { + optreset = 1; // on BSD getopt() (e.g. Mac OS), might need this + } #endif /* HAVE_DECL_OPTRESET */ old_optind = optind = extra_optind; optind_ref = &extra_optind; @@ -425,7 +427,9 @@ std::vector Options::parseOptions(int argc, char* main_argv[]) thro } if(c == -1) { #if HAVE_DECL_OPTRESET - optreset = 1; // on BSD getopt() (e.g. Mac OS), might also need this + if(optind_ref != &main_optind) { + optreset = 1; // on BSD getopt() (e.g. Mac OS), might need this + } #endif /* HAVE_DECL_OPTRESET */ old_optind = optind = main_optind; optind_ref = &main_optind; @@ -457,7 +461,7 @@ std::vector Options::parseOptions(int argc, char* main_argv[]) thro switch(c) { ${all_modules_option_handlers} -#line 461 "${template}" +#line 465 "${template}" case ':': // This can be a long or short option, and the way to get at the