From owner-svn-src-head@freebsd.org  Wed Jun  1 16:11:10 2016
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8AC49B614E6;
 Wed,  1 Jun 2016 16:11:10 +0000 (UTC) (envelope-from cem@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 5AD2019E7;
 Wed,  1 Jun 2016 16:11:10 +0000 (UTC) (envelope-from cem@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u51GB9hn024920;
 Wed, 1 Jun 2016 16:11:09 GMT (envelope-from cem@FreeBSD.org)
Received: (from cem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id u51GB9uY024919;
 Wed, 1 Jun 2016 16:11:09 GMT (envelope-from cem@FreeBSD.org)
Message-Id: <201606011611.u51GB9uY024919@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org
 using -f
From: "Conrad E. Meyer" <cem@FreeBSD.org>
Date: Wed, 1 Jun 2016 16:11:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r301135 - head/lib/libthr/thread
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 01 Jun 2016 16:11:10 -0000

Author: cem
Date: Wed Jun  1 16:11:09 2016
New Revision: 301135
URL: https://svnweb.freebsd.org/changeset/base/301135

Log:
  libthr: _thread_vprintf: Enhance support for %p, %#x
  
  No functional change.  No ABI change.
  
  Reviewed by:	kib
  Sponsored by:	EMC / Isilon Storage Division
  Differential Revision:	https://reviews.freebsd.org/D6672

Modified:
  head/lib/libthr/thread/thr_printf.c

Modified: head/lib/libthr/thread/thr_printf.c
==============================================================================
--- head/lib/libthr/thread/thr_printf.c	Wed Jun  1 16:09:56 2016	(r301134)
+++ head/lib/libthr/thread/thr_printf.c	Wed Jun  1 16:11:09 2016	(r301135)
@@ -68,15 +68,19 @@ _thread_vprintf(int fd, const char *fmt,
 	unsigned long r, u;
 	int c;
 	long d;
-	int islong;
+	int islong, isalt;
 
 	while ((c = *fmt++)) {
+		isalt = 0;
 		islong = 0;
 		if (c == '%') {
 next:			c = *fmt++;
 			if (c == '\0')
 				return;
 			switch (c) {
+			case '#':
+				isalt = 1;
+				goto next;
 			case 'c':
 				pchar(fd, va_arg(ap, int));
 				continue;
@@ -87,10 +91,13 @@ next:			c = *fmt++;
 				islong = 1;
 				goto next;
 			case 'p':
+				pstr(fd, "0x");
 				islong = 1;
 			case 'd':
 			case 'u':
 			case 'x':
+				if (c == 'x' && isalt)
+					pstr(fd, "0x");
 				r = ((c == 'u') || (c == 'd')) ? 10 : 16;
 				if (c == 'd') {
 					if (islong)