From: erg Date: Wed, 15 Oct 2008 22:59:43 +0000 (+0000) Subject: Add a totally silent mode to sccmap, so that no statistics are printed. X-Git-Tag: LAST_LIBGRAPH~32^2~3097 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dda42cf163b7a467581995d0602935183257fb9a;p=graphviz Add a totally silent mode to sccmap, so that no statistics are printed. --- diff --git a/cmd/tools/sccmap.1 b/cmd/tools/sccmap.1 index b8e8024cb..b9da08264 100644 --- a/cmd/tools/sccmap.1 +++ b/cmd/tools/sccmap.1 @@ -27,6 +27,9 @@ Preserve degenerate components of only one node. Do not print the resulting graphs. Only the statistics are important. .TP +.B \-S +Just print the resulting graphs. No statistics are printed. +.TP .B \-v Generate additional statistics. In particular, .B sccmap diff --git a/cmd/tools/sccmap.c b/cmd/tools/sccmap.c index 4cb0bc347..55e9a7fbb 100644 --- a/cmd/tools/sccmap.c +++ b/cmd/tools/sccmap.c @@ -140,6 +140,7 @@ typedef struct { int wantDegenerateComp; int Silent; +int StatsOnly; int Verbose; char *CmdName; char **Files; @@ -206,7 +207,7 @@ static int visit(Agnode_t * n, Agraph_t * map, Stack * sp, sccstate * st) st->N_nodes_in_nontriv_SCC++; } while (t != n); nodeInduce(subg, map); - if (!Silent) + if (!StatsOnly) agwrite(subg, stdout); } } @@ -292,7 +293,7 @@ static void process(Agraph_t * G) if (getval(n) == 0) visit(n, map, &stack, &state); freeStack(&stack); - if (!Silent) + if (!StatsOnly) agwrite(map, stdout); agclose(map); @@ -301,14 +302,15 @@ static void process(Agraph_t * G) agnnodes(G), agnedges(G), nc, state.Comp, state.N_nodes_in_nontriv_SCC / (double) agnnodes(G), Maxdegree, nontree_frac); - else + else if (!Silent) fprintf(stderr, "%d nodes, %d edges, %d strong components\n", agnnodes(G), agnedges(G), state.Comp); } static char *useString = "Usage: %s [-sdv?] \n\ - -s - silent\n\ + -s - only produce statistics\n\ + -S - silent\n\ -d - allow degenerate components\n\ -v - verbose\n\ -? - print usage\n\ @@ -325,10 +327,10 @@ static void scanArgs(int argc, char **argv) int c; CmdName = argv[0]; - while ((c = getopt(argc, argv, ":sdv?")) != EOF) { + while ((c = getopt(argc, argv, ":sdvS?")) != EOF) { switch (c) { case 's': - Silent = 1; + StatsOnly = 1; break; case 'd': wantDegenerateComp = 1; @@ -336,6 +338,10 @@ static void scanArgs(int argc, char **argv) case 'v': Verbose = 1; break; + case 'S': + Verbose = 0; + Silent = 1; + break; case '?': if (optopt == '?') usage(0);