From 330cd743b86832fede7a84ee625df4bffb8a11f3 Mon Sep 17 00:00:00 2001 From: "Y. T. Chung" Date: Sun, 7 May 2017 11:51:01 +0800 Subject: [PATCH] [#20] Fixed getopt_long in rpi --- src/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f7a3105..674f491 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -91,8 +91,10 @@ int main(int argc, char *const argv[]) { eap_method method = EAP_METHOD_XOR; bool daemon = false; bool color = false; - char argval; - while ((argval = getopt_long(argc, argv, "u:p:i:m:dhc", arglist, NULL)) != -1) { + int argval = 0; + // XXX: `getopt` and `getopt_long` seems to return an unsigned char value, which is different + // to all the other systems! + while ((argval = getopt_long(argc, argv, "u:p:i:m:dhc", arglist, NULL)) != -1 && argval != 255) { switch (argval) { case 'h': printf("Usage: sysuh3c [arg]\n"