Command line ignore empty if flag set
authorArmin Novak <armin.novak@thincast.com>
Mon, 12 Jun 2017 10:23:10 +0000 (12:23 +0200)
committerArmin Novak <armin.novak@thincast.com>
Mon, 12 Jun 2017 10:23:10 +0000 (12:23 +0200)
When CommandLineParseArgumentsA is called with flag
COMMAND_LINE_IGN_UNKNOWN_KEYWORD return success if the
command line is empty.

winpr/libwinpr/utils/cmdline.c

index 19e4eab..0493056 100644 (file)
@@ -85,7 +85,10 @@ int CommandLineParseArgumentsA(int argc, LPCSTR* argv, COMMAND_LINE_ARGUMENT_A*
 
        if (argc == 1)
        {
-               status = COMMAND_LINE_STATUS_PRINT_HELP;
+               if (flags & COMMAND_LINE_IGN_UNKNOWN_KEYWORD)
+                       status = 0;
+               else
+                       status = COMMAND_LINE_STATUS_PRINT_HELP;
                return status;
        }