From bb6f6faaa2acfebfe3658ae48951e1b84ed1fabf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 7 Oct 2013 21:36:31 -0700 Subject: [PATCH] scanner: Handle unrecognized invocation mode Print usage if we don't recognize the invocation mode. Also fixes uninitialized variable warning. --- src/scanner.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/scanner.c b/src/scanner.c index d02d865..0fbaabd 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -1178,6 +1178,8 @@ int main(int argc, char *argv[]) mode = SERVER_HEADER; else if (strcmp(argv[1], "code") == 0) mode = CODE; + else + usage(EXIT_FAILURE); wl_list_init(&protocol.interface_list); protocol.type_index = 0; @@ -1210,7 +1212,7 @@ int main(int argc, char *argv[]) XML_ParserFree(ctx.parser); - switch(mode) { + switch (mode) { case CLIENT_HEADER: emit_header(&protocol, 0); break;