summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2013-06-15 13:24:18 +0200
committerStefan Bühler <stbuehler@web.de>2013-06-15 13:28:41 +0200
commitc14ac587e08127f45cb111f37d8481884493303a (patch)
tree1d572ca84c255812b9fb88ad467fef64c6f991e0
parent1ebdbb88ff1a43afe02628c50603db9476762ffc (diff)
downloadweighttp-c14ac587e08127f45cb111f37d8481884493303a.tar.gz
weighttp-c14ac587e08127f45cb111f37d8481884493303a.zip
Improve option error handling
-rw-r--r--src/weighttp.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/weighttp.c b/src/weighttp.c
index b382f19..c7670f7 100644
--- a/src/weighttp.c
+++ b/src/weighttp.c
@@ -277,7 +277,11 @@ int main(int argc, char *argv[]) {
headers_num++;
break;
case '?':
- W_ERROR("unkown option: -%c", optopt);
+ if ('?' != optopt) W_ERROR("unkown option: -%c\n", optopt);
+ show_help();
+ return 1;
+ case ':':
+ W_ERROR("option requires an argument: -%c\n", optopt);
show_help();
return 1;
}