]> granicus.if.org Git - graphviz/commitdiff
Fix bug 2304; made similar mods to other tools.
authorEmden R. Gansner <erg@research.att.com>
Thu, 11 Jul 2013 15:05:39 +0000 (11:05 -0400)
committerEmden R. Gansner <erg@research.att.com>
Thu, 11 Jul 2013 15:05:39 +0000 (11:05 -0400)
12 files changed:
cmd/tools/bcomps.c
cmd/tools/ccomps.c
cmd/tools/cvtgxl.c
cmd/tools/dijkstra.c
cmd/tools/gc.c
cmd/tools/gml2gv.c
cmd/tools/graphml2gv.c
cmd/tools/gv2gml.c
cmd/tools/gvpack.c
cmd/tools/mm2gv.c
cmd/tools/nop.c
cmd/tools/sccmap.c

index e3e41b43bdc24064dd2a460e7e390dc3497bc590..839be2f31ea02e65fcea0a1d4621a6eb360a4048 100644 (file)
@@ -367,6 +367,9 @@ static void init(int argc, char *argv[])
        case 'x':
            external = 1;
            break;
+       case ':':
+           fprintf(stderr, "bcomps: option -%c missing argument - ignored\n", optopt);
+           break;
        case '?':
            if (optopt == '?')
                usage(0);
@@ -379,7 +382,7 @@ static void init(int argc, char *argv[])
     argv += optind;
     argc -= optind;
 
-    if (argc)
+    if (argc > 0)
        Files = argv;
 }
 
index 5a5207c7adcb937c84f661575887f1d24af3355c..f07c263dd65eb366f99929be73d6ea501cace047 100644 (file)
@@ -206,6 +206,10 @@ static void init(int argc, char *argv[])
        case 'z':
            sorted = 1;
            break;
+       case ':':
+           fprintf(stderr,
+               "ccomps: option -%c missing argument - ignored\n", optopt);
+           break;
        case '?':
            if (optopt == '?')
                usage(0);
@@ -231,7 +235,7 @@ static void init(int argc, char *argv[])
        else
            sorted = 0;    /* not relevant; turn off */
     }
-    if (argc)
+    if (argc > 0)
        Files = argv;
 }
 
index 91b978b8939fad97ff39536aaa1c1fe0046c4697..ba4b4465b9afa5c5d1f09d8bad0c15611910eba9 100644 (file)
@@ -154,6 +154,9 @@ static void initargs(int argc, char **argv)
        case 'o':
            outFile = openFile(optarg, "w");
            break;
+       case ':':
+           fprintf(stderr, "%s: option -%c missing argument\n", CmdName, optopt);
+           break;
        case '?':
            if (optopt == '?')
                usage(0);
@@ -168,7 +171,7 @@ static void initargs(int argc, char **argv)
     argv += optind;
     argc -= optind;
 
-    if (argc)
+    if (argc > 0)
        Files = argv;
     if (!outFile)
        outFile = stdout;
index 0300d74e51cc17ad69522da76dbe3f92920d9fe8..b093f416fd7d61383cd17ce8b9895262820fa3f7 100644 (file)
@@ -262,7 +262,7 @@ static void init(int argc, char *argv[])
 
     CmdName = argv[0];
     opterr = 0;
-    while ((c = getopt(argc, argv, ":adp")) != -1) {
+    while ((c = getopt(argc, argv, "adp")) != -1) {
        switch (c) {
        case 'a':
            setall = 1;
index 42b1651831ec38429864794abb6ee7218d1d1e5f..d45b72931f131d3550a4fa3722fc8987a6614016 100644 (file)
@@ -100,7 +100,7 @@ static void init(int argc, char *argv[])
     unsigned int c;
 
     opterr = 0;
-    while ((c = getopt(argc, argv, ":necCaDUrsv")) != -1) {
+    while ((c = getopt(argc, argv, "necCaDUrsv")) != -1) {
        switch (c) {
        case 'e':
            flags |= EDGES;
index b972f593eff8e0081f9f966fa81dc40e30bef2e6..5301aec5b7849d2fabd5d5c487e7068074c1cfe7 100644 (file)
@@ -128,13 +128,17 @@ static void initargs(int argc, char **argv)
        case 'o':
            outFile = openFile(optarg, "w");
            break;
+       case ':':
+           fprintf(stderr, "%s: option -%c missing argument\n", CmdName, optopt);
+           usage(1);
+           break;
        case '?':
            if (optopt == '?')
                usage(0);
            else {
                fprintf(stderr, "%s: option -%c unrecognized\n", CmdName,
                        optopt);
-               exit(1);
+               usage(1);
            }
        }
     }
index 9ca10127dbce88f25ad806681e1607d90c903cf4..fc51fdc0c8ad6a38f15c61eaecd2ab28c48bdae5 100644 (file)
@@ -727,13 +727,17 @@ static void initargs(int argc, char **argv)
        case 'o':
            outFile = openFile(optarg, "w");
            break;
+       case ':':
+           fprintf(stderr, "%s: option -%c missing argument\n", CmdName, optopt);
+           usage(1);
+           break;
        case '?':
            if (optopt == '?')
                usage(0);
            else {
                fprintf(stderr, "%s: option -%c unrecognized\n", CmdName,
                        optopt);
-               exit(1);
+               usage(1);
            }
        }
     }
index 7f3e882aa62910ec4758435893442e86b793acba..e98f7c7caea6f43432557c56b02a3119e7aea707 100644 (file)
@@ -712,19 +712,24 @@ static void initargs(int argc, char **argv)
 
     CmdName = cmdName(argv[0]);
     opterr = 0;
-    while ((c = getopt(argc, argv, ":io:")) != -1) {
+    while ((c = getopt(argc, argv, ":o:")) != -1) {
        switch (c) {
        case 'o':
            outFile = openFile(optarg, "w");
            break;
+       case ':':
+           fprintf(stderr, "%s: option -%c missing parameter\n", CmdName, optopt);
+           usage(1);
+           break;
        case '?':
            if (optopt == '?')
                usage(0);
            else {
                fprintf(stderr, "%s: option -%c unrecognized\n", CmdName,
                        optopt);
-               exit(1);
+               usage(1);
            }
+           break;
        }
     }
 
index ab9b985f0d9e5ce9e4af8067c86d77e2c282c965..b085510dc585b58f51611023656c286405f14796 100644 (file)
@@ -260,6 +260,9 @@ static void init(int argc, char *argv[], pack_info* pinfo)
            verbose = 1;
            Verbose = 1;
            break;
+       case ':':
+           fprintf(stderr, "gvpack: option -%c missing argument - ignored\n", optopt);
+           break;
        case '?':
            if (optopt == '?')
                usage(0);
@@ -272,7 +275,7 @@ static void init(int argc, char *argv[], pack_info* pinfo)
     argv += optind;
     argc -= optind;
 
-    if (argc) {
+    if (argc > 0) {
        myFiles = argv;
        nGraphs = argc;         /* guess one graph per file */
     } else
index a7e4e0c3b91e206c0901ff6df14531b9fc8fc90d..4dfa4d983b152ac2552177cd34c18d92471a85fd 100644 (file)
@@ -439,6 +439,9 @@ static void init(int argc, char **argv, parms_t * p)
          }
          break;
        }
+       case ':':
+           fprintf(stderr, "%s: option -%c missing argument - ignored\n", cmd, optopt);
+           break;
        case '?':
            if (optopt == '?')
                usage(0);
@@ -452,7 +455,7 @@ static void init(int argc, char **argv, parms_t * p)
     argv += optind;
     argc -= optind;
 
-    if (argc) {
+    if (argc > 0) {
        p->infile = argv[0];
        p->inf = openF(argv[0], "r");
     }
index 1d37410f77d231f81f20a5788abcad6c6a844daf..cb8ae3fa74dff8c31d7b60750c6ccad9960c85da 100644 (file)
@@ -53,7 +53,7 @@ static void init(int argc, char *argv[])
     int c;
 
     opterr = 0;
-    while ((c = getopt(argc, argv, ":p")) != -1) {
+    while ((c = getopt(argc, argv, "p")) != -1) {
        switch (c) {
        case 'p':
            chkOnly = 1;
index 3a6d381962d831d79a25e8aae5c644c3fa0bc196..e309047127e664bf5945d42b2e7e371273f23359 100644 (file)
@@ -368,6 +368,9 @@ static void scanArgs(int argc, char **argv)
            Verbose = 0;
            Silent = 1;
            break;
+       case ':':
+           fprintf(stderr, "%s: option -%c missing argument - ignored\n", CmdName, optopt);
+           break;
        case '?':
            if (optopt == '?')
                usage(0);
@@ -380,7 +383,7 @@ static void scanArgs(int argc, char **argv)
     argv += optind;
     argc -= optind;
 
-    if (argc)
+    if (argc > 0)
        Files = argv;
     if (!outfp)
        outfp = stdout;         /* stdout the default */