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