+static void parse_options(struct model_params *params, int argc, char **argv)
+{
+ const char *shortopts = "hdnt:o:u:x:v::";
+ const struct option longopts[] = {
+ {"help", no_argument, NULL, 'h'},
+ {"verbose", optional_argument, NULL, 'v'},
+ {"uninitialized", required_argument, NULL, 'u'},
+ {"analysis", required_argument, NULL, 't'},
+ {"options", required_argument, NULL, 'o'},
+ {"maxexecutions", required_argument, NULL, 'x'},
+ {0, 0, 0, 0} /* Terminator */
+ };
+ int opt, longindex;
+ bool error = false;
+ while (!error && (opt = getopt_long(argc, argv, shortopts, longopts, &longindex)) != -1) {
+ switch (opt) {
+ case 'h':
+ print_usage(argv[0], params);
+ break;
+ case 'd':
+ params->threadsnocleanup = true;
+ break;
+ case 'n':
+ params->nofork = true;
+ break;
+ case 'x':
+ params->maxexecutions = atoi(optarg);
+ break;
+ case 'v':
+ params->verbose = optarg ? atoi(optarg) : 1;
+ break;
+ case 'u':
+ params->uninitvalue = atoi(optarg);
+ break;
+ case 't':
+ if (install_plugin(optarg))
+ error = true;
+ break;
+ case 'o':
+ {
+ ModelVector<TraceAnalysis *> * analyses = getInstalledTraceAnalysis();
+ if ( analyses->size() == 0 || (*analyses)[analyses->size()-1]->option(optarg))
+ error = true;
+ }
+ break;
+ default: /* '?' */
+ error = true;
+ break;
+ }
+ }