From owner-freebsd-hackers@FreeBSD.ORG Sun Oct 17 14:43:46 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6F07616A4CE for ; Sun, 17 Oct 2004 14:43:46 +0000 (GMT) Received: from gandalf.online.bg (gandalf.online.bg [217.75.128.9]) by mx1.FreeBSD.org (Postfix) with SMTP id C3EAB43D58 for ; Sun, 17 Oct 2004 14:43:44 +0000 (GMT) (envelope-from roam@ringlet.net) Received: (qmail 15577 invoked from network); 17 Oct 2004 14:43:37 -0000 Received: from unknown (HELO straylight.m.ringlet.net) (217.75.135.134) by gandalf.online.bg with SMTP; 17 Oct 2004 14:43:37 -0000 Received: (qmail 18530 invoked by uid 1000); 17 Oct 2004 14:43:53 -0000 Date: Sun, 17 Oct 2004 17:43:53 +0300 From: Peter Pentchev To: Xin LI Message-ID: <20041017144353.GA4639@straylight.m.ringlet.net> Mail-Followup-To: Xin LI , freebsd-hackers@FreeBSD.org References: <20041016172302.GA2764@frontfree.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EVF5PPMfhYS0aIcm" Content-Disposition: inline In-Reply-To: <20041016172302.GA2764@frontfree.net> User-Agent: Mutt/1.5.6i cc: freebsd-hackers@FreeBSD.org Subject: Re: [PATCH] add '-' glibc extension to strftime(3) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Oct 2004 14:43:46 -0000 --EVF5PPMfhYS0aIcm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Oct 17, 2004 at 01:23:02AM +0800, Xin LI wrote: > Hi, folks, >=20 > It turns out that the GNU extension '-' in their strftime(3) implementati= on > is somewhat popular in several applications. The patch in the last part = of > this e-mail will add a simulate implementation for it. Thanks for taking this up! Just a couple of comments further down... > My question is: > (1) Am I doing things cleanly and correctly? I have attempted to > keep the code style consistent with the old one and style(9) > but maybe I have missed something else, or did not do it > sufficently? > (2) Is the way of implementing it clean enough? >=20 > Thanks for any comments! >=20 > Index: strftime.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /home/fcvs/src/lib/libc/stdtime/strftime.3,v > retrieving revision 1.34 > diff -u -r1.34 strftime.3 > --- strftime.3 2 Jul 2004 23:52:12 -0000 1.34 > +++ strftime.3 16 Oct 2004 17:13:08 -0000 > @@ -36,7 +36,7 @@ > .\" @(#)strftime.3 8.1 (Berkeley) 6/4/93 > .\" $FreeBSD: src/lib/libc/stdtime/strftime.3,v 1.34 2004/07/02 23:52:12= ru Exp $ > .\" > -.Dd January 4, 2003 > +.Dd October 17, 2004 > .Dt STRFTIME 3 > .Os > .Sh NAME > @@ -216,6 +216,8 @@ > is replaced by national representation of the date and time > (the format is similar to that produced by > .Xr date 1 ) . > +.It Cm %-* > +GLIBC extensions. Do not do padding when making output. In mdoc manual pages, it is customary to start new sentences on a new line, avoiding the so-called "hard sentence break" of two spaces :) > + pt =3D _conv(t->tm_mday, (Palternative =3D=3D PAD_LESS) ? > + "%d" : "%2d", In view of future extensions (PAD_SPACE, etc), could this not be done better with an array of printf format specifiers, indexed by Palternative? Thanks for doing the work, though! G'luck, Peter --=20 Peter Pentchev roam@ringlet.net roam@cnsys.bg roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 What would this sentence be like if pi were 3? --EVF5PPMfhYS0aIcm Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFBcoUp7Ri2jRYZRVMRAv8lAKCuzO0gfl22HX9PbqaQqgj4KgJOCACdGkwM d4kqzhAGHtKUbU1emdrxRUA= =/cok -----END PGP SIGNATURE----- --EVF5PPMfhYS0aIcm--