+ exit(n);
+}
+
+putplot()
+{
+ register char *cp;
+ register int bytes, n;
+
+ cp = buf;
+ bytes = 0;
+ ioctl(OUT, VSETSTATE, plotmd);
+ while ((n = read(IN, cp, sizeof(buf))) > 0) {
+ if (write(OUT, cp, n) != n)
+ return(1);
+ bytes += n;
+ }
+ /*
+ * Make sure we send complete raster lines.
+ */
+ if ((n = bytes % BYTES_PER_LINE) > 0) {
+ n = BYTES_PER_LINE - n;
+ for (cp = &buf[n]; cp > buf; )
+ *--cp = 0;
+ if (write(OUT, cp, n) != n)
+ return(1);
+ bytes += n;
+ }
+ lines += bytes / BYTES_PER_LINE;
+ return(0);