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