From 789c2d263b885c020b99a5bf334c66c630117a00 Mon Sep 17 00:00:00 2001 From: erg Date: Fri, 31 Oct 2008 17:13:45 +0000 Subject: [PATCH] Add -q (quiet) flag; use better name function for edges (agnameof isn't really right). --- cmd/gvpr/compile.c | 6 +++--- cmd/gvpr/gvpr.1 | 5 ++++- cmd/gvpr/gvpr.c | 6 +++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cmd/gvpr/compile.c b/cmd/gvpr/compile.c index f3bca7a38..df6bf5ef3 100644 --- a/cmd/gvpr/compile.c +++ b/cmd/gvpr/compile.c @@ -81,7 +81,7 @@ static char *nameOf(Expr_t * ex, Agobj_t * obj) else sfputr(tmps, "--", -1); sfputr(tmps, agnameof(AGHEAD(e)), -1); - if (*key) { + if (key && *key) { sfputc(tmps, '['); sfputr(tmps, key, -1); sfputc(tmps, ']'); @@ -436,7 +436,7 @@ static int lookup(Expr_t * pgm, Agobj_t * objp, Exid_t * sym, Extype_t * v, Agsym_t *gsym = agattrsym(objp, sym->name); if (!gsym) { gsym = agattr(agroot(agraphof(objp)), AGTYPE(objp), sym->name, ""); - error(ERROR_WARNING, "Using value of uninitialized attribute \"%s\" of %s \"%s\"", sym->name, kindOf (objp), agnameof(objp)); + error(ERROR_WARNING, "Using value of uninitialized attribute \"%s\" of %s \"%s\"", sym->name, kindOf (objp), nameOf(pgm, objp)); } v->string = agxget(objp, gsym); } @@ -1173,7 +1173,7 @@ getval(Expr_t * pgm, Exnode_t * node, Exid_t * sym, Exref_t * ref, else { if (!gsym) { gsym = agattr(agroot(agraphof(objp)), AGTYPE(objp), name, ""); - error(ERROR_WARNING, "Using value of uninitialized attribute \"%s\" of %s \"%s\" in aget()", name, kindOf (objp), agnameof(objp)); + error(ERROR_WARNING, "Using value of uninitialized attribute \"%s\" of %s \"%s\" in aget()", name, kindOf (objp), nameOf(pgm, objp)); } v.string = agxget(objp, gsym); } diff --git a/cmd/gvpr/gvpr.1 b/cmd/gvpr/gvpr.1 index 2978d0fd2..836ec1c93 100644 --- a/cmd/gvpr/gvpr.1 +++ b/cmd/gvpr/gvpr.1 @@ -7,7 +7,7 @@ gvpr \- graph pattern scanning and processing language ) .SH SYNOPSIS .B gvpr -[\fB\-icV?\fP] +[\fB\-icqV?\fP] [ .BI \-o .I outfile @@ -89,6 +89,9 @@ is not given, .B gvpr will use the first non\(hyoption argument as the program. .TP +.B \-q +Turns off warning messages. +.TP .B \-V Causes the program to print version information and exit. .TP diff --git a/cmd/gvpr/gvpr.c b/cmd/gvpr/gvpr.c index cf18e3205..6fb7d3bed 100644 --- a/cmd/gvpr/gvpr.c +++ b/cmd/gvpr/gvpr.c @@ -60,6 +60,7 @@ static const char *usage = -i - create node induced subgraph\n\ -a - string arguments available as ARGV[0..]\n\ -o - write output to ; stdout by default\n\ + -q - turn off warning messages\n\ -V - print version info\n\ -? - print usage info\n\ If no files are specified, stdin is used\n"; @@ -247,7 +248,7 @@ static void scanArgs(int argc, char **argv) error_info.id = options.cmdName; #endif - while ((c = getopt(argc, argv, ":?Vcia:f:o:")) != -1) { + while ((c = getopt(argc, argv, ":q?Vcia:f:o:")) != -1) { switch (c) { case 'c': options.compflags |= SRCOUT; @@ -265,6 +266,9 @@ static void scanArgs(int argc, char **argv) case 'o': outname = optarg; break; + case 'q': + setTraceLevel (ERROR_ERROR); + break; case 'V': fprintf(stderr, "%s version %s (%s)\n", Info[0], Info[1], Info[2]); -- 2.40.0