From 45f1427e888e54fdec28fb7f76999299627a1a24 Mon Sep 17 00:00:00 2001 From: Dengfeng Liu Date: Wed, 19 Apr 2017 11:31:19 +0800 Subject: [PATCH] Update xkcp_spy.c --- xkcp_spy.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xkcp_spy.c b/xkcp_spy.c index 4465423..2f2bfdd 100644 --- a/xkcp_spy.c +++ b/xkcp_spy.c @@ -81,9 +81,11 @@ int main(int argc, char **argv) struct event_base *base; struct bufferevent *bev; char *cmd = NULL, *addr = NULL, *param = NULL; - int port = 0, opt; + int port = 0, opt, flag = 1; while((opt = getopt(argc, argv, "h:p:t:m:")) != -1) { + flag = 0; + switch(opt) { case 'h': addr = strdup(optarg); @@ -103,6 +105,11 @@ int main(int argc, char **argv) } } + if (flag) { + usage(); + exit(EXIT_FAILURE); + } + base = event_base_new(); if (!base) { puts("Couldn't open event base");