projects
/
cubemap
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
60dd549
)
Do not segfault on unknown options.
author
Steinar H. Gunderson
<sgunderson@bigfoot.com>
Wed, 17 Apr 2013 18:14:59 +0000
(20:14 +0200)
committer
Steinar H. Gunderson
<sgunderson@bigfoot.com>
Wed, 17 Apr 2013 18:14:59 +0000
(20:14 +0200)
main.cpp
patch
|
blob
|
history
diff --git
a/main.cpp
b/main.cpp
index
55548ba
..
e953a8c
100644
(file)
--- a/
main.cpp
+++ b/
main.cpp
@@
-248,9
+248,10
@@
int main(int argc, char **argv)
static const option long_options[] = {
{ "state", required_argument, 0, 's' },
{ "test-config", no_argument, 0, 't' },
+ { 0, 0, 0, 0 }
};
int option_index = 0;
- int c = getopt_long
(argc, argv, "s:t", long_options, &option_index);
+ int c = getopt_long(argc, argv, "s:t", long_options, &option_index);
if (c == -1) {
break;
@@
-263,7
+264,8
@@
int main(int argc, char **argv)
test_config = true;
break;
default:
- assert(false);
+ fprintf(stderr, "Unknown option '%s'\n", argv[option_index]);
+ exit(1);
}
}