From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6014 invoked by alias); 27 Jul 2015 11:56:59 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35928 Received: (qmail 9539 invoked from network); 27 Jul 2015 11:56:56 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Biglobe-Sender: Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Subject: Re: PATCH: ztrftime: Pass everything unhandled to the system strftime() From: "Jun T." In-Reply-To: <1436435887-28736-1-git-send-email-mikachu@gmail.com> Date: Mon, 27 Jul 2015 20:56:20 +0900 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20150709094122.17abacc8@pwslap01u.europe.root.pri> <1436435887-28736-1-git-send-email-mikachu@gmail.com> To: "zsh-workers@zsh.org" X-Mailer: Apple Mail (2.1510) X-Biglobe-Spnum: 65378 I wrote: > Is it possible to pass the entire format string to strftime() > if HAVE_STRFTIME is defined? but this was not a good idea. On cygwin, V09datetime.ztst fails as *** 1,2 **** ! 6_6_3_3 000000 --- 1,2 ---- ! 000000 Test ./V09datetime.ztst failed: output differs from expected as shown = above for: strftime %-m_%f_%K_%L 1181100000 strftime %6. 0 Was testing: zsh extensions ./V09datetime.ztst: test failed. strftime(3) on cygwin is from newlib (not gnu libc) and does not support any of gnu extensions including the %- modifier. But man zshmisc says: The GNU extension that a `-' between the % and the format char- acter causes a leading zero or space to be stripped is handled directly by the shell for the format characters d, f, H, k, l, m, M, S and y; any other format characters are provided to strf- time() with any leading `-', present, so the handling is system dependent. Further GNU extensions are not supported at present. so %-m etc. needs be supported also on cygwin? The simplest fix would be to move the #ifndef HAVE_STRFTIME back to the original position: diff --git a/Src/utils.c b/Src/utils.c index f7aaaed..236661a 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -3006,7 +3006,6 @@ morefmt: =20 *buf++ =3D '0' + (hr12 % 10); break; -#ifndef HAVE_STRFTIME case 'd': if (tm->tm_mday > 9 || !strip) *buf++ =3D '0' + tm->tm_mday / 10; @@ -3032,6 +3031,7 @@ morefmt: *buf++ =3D '0' + (tm->tm_year / 10) % 10; *buf++ =3D '0' + tm->tm_year % 10; break; +#ifndef HAVE_STRFTIME case 'Y': { int year, digits, testyear; BTW, the last part of the above man page "Further GNU extensions are not supported at present." needs be updated?=