and have cgraph use FILE* for reading.
static int iofread(void *chan, char *buf, int bufsize)
{
- return read(fileno((FILE *) chan), buf, bufsize);
+ if (fgets(buf, bufsize, (FILE*)chan))
+ return strlen(buf);
+ else
+ return 0;
+ /* return read(fileno((FILE *) chan), buf, bufsize); */
/* return fread(buf, 1, bufsize, (FILE*)chan); */
}
#include <fcntl.h>
#endif
+#if 0
#ifdef WITH_CGRAPH
#include <poll.h>
#endif
+#endif
#include "gvplugin_device.h"
{
int rc=0;
-#ifndef WITH_CGRAPH
if (feof(stdin))
return -1;
-#else
- struct pollfd ufds[2];
- int r;
- ufds[0].fd = stdin_fd;
- ufds[0].events = POLLIN;
- ufds[0].revents = 0;
- r = poll(ufds,1,0);
- if (ufds[0].revents & POLLIN) return -1;
- /* Beware of bugs in the above code; I have only proved it correct, not tried it. */
-#endif
(job->callbacks->read)(job, job->input_filename, job->layout_type);
rc++;