Package: xfstt
Version: 1.2.1
Author: Guillem Jover <guillem@hadrons.org>
Status: applied
Description:
 Added --notcp support.

diff -ur xfstt-1.2.1/debian/init.d xfstt-1.2.1-patched/debian/init.d
--- xfstt-1.2.1/debian/init.d	Wed Apr 14 02:51:26 1999
+++ xfstt-1.2.1-patched/debian/init.d	Sun Jun  2 20:50:55 2002
@@ -15,7 +15,7 @@
 newuser=nobody
 daemon="--daemon"
 
-ARGS="--port $portno $daemon --user $newuser"
+ARGS="--port $portno $daemon --user $newuser --notcp"
 
 
 test -x "$XFSTT" || exit 0
diff -ur xfstt-1.2.1/xfstt.1x xfstt-1.2.1-patched/xfstt.1x
--- xfstt-1.2.1/xfstt.1x	Tue Jul 13 05:07:15 1999
+++ xfstt-1.2.1-patched/xfstt.1x	Sun Jun  2 20:46:20 2002
@@ -3,7 +3,7 @@
 xfstt \- X11 font server for *ttf fonts
 .SH SYNOPSIS
 .B xfstt
-[--port n] [--dir dirname] [--unstrap]
+[--port n] [--notcp] [--dir dirname] [--unstrap]
 [--multi] [--once] [--user username]
 [[--gslist] --sync]
 [--res resolution] [--encoding list]
@@ -42,6 +42,9 @@
 .I "\-\-port number"
 Change the port number for xfstt's font services.
 This version of Xfstt defaults to --port 7101.
+.TP
+.I "\-\-notcp"
+Don't open TCP socket, use unix domain only.
 .TP
 .I "\-\-dir name"
 Change xfstt's font directory.
diff -ur xfstt-1.2.1/xfstt.cpp xfstt-1.2.1-patched/xfstt.cpp
--- xfstt-1.2.1/xfstt.cpp	Fri Mar 23 03:35:27 2001
+++ xfstt-1.2.1-patched/xfstt.cpp	Sun Jun  2 23:06:04 2002
@@ -73,6 +73,7 @@
 char* fontdir = TTFONTDIR;
 char* cachedir = TTCACHEDIR;
 int defaultres = 0;
+int noTCP = 0;
 
 uid_t newuid = (uid_t)(-2);
 gid_t newgid = (uid_t)(-2);
@@ -88,19 +89,22 @@
 	printf( "Xfstt 1.1, X font server for TT fonts\n");
 	printf( "Usage: xfstt [[--gslist]--sync][--port portno][--unstrap]"
 		"[--user username]\n"
-		"\t\t[--dir ttfdir][--encoding list_of_encodings]"
-		"[--daemon][--inetd]\n\n");
+		"\t\t[--dir ttfdir][--cache ttfcachedir]\n"
+		"\t\t[--encoding list_of_encodings][--res resolution]\n"
+		"\t\t[--notcp][--daemon][--inetd]\n\n");
 	if( !verbose)
 		return;
 	printf( "\t--sync     put ttf-fonts in \"%s\" in database\n", fontdir);
 	printf( "\t--gslist   print ghostscript style ttf fontlist\n ");
 	printf( "\t--port     change port number from default 7101\n");
+	printf( "\t--notcp    don't open TCP socket, use unix domain only\n");
 	printf( "\t--dir      use other font directory than "TTFONTDIR"\n");
 	printf( "\t--cache    use other font cache directory than "TTCACHEDIR"\n");
 	printf( "\t--res      force default resolution to this value\n");
 	printf( "\t--encoding use encodings other than iso8859-1\n");
 	printf( "\t--unstrap  !DANGER! serve all unicodes !DANGER!\n");
 	printf( "\t--user     Username that children should run as\n");
+	printf( "\t--once     exit after the font client disconnects\n");
 	printf( "\t--daemon   run in the background\n");
 	printf( "\t--inetd    run as inetd service\n");
 	printf( "\n\tattach to X Server by \"xset fp+ unix/:7101\"\n");
@@ -654,7 +658,7 @@
 		listen( sd_unix, 1);	// only one connection
 	}
 
-	if( !sd_inet) {
+	if( !noTCP && !sd_inet) {
 		// prepare inet connection
 		sd_inet = socket( PF_INET, SOCK_STREAM, IPPROTO_TCP);
 
@@ -662,7 +666,8 @@
 		s_inet.sin_port		= htons( portno);
 		s_inet.sin_addr.s_addr	= htonl( INADDR_ANY);
 		if( bind( sd_inet,(struct sockaddr*)&s_inet, sizeof(s_inet))) {
-			fprintf( stderr, "Cannot open TCPIP port %d\n", portno);			fprintf( stderr, "Better try another port!\n");
+			fprintf( stderr, "Cannot open TCPIP port %d\n", portno);
+			fprintf( stderr, "Better try another port!\n");
 		}
 		listen( sd_inet, 1);	// only one connection
 	}
@@ -670,7 +675,8 @@
 	fd_set sdlist;
 	FD_ZERO( &sdlist);
 	FD_SET( sd_unix, &sdlist);
-	FD_SET( sd_inet, &sdlist);
+	if( !noTCP )
+		FD_SET( sd_inet, &sdlist);
 	int maxsd = (sd_inet > sd_unix) ? sd_inet : sd_unix;
 	select( maxsd+1, &sdlist, 0L, 0L, 0L);
 
@@ -678,7 +684,7 @@
 	unsigned int saLength = sizeof(struct sockaddr);
 	if( FD_ISSET( sd_unix, &sdlist))
 		sd = accept( sd_unix, (struct sockaddr*)&s_unix, &saLength);
-	else if( FD_ISSET( sd_inet, &sdlist))
+	else if( !noTCP && FD_ISSET( sd_inet, &sdlist))
 		sd = accept( sd_inet, (struct sockaddr*)&s_inet, &saLength);
 	dprintf2( "accept( saLength = %d) = %d\n", saLength, sd);
 
@@ -1577,6 +1583,8 @@
 				fputs( "Illegal port number!\n", stderr);
 				portno = 7101;
 			}
+		} else if( !strcmp( argv[i], "--notcp")) {
+			noTCP = 1;
 		} else if( !strcmp( argv[i], "--res")) {
 			if( i <= argc)
 				defaultres = xatoi( argv[++i]);
