nop \- pretty-print graph file
.SH SYNOPSIS
.B nop
+[
+.B \-p?
+]
[
.I files
]
on stdout. If no
.I files
are given, it reads from stdin.
+.SH OPTIONS
+The following options are supported:
+.TP
+.B \-p
+Produce no output - just check the input for valid DOT.
+.TP
+.B \-?
+Print usage information.
+.LP
+By default,
+.I gc
+returns the number of nodes and edges.
+.SH "EXIT STATUS"
+If any errors occurred while processing any input, such as a file
+not found or a file containing illegal DOT, a non-zero exit value
+is returned. Otherwhilse, zero is returned.
.SH "SEE ALSO"
wc(1), acyclic(1), gvpr(1), gvcolor(1), ccomps(1), sccmap(1), tred(1), libgraph(3)
#include "config.h"
#endif
-#include <agraph.h>
+typedef char Agnodeinfo_t;
+typedef char Agedgeinfo_t;
+typedef char Agraphinfo_t;
+#include <graph.h>
#include <ingraphs.h>
#include <stdio.h>
#include <stdlib.h>
#endif
char **Files;
+int chkOnly;
-static char *useString = "Usage: nop [-?] <files>\n\
+static char *useString = "Usage: nop [-p?] <files>\n\
+ -p - check for valid DOT\n\
-? - print usage\n\
If no files are specified, stdin is used\n";
{
int c;
- while ((c = getopt(argc, argv, ":")) != -1) {
+ while ((c = getopt(argc, argv, ":p")) != -1) {
switch (c) {
+ case 'p':
+ chkOnly = 1;
+ break;
case '?':
if (optopt == '?')
usage(0);
static Agraph_t *gread(FILE * fp)
{
- return agread(fp, (Agdisc_t *) 0);
+ return agread(fp);
}
int main(int argc, char **argv)
ingraph_state ig;
init(argc, argv);
+ aginit ();
newIngraph(&ig, Files, gread);
while ((g = nextGraph(&ig)) != 0) {
- agwrite(g, stdout);
+ if (!chkOnly) agwrite(g, stdout);
agclose(g);
}
- exit(0);
+ return(ig.errors | agerrors());
}