X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=main.cc;h=36055107c696b85003702159646450bbe0db3e04;hb=HEAD;hp=989876c933590f1fa074a3a53fd56050bbcd6b4b;hpb=9b5fe3ab5dd51f3dbb3926c6887a7c163ec145c7;p=c11tester.git diff --git a/main.cc b/main.cc index 989876c9..36055107 100644 --- a/main.cc +++ b/main.cc @@ -88,20 +88,19 @@ bool install_plugin(char * name) { } void parse_options(struct model_params *params) { - const char *shortopts = "hrnt:o:x:v:m:f::"; + const char *shortopts = "hrnt:o:x:v:m:f:"; const struct option longopts[] = { {"help", no_argument, NULL, 'h'}, - {"verbose", optional_argument, NULL, 'v'}, + {"removevisible", no_argument, NULL, 'r'}, {"analysis", required_argument, NULL, 't'}, {"options", required_argument, NULL, 'o'}, {"maxexecutions", required_argument, NULL, 'x'}, + {"verbose", optional_argument, NULL, 'v'}, {"minsize", required_argument, NULL, 'm'}, {"freqfree", required_argument, NULL, 'f'}, - {"removevisible", no_argument, NULL, 'r'}, {0, 0, 0, 0} /* Terminator */ }; int opt, longindex; - int tmpoptind = optind; bool error = false; char * options = getenv("C11TESTER"); @@ -115,7 +114,7 @@ void parse_options(struct model_params *params) { } argc++; //first parameter is executable name char optcpy[index + 1]; - memcpy(optcpy, options, index+1); + real_memcpy(optcpy, options, index+1); char * argv[argc + 1]; argv[0] = NULL; argv[1] = optcpy; @@ -167,8 +166,8 @@ void parse_options(struct model_params *params) { } } - /* Restore (global) optind for potential use by user program */ - optind = tmpoptind; + /* Special value to reset implementation as described by Linux man page. */ + optind = 0; if (error) print_usage(params);