From johans@stack.nl  Tue Sep 13 19:18:10 2005
Return-Path: <johans@stack.nl>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id B264C16A41F
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 13 Sep 2005 19:18:10 +0000 (GMT)
	(envelope-from johans@stack.nl)
Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 1FB9343D46
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 13 Sep 2005 19:18:09 +0000 (GMT)
	(envelope-from johans@stack.nl)
Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153])
	by mailhost.stack.nl (Postfix) with ESMTP id 0E82DA3021
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 13 Sep 2005 21:18:08 +0200 (CEST)
Received: by hammer.stack.nl (Postfix, from userid 801)
	id EFAA36155; Tue, 13 Sep 2005 21:18:07 +0200 (CEST)
Message-Id: <20050913191807.EFAA36155@hammer.stack.nl>
Date: Tue, 13 Sep 2005 21:18:07 +0200 (CEST)
From: Johan van Selst <johans@stack.nl>
Reply-To: Johan van Selst <johans@stack.nl>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: dns/totd: unbreak on !i386 systems
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         86091
>Category:       ports
>Synopsis:       dns/totd: unbreak on !i386 systems
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 13 19:20:07 GMT 2005
>Closed-Date:    Wed Sep 14 23:34:55 GMT 2005
>Last-Modified:  Wed Sep 14 23:34:55 GMT 2005
>Originator:     Johan van Selst
>Release:        FreeBSD 6.0-BETA4 amd64
>Organization:
>Environment:
System: FreeBSD hammer.stack.nl 6.0-BETA4 FreeBSD 6.0-BETA4 #2: Fri Sep 9 18:52:55 CEST 2005 root@hammer.stack.nl:/usr/obj/usr/src/sys/HAMMER amd64


	
>Description:
	Remove careless 's/%zd/%d/g' hack.

	Use %zd for size_t, %td for ptrdiff_t and %d for decimals.
	Unfortunately this breaks compilation on i386 4.x systems
	(where sprintf doesn't know these modifiers)

	
>How-To-Repeat:
	
>Fix:

	


diff -uNr totd/Makefile totd/Makefile
--- totd/Makefile	Mon Sep  5 13:04:05 2005
+++ totd/Makefile	Tue Sep 13 21:11:18 2005
@@ -22,12 +22,9 @@
 
 .include <bsd.port.pre.mk>
 
-.if ${ARCH} != "i386"
-BROKEN=		"Does not compile on !i386"
+.if ${OSVERSION} < 500000
+IGNORE=		"Only for 5.0 and above"
 .endif
-
-post-patch:
-	@${REINPLACE_CMD} -e 's/%zd/%d/g' ${WRKSRC}/*.c
 
 post-install:
 	${INSTALL_DATA} ${FILESDIR}/totd.conf.sample ${PREFIX}/etc
diff -uNr totd/files/patch-ne_mesg.c totd/files/patch-ne_mesg.c
--- totd/files/patch-ne_mesg.c	Thu Jan  1 01:00:00 1970
+++ totd/files/patch-ne_mesg.c	Tue Sep 13 21:03:17 2005
@@ -0,0 +1,36 @@
+--- ne_mesg.c.orig	Mon Jul  4 11:09:22 2005
++++ ne_mesg.c	Tue Sep 13 21:02:57 2005
+@@ -59,7 +59,7 @@
+ 
+ 	/* write qname */
+ 	if (T.debug > 4)
+-		syslog (LOG_DEBUG, "%s: qname offset = %zd", fn, ucp - buf);
++		syslog (LOG_DEBUG, "%s: qname offset = %td", fn, ucp - buf);
+ 
+ 	i = dname_copy (qname, ucp, buflen - written_len);
+ 	if (i < 0)
+@@ -70,7 +70,7 @@
+ 
+ 	/* write qtype / qclass */
+ 	if (T.debug > 4)
+-		syslog (LOG_DEBUG, "%s: qtype/qclass offset = %zd",
++		syslog (LOG_DEBUG, "%s: qtype/qclass offset = %td",
+ 			fn, ucp - buf);
+ 
+ 	written_len += sizeof (uint16_t) * 2;
+@@ -226,13 +226,13 @@
+ 			*cnt = htons (us);
+ 
+ 			if (T.debug > 4)
+-				syslog (LOG_DEBUG, "%s: now counter = %zd",
++				syslog (LOG_DEBUG, "%s: now counter = %u",
+ 					fn, us);
+ 		}
+ 	}
+ 
+ 	if (T.debug > 4)
+-		syslog (LOG_DEBUG, "%s: return %d", fn, *wp - wp_start);
++		syslog (LOG_DEBUG, "%s: return %td", fn, *wp - wp_start);
+ 
+ 	return (*wp - wp_start);
+ }
diff -uNr totd/files/patch-ne_mesg.c.orig totd/files/patch-ne_mesg.c.orig
--- totd/files/patch-ne_mesg.c.orig	Thu Jan  1 01:00:00 1970
+++ totd/files/patch-ne_mesg.c.orig	Tue Sep 13 21:00:17 2005
@@ -0,0 +1,29 @@
+--- ne_mesg.c.orig	Tue Sep 13 20:54:18 2005
++++ ne_mesg.c	Tue Sep 13 20:54:38 2005
+@@ -59,7 +59,7 @@ int mesg_make_query (u_char *qname, uint
+ 
+ 	/* write qname */
+ 	if (T.debug > 4)
+-		syslog (LOG_DEBUG, "%s: qname offset = %zd", fn, ucp - buf);
++		syslog (LOG_DEBUG, "%s: qname offset = %td", fn, ucp - buf);
+ 
+ 	i = dname_copy (qname, ucp, buflen - written_len);
+ 	if (i < 0)
+@@ -70,7 +70,7 @@ int mesg_make_query (u_char *qname, uint
+ 
+ 	/* write qtype / qclass */
+ 	if (T.debug > 4)
+-		syslog (LOG_DEBUG, "%s: qtype/qclass offset = %zd",
++		syslog (LOG_DEBUG, "%s: qtype/qclass offset = %td",
+ 			fn, ucp - buf);
+ 
+ 	written_len += sizeof (uint16_t) * 2;
+@@ -232,7 +232,7 @@ int mesg_write_rrset_list (G_List *rrls,
+ 	}
+ 
+ 	if (T.debug > 4)
+-		syslog (LOG_DEBUG, "%s: return %d", fn, *wp - wp_start);
++		syslog (LOG_DEBUG, "%s: return %td", fn, *wp - wp_start);
+ 
+ 	return (*wp - wp_start);
+ }
diff -uNr totd/files/patch-tcp_response.c totd/files/patch-tcp_response.c
--- totd/files/patch-tcp_response.c	Thu Jan  1 01:00:00 1970
+++ totd/files/patch-tcp_response.c	Tue Sep 13 21:03:07 2005
@@ -0,0 +1,11 @@
+--- tcp_response.c.orig	Mon Jul  4 11:09:22 2005
++++ tcp_response.c	Tue Sep 13 21:00:53 2005
+@@ -110,7 +110,7 @@
+ 
+ 	cont->wp += len;
+ 	if (cont->wp < (cont->mesg.p + cont->mesg_len)) {
+-		syslog (LOG_DEBUG, "%s: left %zd bytes -- continue.", fn,
++		syslog (LOG_DEBUG, "%s: left %td bytes -- continue.", fn,
+ 			(cont->mesg.p + cont->mesg_len) - cont->wp);
+ 
+ 		/* SUCCESS */
diff -uNr totd/files/patch-tcp_response.c.orig totd/files/patch-tcp_response.c.orig
--- totd/files/patch-tcp_response.c.orig	Thu Jan  1 01:00:00 1970
+++ totd/files/patch-tcp_response.c.orig	Tue Sep 13 21:00:44 2005
@@ -0,0 +1,11 @@
+--- tcp_response.c.orig	Tue Sep 13 20:54:54 2005
++++ tcp_response.c	Tue Sep 13 20:55:02 2005
+@@ -110,7 +110,7 @@ int tcp_response_reading_process (Contex
+ 
+ 	cont->wp += len;
+ 	if (cont->wp < (cont->mesg.p + cont->mesg_len)) {
+-		syslog (LOG_DEBUG, "%s: left %zd bytes -- continue.", fn,
++		syslog (LOG_DEBUG, "%s: left %td bytes -- continue.", fn,
+ 			(cont->mesg.p + cont->mesg_len) - cont->wp);
+ 
+ 		/* SUCCESS */
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: pav 
State-Changed-When: Wed Sep 14 23:34:35 GMT 2005 
State-Changed-Why:  
Committed with modification: I kept it going on 4.X by applying your patches 
conditionally on OSVERSION 

http://www.freebsd.org/cgi/query-pr.cgi?pr=86091 
>Unformatted:
