459803
--- ttmkfdir-3.0.9/encoding.cpp	2002-12-09 03:52:48.000000000 -0500
459803
+++ ttmkfdir-3.0.9/encoding.cpp	2003-09-12 12:32:29.000000000 -0400
459803
@@ -2,6 +2,8 @@
459803
 #include <cstdio>
459803
 #include <cstdlib>
459803
 #include <cstring>
459803
+#include <unistd.h>
459803
+#include <zlib.h>
459803
 #include "freetype/freetype.h"
459803
 
459803
 #include "ttmkfdir.h"
459803
@@ -32,9 +34,16 @@
459803
     NextFile (FILE *f, char *name)
459803
     {
459803
 	char file_name [1024];
459803
-	char command[1024];
459803
+	char line_buf [1024];
459803
+	char tmp_file_name[] = "/tmp/ttmkfdir_XXXXXX";
459803
+	char inbuf[300000];
459803
+	FILE *od;
459803
+	gzFile fd;
459803
+	int rvalue, tmpfd;
459803
 
459803
-	if (fscanf (f, "%*s %[^\n]\n", file_name) == 1) {
459803
+	if (fgets (line_buf, sizeof(line_buf), f) != NULL) {
459803
+
459803
+	    sscanf (line_buf, "%*s %[^\n]\n", file_name);
459803
 
459803
 	    if (file_name[0] == '/') {
459803
 		name[0] = 0;
459803
@@ -44,9 +53,25 @@
459803
 	
459803
 	    strcat (name, file_name);
459803
 
459803
-	    sprintf (command, "exec %s < %s", (toupper(name[strlen (name) - 1]) == 'Z')
459803
-		     ? "gzip -d" : "cat", name);
459803
-	    return popen (command, "r");
459803
+	    bzero(inbuf, sizeof(inbuf));
459803
+
459803
+	    fd = gzopen (name,"rb");
459803
+	    rvalue = gzread (fd, inbuf, sizeof(inbuf));
459803
+
459803
+	    tmpfd = mkstemp (tmp_file_name);
459803
+	    if (tmpfd == -1) {
459803
+		return 0;
459803
+	    }
459803
+
459803
+	    od = fdopen (tmpfd,"w");
459803
+	    fputs (inbuf, od);
459803
+	    fflush (od);
459803
+	    fclose (od);
459803
+
459803
+	    od = fopen (tmp_file_name,"r");
459803
+	    unlink (tmp_file_name);
459803
+	    return od;
459803
+
459803
 	}
459803
 
459803
 	return 0;
459803
@@ -75,7 +100,7 @@
459803
 	yyrestart (input);
459803
 	yylex (name, *this);
459803
 
459803
-	pclose (input);
459803
+	fclose (input);
459803
     }
459803
 
459803
     fclose (f);
459803
diff -uNr ttmkfdir-3.0.9.orig/Makefile ttmkfdir-3.0.9/Makefile
459803
--- ttmkfdir-3.0.9.orig/Makefile	2003-08-21 17:43:13.000000000 +1000
459803
+++ ttmkfdir-3.0.9/Makefile	2003-08-21 17:40:16.000000000 +1000
459803
@@ -28,7 +28,7 @@
459803
 DEBUG=-ggdb
459803
 CXX=g++
459803
 CXXFLAGS=-Wall -pedantic $(FREETYPE_INCL) $(DEBUG) $(OPTFLAGS)
459803
-LDFLAGS=$(FREETYPE_LIB) $(DEBUG)
459803
+LDFLAGS=$(FREETYPE_LIB) $(DEBUG) -lz
459803
 
459803
 DESTDIR=
459803
 PREFIX=/usr