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