Subject: pkg/12201: xfstt and --notcp
To: None <gnats-bugs@gnats.netbsd.org>
From: None <martti.kuparinen@iki.fi>
List: netbsd-bugs
Date: 02/14/2001 13:06:04
>Number:         12201
>Category:       pkg
>Synopsis:       xfstt and --notcp
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 14 03:07:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Martti Kuparinen
>Release:        NetBSD 1.5 with up-to-date /usr/pkgsrc
>Organization:
piuha.net
>Environment:
System: NetBSD ws220 1.5 NetBSD 1.5 (WS21) #0: Tue Feb 13 18:36:34 EET 2001 root@ws220:/usr/src/sys/arch/i386/compile/WS21 i386

>Description:

I have ported (from FreeBSD) support for the --notcp flag in xfstt.
To apply this patch:

	1) cd /usr/pkgsrc/x11/xfstt
	2) patch < xfstt.diff
	3) make makepatchsum
	4) commit the changes

>How-To-Repeat:
	
>Fix:

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/x11/xfstt/Makefile,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Makefile
--- Makefile	2000/09/04 15:49:36	1.1.1.1
+++ Makefile	2001/02/14 10:44:51
@@ -2,6 +2,7 @@
 #
 
 DISTNAME=		xfstt-1.1
+PKGNAME=		${DISTNAME}nb1
 CATEGORIES=		x11 net
 MASTER_SITES=		${MASTER_SITE_SUNSITE:=X11/fonts/}
 
@@ -27,5 +28,9 @@
 	${INSTALL_DATA} ${WRKSRC}/CHANGES ${PREFIX}/share/doc/xfstt
 	${INSTALL_DATA} ${WRKSRC}/INSTALL ${PREFIX}/share/doc/xfstt
 	${INSTALL_DATA} ${WRKSRC}/THANKS.txt ${PREFIX}/share/doc/xfstt
+	${SED} -e "/%%PREFIX%%/s##${PREFIX}#g" ${FILESDIR}/xfstt.sh \
+		> ${PREFIX}/etc/rc.d/xfstt.sh
+	${CHMOD} 755 ${PREFIX}/etc/rc.d/xfstt.sh
+	$(MKDIR) $(PREFIX)/lib/X11/fonts/TrueType
 
 .include "../../mk/bsd.pkg.mk"
Index: patches/patch-ad
===================================================================
RCS file: /cvsroot/pkgsrc/x11/xfstt/patches/patch-ad,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 patch-ad
--- patch-ad	2000/09/04 15:49:36	1.1.1.1
+++ patch-ad	2001/02/14 10:44:51
@@ -1,19 +1,33 @@
-$NetBSD: patch-ad,v 1.1.1.1 2000/09/04 15:49:36 kim Exp $
-
---- xfstt.cpp.orig	Sat Dec 11 13:23:45 1999
-+++ xfstt.cpp	Sun Sep  3 09:32:56 2000
+--- xfstt.cpp.orig	Sat Dec 11 19:23:45 1999
++++ xfstt.cpp	Sat Nov 18 15:57:30 2000
 @@ -11,8 +11,8 @@
  #define UNSTRAPLIMIT	10500U
  
  // Change these if you don't lie being FHS complient
 -#define TTFONTDIR	"/usr/share/fonts/truetype"
 -#define TTCACHEDIR      "/var/cache/xfstt"
-+#define TTFONTDIR       "@X11BASE@/lib/X11/fonts/TrueType"
-+#define TTCACHEDIR      "@X11BASE@/lib/X11/fonts/TrueType"
++#define TTFONTDIR       "/usr/X11R6/lib/X11/fonts/TrueType"
++#define TTCACHEDIR      "/usr/X11R6/lib/X11/fonts/TrueType"
  
  #define TTINFO_LEAF     "ttinfo.dir"
  #define TTNAME_LEAF     "ttname.dir"
-@@ -470,10 +470,12 @@
+@@ -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);
+@@ -95,6 +96,7 @@
+ 	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");
+@@ -470,10 +472,12 @@
  	raster->getFontExtent( &xfs->fe);
  
  	int used = (xfs->fe.bitmaps + xfs->fe.bmplen) - xfs->fe.buffer;
@@ -28,3 +42,40 @@
  		xfs->fid = 0;	//###
  		xfs = 0;
  	}
+@@ -652,7 +656,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);
+
+@@ -668,7 +672,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);
+
+@@ -676,7 +681,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);
+
+@@ -1604,6 +1609,8 @@
+ 			inetdConnection = 1;
+ 		} else if( !strcmp( argv[i], "--multi")) {
+ 			multiConnection = 1;
++		} else if( !strcmp( argv[i], "--notcp")) {
++			NoTCP = 1;
+ 		} else if( !strcmp( argv[i], "--once")) {
+ 			multiConnection = 0;
+ 		} else if( !strcmp( argv[i], "--unstrap")) {

--- /dev/null	Wed Feb 14 12:43:59 2001
+++ patches/patch-ae	Wed Feb 14 12:42:25 2001
@@ -0,0 +1,25 @@
+--- xfstt.1x.orig	Tue Jul 13 05:07:15 1999
++++ xfstt.1x	Sat Nov 18 16:08:20 2000
+@@ -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]
+@@ -43,9 +43,12 @@
+ 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.
+-The default is --dir /usr/share/fonts/truetype.
++The default is --dir /usr/X11R6/lib/X11/fonts/TrueType.
+ .TP
+ .I "\-\-res value"
+ Force the resolution for underspecified fonts to value (typically 96 or 120).

--- /dev/null	Wed Feb 14 12:45:45 2001
+++ files/xfstt.sh	Wed Feb 14 12:33:51 2001
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+PREFIX=%%PREFIX%%
+
+case "$1" in
+
+start)
+	${PREFIX}/bin/xfstt --sync >/dev/null
+	${PREFIX}/bin/xfstt --user nobody --notcp --daemon && echo -n ' xfstt'
+	;;
+stop)
+	/usr/bin/killall xfstt 2>/dev/null && echo -n ' xfstt'
+	;;
+*)
+	echo "$0 start | stop"
+	;;
+
+esac
>Release-Note:
>Audit-Trail:
>Unformatted: