[PATCH] add '-' glibc extension to strftime(3)
Peter Pentchev
roam at ringlet.net
Sun Oct 17 07:43:46 PDT 2004
On Sun, Oct 17, 2004 at 01:23:02AM +0800, Xin LI wrote:
> Hi, folks,
>
> It turns out that the GNU extension '-' in their strftime(3) implementation
> 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?
>
> Thanks for any comments!
>
> Index: strftime.3
> ===================================================================
> 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 = _conv(t->tm_mday, (Palternative == 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
--
Peter Pentchev roam at ringlet.net roam at cnsys.bg roam at 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?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20041017/f9066928/attachment.bin
More information about the freebsd-hackers
mailing list