/* Create a new graph */
#ifndef WITH_CGRAPH
aginit();
- agsetodisc(gvfwrite, gvferror);
+ agsetiodisc(NULL, gvfwrite, gvferror);
g = agopen("new_graph", AGDIGRAPH);
#else /* WITH_CGRAPH */
g = agopen("new_graph", Agdirected,NIL(Agdisc_t *));
int c;
aginit();
- agsetodisc(gvfwrite, gvferror);
+ agsetiodisc(NULL, gvfwrite, gvferror);
while ((c = getopt(argc, argv, ":ngvum:o:G:?")) != -1) {
switch (c) {
case 'n':
extern void agreadline(int);
extern void agsetfile(char *);
extern Agraph_t *agmemread(char *);
- extern void agsetodisc(
+ extern void agsetiodisc(
+ size_t (*myfread) (void *ptr, size_t size, size_t nmemb, FILE *stream),
size_t (*myfwrite) (const void *ptr, size_t size, size_t nmemb, FILE *stream),
int (*myferror) (FILE *stream) );
extern void agfprintf(FILE *fp, const char *format, ...);
return (_agstrcanon(arg, buf));
}
-void agsetodisc(
+void agsetiodisc(
+ size_t (*myfread) (void *ptr, size_t size, size_t nmemb, FILE *stream),
size_t (*myfwrite) (const void *ptr, size_t size, size_t nmemb, FILE *stream),
int (*myferror) (FILE *stream)
)
{
- AG.fwrite = myfwrite;
+ if (myfread) AG.fread = myfread;
+ if (myfwrite) AG.fwrite = myfwrite;
#if defined(__SUNPRO_C)
#undef ferror
- AG.ferror = myferror;
#endif
+ if (myferror) AG.ferror = myferror;
}
/* agfprintf:
char *linebuf;
short syntax_errors;
unsigned char accepting_state, init_called;
+ size_t (*fread) (void *ptr, size_t size, size_t nmemb, FILE *stream);
size_t (*fwrite) (const void *ptr, size_t size, size_t nmemb, FILE *stream);
int (*ferror) (FILE *stream);
} AG;
#ifndef WITH_CGRAPH
aginit();
- agsetodisc(gvfwrite, gvferror);
+ agsetiodisc(NULL, gvfwrite, gvferror);
agnodeattr(NULL, "label", NODENAME_ESC);
#else
agattr(NULL, AGNODE, "label", NODENAME_ESC);
#ifndef WITH_CGRAPH
aginit();
- agsetodisc(gvfwrite, gvferror);
+ agsetiodisc(NULL, gvfwrite, gvferror);
agnodeattr(NULL, "label", NODENAME_ESC);
#else
agattr(NULL, AGNODE, "label", NODENAME_ESC);
#ifndef WITH_CGRAPH
aginit();
- agsetodisc(gvfwrite, gvferror);
+ agsetiodisc(NULL, gvfwrite, gvferror);
/* set persistent attributes here */
agraphattr(NULL, "label", "");
agraphattr(NULL, "rankdir", "");