]> granicus.if.org Git - graphviz/commitdiff
add -K command line option to select layout engine (overriding basename default)
authorellson <devnull@localhost>
Thu, 6 Jan 2005 02:39:35 +0000 (02:39 +0000)
committerellson <devnull@localhost>
Thu, 6 Jan 2005 02:39:35 +0000 (02:39 +0000)
don't like -K ?   Propose something else - but -L is already taken ;-(

cmd/dot/dot.c
lib/common/input.c

index 69f3fbe1fc2c64ad9f981b15de01fb9815da175c..473b08fc66dc60c3da9f55b776886a8229f5b9f1 100644 (file)
@@ -141,13 +141,13 @@ int main(int argc, char **argv)
 
     setCmdName(argv[0]);
 
-    parse_args(gvc, argc, argv);
-
     str = basename(argv[0]);
     rv = gvlayout_select(gvc, str);
     if (rv == NO_SUPPORT)
        gvlayout_select(gvc, "dot");
 
+    parse_args(gvc, argc, argv);
+
 #ifndef MSWIN32
     signal(SIGUSR1, toggle);
     signal(SIGINT, intr);
index be82902a0c107a6b7306424213f528360b7f1202..f9381e3635465fad775363965fb0e8e560bb75d4 100644 (file)
@@ -31,7 +31,7 @@ static char *CONFIG = "";
 char *Gvfilepath;
 
 static char *usageFmt =
-    "Usage: %s [-Vv?] [-(GNE)name=val] [-(Tlso)<val>] <dot files>\n";
+    "Usage: %s [-Vv?] [-(GNE)name=val] [-(KTlso)<val>] <dot files>\n";
 
 static char *genericItems = "\n\
  -V          - Print version and exit\n\
@@ -40,6 +40,7 @@ static char *genericItems = "\n\
  -Nname=val  - Set node attribute 'name' to 'val'\n\
  -Ename=val  - Set edge attribute 'name' to 'val'\n\
  -Tv         - Set output format to 'v'\n\
+ -Kv         - Set layout engine to 'v' (overrides default based on command name)\n\
  -lv         - Use external library 'v'\n\
  -ofile      - Write output to 'file'\n\
  -q[l]       - Set level of message suppression (=1)\n\
@@ -195,6 +196,20 @@ void dotneato_initialize(GVC_t * gvc, int argc, char **argv)
                    exit(1);
                }
                break;
+           case 'K':
+               val = getFlagOpt(argc, argv, &i);
+               if (!val) {
+                    fprintf(stderr, "Missing argument for -K flag\n");
+                    dotneato_usage(1);
+                    exit(1);
+                }
+                v = gvlayout_select(gvc, val);
+                if (v == NO_SUPPORT) {
+                    fprintf(stderr, "Layout type: \"%s\" not recognized. Use one of:%s\n",
+                        val, gvplugin_list(gvc, API_layout, val));
+                    exit(1);
+                }
+               break;
            case 'V':
                fprintf(stderr, "%s version %s (%s)\n",
                        gvc->info[0], gvc->info[1], gvc->info[2]);