This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: [PATCH]: Add %e format specifier to strftime(3)
- From: "J. Johnston" <jjohnstn at redhat dot com>
- To: newlib <newlib at sources dot redhat dot com>
- Date: Fri, 21 Jun 2002 13:44:22 -0400
- Subject: Re: [PATCH]: Add %e format specifier to strftime(3)
- Organization: Red Hat Inc.
- References: <20020621173208.N22705@cygbert.vinschen.de>
Corinna Vinschen wrote:
>
> Hi,
>
> the following patch adds the missing %e format specifier to strftime(3).
>
> Ok to check in?
>
Yes, thanks.
-- Jeff J.
>
> 2002-06-21 Corinna Vinschen <corinna@vinschen.de>
>
> * libc/time/strftime.c (strftime): Add %e format specifier.
>
> Index: libc/time/strftime.c
> ===================================================================
> RCS file: /cvs/src/src/newlib/libc/time/strftime.c,v
> retrieving revision 1.3
> diff -u -p -r1.3 strftime.c
> --- libc/time/strftime.c 17 Apr 2002 21:23:31 -0000 1.3
> +++ libc/time/strftime.c 21 Jun 2002 15:30:05 -0000
> @@ -64,6 +64,9 @@ A string representing the complete date
> o %d
> The day of the month, formatted with two digits.
>
> +o %e
> +The day of the month, formatted with leading space if single digit.
> +
> o %H
> The hour (on a 24-hour clock), formatted with two digits.
>
> @@ -251,6 +254,16 @@ _DEFUN (strftime, (s, maxsize, format, t
> if (count < maxsize - 2)
> {
> sprintf (&s[count], "%.2d",
> + tim_p->tm_mday);
> + count += 2;
> + }
> + else
> + return 0;
> + break;
> + case 'e':
> + if (count < maxsize - 2)
> + {
> + sprintf (&s[count], "%2d",
> tim_p->tm_mday);
> count += 2;
> }
>
> --
> Corinna Vinschen
> Cygwin Developer
> Red Hat, Inc.
> mailto:vinschen@redhat.com