#include "render.h"
#include "htmltable.h"
#include "gvc.h"
+#include "agxbuf.h"
static char *usageFmt =
"Usage: %s [-Vv?] [-(GNE)name=val] [-(KTlso)<val>] <dot files>\n";
}
#ifdef WITH_CGRAPH
-static void global_def(char *dcl, int kind,
+static void global_def(agxbuf* xb, char *dcl, int kind,
attrsym_t * ((*dclfun) (Agraph_t *, int kind, char *, char *)) )
{
char *p;
char *rhs = "true";
+ agxbinit(&xb, SMALLBUF, buf);
attrsym_t *sym;
if ((p = strchr(dcl, '='))) {
- *p++ = '\0';
- rhs = p;
+ agxbput_n (xb, dcl, p-dcl);
+ rhs = p+1;
}
- sym = dclfun(NULL, kind, dcl, rhs);
+ sym = dclfun(NULL, kind, agxbuse (xb), rhs);
sym->fixed = 1;
}
#else
-static void global_def(char *dcl,
+static void global_def(agxbuf* xb, char *dcl,
attrsym_t * ((*dclfun) (Agraph_t *, char *, char *)))
{
char *p;
attrsym_t *sym;
if ((p = strchr(dcl, '='))) {
- *p++ = '\0';
- rhs = p;
+ agxbput_n (xb, dcl, p-dcl);
+ rhs = p+1;
}
- sym = dclfun(NULL, dcl, rhs);
+ sym = dclfun(NULL, agxbuse (xb), rhs);
sym->fixed = 1;
}
#endif
char c, *rest;
const char *val;
int i, v, nfiles;
+ unsigned char buf[SMALLBUF];
+ agxbuf xb;
/* establish if we are running in a CGI environment */
HTTPServerEnVar = getenv("SERVER_NAME");
nfiles++;
gvc->input_filenames = N_NEW(nfiles + 1, char *);
nfiles = 0;
+ agxbinit(&xb, SMALLBUF, buf);
for (i = 1; i < argc; i++) {
if (argv[i] && argv[i][0] == '-') {
rest = &(argv[i][2]);
case 'G':
if (*rest)
#ifdef WITH_CGRAPH
- global_def(rest, AGRAPH, agattr);
+ global_def(&xb, rest, AGRAPH, agattr);
#else
- global_def(rest, agraphattr);
+ global_def(&xb, rest, agraphattr);
#endif
else {
fprintf(stderr, "Missing argument for -G flag\n");
case 'N':
if (*rest)
#ifdef WITH_CGRAPH
- global_def(rest, AGNODE,agattr);
+ global_def(&xb, rest, AGNODE,agattr);
#else
- global_def(rest, agnodeattr);
+ global_def(&xb, rest, agnodeattr);
#endif
else {
fprintf(stderr, "Missing argument for -N flag\n");
case 'E':
if (*rest)
#ifdef WITH_CGRAPH
- global_def(rest, AGEDGE,agattr);
+ global_def(&xb, rest, AGEDGE,agattr);
#else
- global_def(rest, agedgeattr);
+ global_def(&xb, rest, agedgeattr);
#endif
else {
fprintf(stderr, "Missing argument for -E flag\n");
} else if (argv[i])
gvc->input_filenames[nfiles++] = argv[i];
}
+ agxbfree (&xb);
/* if no -Txxx, then set default format */
if (!gvc->jobs || !gvc->jobs->output_langname) {