Explorar o código

Now support aliases + hosts on command line at the same time

Héctor García %!s(int64=7) %!d(string=hai) anos
pai
achega
da3f60d820
Modificáronse 1 ficheiros con 10 adicións e 13 borrados
  1. 10 13
      src/mssh.c

+ 10 - 13
src/mssh.c

@@ -337,23 +337,20 @@ int main(int argc, char* argv[], char* env[])
         }
     }
 
-    if(hosts == NULL)
-    {
-        hosts = g_array_new(FALSE, TRUE, sizeof(char*));
-        if (optind < argc)
-        {
-            while (optind < argc)
-            {
-                char *host = strdup(argv[optind++]);
-                g_array_append_val(hosts, host);
-            }
+    if (optind < argc) {
+        if (hosts == NULL) {
+            hosts = g_array_new(FALSE, TRUE, sizeof(char*));
         }
-        else
+        while (optind < argc)
         {
-            fprintf(stderr, "No hosts specified\n\n");
-            usage(argv[0]);
+            char *host = strdup(argv[optind++]);
+            g_array_append_val(hosts, host);
         }
     }
+    if (hosts == NULL) {
+        fprintf(stderr, "No hosts specified\n\n");
+        usage(argv[0]);
+    }
 
     gtk_init(&argc, &argv);