Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Oct 2004 17:43:53 +0300
From:      Peter Pentchev <roam@ringlet.net>
To:        Xin LI <delphij@frontfree.net>
Cc:        freebsd-hackers@FreeBSD.org
Subject:   Re: [PATCH] add '-' glibc extension to strftime(3)
Message-ID:  <20041017144353.GA4639@straylight.m.ringlet.net>
In-Reply-To: <20041016172302.GA2764@frontfree.net>
References:  <20041016172302.GA2764@frontfree.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041017144353.GA4639>