]> git.webhop.me Git - lcd4linux.git/commitdiff
option parsing modified
authormichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Fri, 16 Jan 2009 05:44:14 +0000 (05:44 +0000)
committermichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Fri, 16 Jan 2009 05:44:14 +0000 (05:44 +0000)
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@971 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

lcd4linux.c

index 1fde9f79d2e8417207ceeab0d2dee6c131b44752..18fc7ce8a688f1edb2135fcadb4f972780177db5 100644 (file)
@@ -81,7 +81,7 @@ static void usage(void)
     printf("\n");
     printf("options:\n");
     printf("  -h               help\n");
-    printf("  -l               list available display drivers\n");
+    printf("  -l               list available display drivers and plugins\n");
     printf("  -c <key>=<value> overwrite entries from the config-file\n");
     printf("  -i               enter interactive mode (after display initialisation)\n");
     printf("  -ii              enter interactive mode (before display initialisation)\n");
@@ -206,6 +206,7 @@ int main(int argc, char *argv[])
     int c;
     int quiet = 0;
     int interactive = 0;
+    int list_mode = 0;
     int pid;
 
     /* save arguments for restart */
@@ -244,14 +245,8 @@ int main(int argc, char *argv[])
            interactive++;
            break;
        case 'l':
-           printf("%s\n", release);
-           printf("%s\n", copyright);
-           printf("\n");
-           drv_list();
-           printf("\n");
-           plugin_list();
-           printf("\n");
-           exit(0);
+           list_mode++;
+           break;
        case 'o':
            output = optarg;
            break;
@@ -279,7 +274,18 @@ int main(int argc, char *argv[])
        running_foreground = 1;
     }
 
-    info("Version " VERSION "-" SVN_VERSION " starting");
+    if (list_mode > 0) {
+       printf("%s\n", release);
+       printf("%s\n", copyright);
+       printf("\n");
+       drv_list();
+       printf("\n");
+       plugin_list();
+       printf("\n");
+       exit(0);
+    }
+
+    info("%s starting", release);
     if (!running_foreground && (my_argv[0] == NULL || my_argv[0][0] != '/')) {
        info("invoked without full path; restart may not work!");
     }