From owner-freebsd-audit Mon May 27 17:16:19 2002 Delivered-To: freebsd-audit@freebsd.org Received: from turbine.trit.org (turbine.trit.org [63.198.170.141]) by hub.freebsd.org (Postfix) with ESMTP id 4876D37B404 for ; Mon, 27 May 2002 17:16:16 -0700 (PDT) Received: from turbine.trit.org (localhost [127.0.0.1]) by turbine.trit.org (Postfix) with ESMTP id 4BAC93E5E; Tue, 28 May 2002 00:16:15 +0000 (UTC) To: Dag-Erling Smorgrav Cc: audit@freebsd.org Subject: Re: %j for printf(9) In-Reply-To: ; from des@ofug.org on "25 May 2002 15:29:11 +0200" Date: Tue, 28 May 2002 00:16:14 +0000 From: Dima Dorfman Message-Id: <20020528001615.4BAC93E5E@turbine.trit.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Dag-Erling Smorgrav wrote: > Dima Dorfman writes: > > Attached is a patch that implements the %j length modifier in > > printf(9). > > Here's an alternative (IMHO less disruptive) patch, which also fixes > the default case. I still like my restructure, but since other people don't seem to share my opinion, I'm fine doing it another (your) way. That said, I think your patch has some bugs that mine doesn't. For example, this: printf("%ld\n", -4); yields "4294967292" with your patch, but not with mine (mine, and printf(3), yield "-4"). I think the attached patch (relative to subr_prf.c *with* your patch applied) fixes it. Thanks. --- subr_prf_des.c Mon May 27 23:55:45 2002 +++ subr_prf.c Tue May 28 00:09:30 2002 @@ -658,19 +658,19 @@ if (jflag) num = va_arg(ap, uintmax_t); else if (qflag) - num = va_arg(ap, u_quad_t); + num = (u_quad_t)va_arg(ap, u_quad_t); else if (lflag) - num = va_arg(ap, u_long); + num = (u_long)va_arg(ap, u_long); else - num = va_arg(ap, u_int); + num = (u_int)va_arg(ap, u_int); goto nosign; fetch_number: if (jflag) - num = va_arg(ap, uintmax_t); + num = va_arg(ap, intmax_t); else if (qflag) - num = va_arg(ap, u_quad_t); + num = (quad_t)va_arg(ap, quad_t); else if (lflag) - num = va_arg(ap, u_long); + num = (long)va_arg(ap, long); else num = sign ? (uintmax_t)va_arg(ap, int) : va_arg(ap, u_int); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message