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