+
+/* quick and ugly hack to be able to read
+ ppd files with Mac line ending */
+static char* my_fgets(buf, bufsize, stream)
+ char *buf;
+ size_t bufsize;
+ FILE *stream;
+{
+ int p; /* uninitialized, OK 310105 */
+ size_t count = 0;
+
+ while (count < (bufsize - 1) && EOF != (p=fgetc(stream))) {
+ buf[count] = p;
+ count++;
+ if ( p == '\r' || p == '\n')
+ break;
+ }
+
+ if (p == EOF && count == 0)
+ return NULL;
+
+ /* translate line endings */
+ if ( buf[count - 1] == '\r')
+ buf[count - 1] = '\n';
+
+ buf[count] = 0;
+ return buf;
+}
+
+static struct ppdent *getppdent( stream )