]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-imap-client: test-imapc-client - Use getopt() for parsing command line arguments.
authorStephan Bosch <stephan.bosch@open-xchange.com>
Sat, 11 Apr 2020 08:05:25 +0000 (10:05 +0200)
committerStephan Bosch <stephan.bosch@open-xchange.com>
Tue, 26 May 2020 09:30:03 +0000 (11:30 +0200)
src/lib-imap-client/test-imapc-client.c

index 6fff36b17352aa934fcbc3834202b67d4c589667..ff824047dcd2b2be33706c30a015f0d5d27ce8d9 100644 (file)
@@ -810,6 +810,8 @@ static void test_imapc_client_get_capabilities_disconnected(void)
 
 int main(int argc ATTR_UNUSED, char *argv[])
 {
+       int c;
+
        static void (*const test_functions[])(void) = {
                test_imapc_connect_failed,
                test_imapc_banner_hangs,
@@ -825,7 +827,16 @@ int main(int argc ATTR_UNUSED, char *argv[])
                NULL
        };
 
-       debug = null_strcmp(argv[1], "-D") == 0;
+       while ((c = getopt(argc, argv, "D")) > 0) {
+               switch (c) {
+               case 'D':
+                       debug = TRUE;
+                       break;
+               default:
+                       i_fatal("Usage: %s [-D]", argv[0]);
+               }
+       }
+
        test_imapc_default_settings.debug = debug;
 
        /* listen on localhost */