Module Name:    src
Committed By:   christos
Date:           Mon Jan 23 03:22:41 UTC 2012

Modified Files:
        src/common/lib/libutil: snprintb.c

Log Message:
also handle the separator after the F field.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libutil/snprintb.c

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

Modified files:

Index: src/common/lib/libutil/snprintb.c
diff -u src/common/lib/libutil/snprintb.c:1.6 src/common/lib/libutil/snprintb.c:1.7
--- src/common/lib/libutil/snprintb.c:1.6	Sun Jan 22 21:34:01 2012
+++ src/common/lib/libutil/snprintb.c	Sun Jan 22 22:22:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: snprintb.c,v 1.6 2012/01/23 02:34:01 christos Exp $	*/
+/*	$NetBSD: snprintb.c,v 1.7 2012/01/23 03:22:41 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #  include <sys/cdefs.h>
 #  if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: snprintb.c,v 1.6 2012/01/23 02:34:01 christos Exp $");
+__RCSID("$NetBSD: snprintb.c,v 1.7 2012/01/23 03:22:41 christos Exp $");
 #  endif
 
 #  include <sys/types.h>
@@ -51,7 +51,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.6 2012/
 #  include <errno.h>
 # else
 #  include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.6 2012/01/23 02:34:01 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.7 2012/01/23 03:22:41 christos Exp $");
 #  include <sys/param.h>
 #  include <sys/inttypes.h>
 #  include <sys/systm.h>
@@ -137,7 +137,7 @@ snprintb_m(char *buf, size_t buflen, con
 			STORE('<');					\
 		} else {						\
 			/* Remember separator location */		\
-			if ( l_max > 0 && sep != '<') {			\
+			if (l_max > 0 && sep != '<') {			\
 				s_len = l_len;				\
 				s_bp  = bp;				\
 				s_fmt = cur_fmt;			\
@@ -210,13 +210,12 @@ snprintb_m(char *buf, size_t buflen, con
 				field = (val >> bit) &
 					    (((uint64_t)1 << f_len) - 1);
 				PUTSEP;
+				if (restart == 0)
+					sep = ',';
 				if (ch == 'F')	/* just extract */
 					break;
 				if (restart == 0) {
-					sep = ',';
 					PUTS(bitfmt);
-				}
-				if (restart == 0) {
 					PUTCHR('=');
 				}
 				if (restart == 0) {

Reply via email to