Module Name:    src
Committed By:   christos
Date:           Thu Feb 24 14:33:23 UTC 2011

Modified Files:
        src/dist/ipf/tools: ipmon.c

Log Message:
define the format as a constant so that we don't break if sprintf is a macro.
XXX: make it so that sprintf is not a macro.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/dist/ipf/tools/ipmon.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/dist/ipf/tools/ipmon.c
diff -u src/dist/ipf/tools/ipmon.c:1.16 src/dist/ipf/tools/ipmon.c:1.17
--- src/dist/ipf/tools/ipmon.c:1.16	Wed Aug 19 04:35:32 2009
+++ src/dist/ipf/tools/ipmon.c	Thu Feb 24 09:33:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipmon.c,v 1.16 2009/08/19 08:35:32 darrenr Exp $	*/
+/*	$NetBSD: ipmon.c,v 1.17 2011/02/24 14:33:23 christos Exp $	*/
 
 /*
  * Copyright (C) 2001-2006 by Darren Reed.
@@ -904,7 +904,7 @@
 		t += strlen(t);
 	}
 	if (sl->isl_type != ISL_NEW) {
-		sprintf(t,
+		static const char fmt[] =
 #ifdef	USE_QUAD_T
 #ifdef	PRId64
 			" Forward: Pkts in %" PRId64 " Bytes in %" PRId64
@@ -912,11 +912,12 @@
 			" Backward: Pkts in %" PRId64 " Bytes in %" PRId64
 			" Pkts out %" PRId64 " Bytes out %" PRId64,
 #else
-			" Forward: Pkts in %qd Bytes in %qd Pkts out %qd Bytes out %qd Backward: Pkts in %qd Bytes in %qd Pkts out %qd Bytes out %qd",
+			" Forward: Pkts in %qd Bytes in %qd Pkts out %qd Bytes out %qd Backward: Pkts in %qd Bytes in %qd Pkts out %qd Bytes out %qd";
 #endif /* PRId64 */
 #else
-			" Forward: Pkts in %ld Bytes in %ld Pkts out %ld Bytes out %ld Backward: Pkts in %ld Bytes in %ld Pkts out %ld Bytes out %ld",
+			" Forward: Pkts in %ld Bytes in %ld Pkts out %ld Bytes out %ld Backward: Pkts in %ld Bytes in %ld Pkts out %ld Bytes out %ld";
 #endif
+		sprintf(t, fmt,
 			sl->isl_pkts[0], sl->isl_bytes[0],
 			sl->isl_pkts[1], sl->isl_bytes[1],
 			sl->isl_pkts[2], sl->isl_bytes[2],

Reply via email to