=== modified file 'src/glcompbench.cc'
@@ -43,7 +43,8 @@
std::list<CompositeTest*> tests;
- Options::parse_args(argc, argv);
+ if (!Options::parse_args(argc, argv))
+ return 1;
if (Options::show_help) {
Options::print_help();
=== modified file 'src/options.cc'
@@ -98,20 +98,23 @@
" --help Display help\n");
}
-void
+bool
Options::parse_args(int argc, char **argv)
{
while (1) {
- int option_index = 0;
+ int option_index = -1;
int c;
- const char *optname;
+ const char *optname = "";
c = getopt_long(argc, argv, "",
long_options, &option_index);
if (c == -1)
break;
+ if (c == ':' || c == '?')
+ return false;
- optname = long_options[option_index].name;
+ if (option_index != -1)
+ optname = long_options[option_index].name;
if (!strcmp(optname, "ids"))
parse_window_ids(optarg, Options::window_ids);
@@ -140,4 +143,6 @@
else if (!strcmp(optname, "help"))
Options::show_help = true;
}
+
+ return true;
}
=== modified file 'src/options.h'
@@ -28,7 +28,7 @@
#include <list>
struct Options {
- static void parse_args(int argc, char **argv);
+ static bool parse_args(int argc, char **argv);
static void print_help();
static std::list<Window> window_ids;