Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: ztrftime: Handle all non-zsh format chars with strftime if present (v2)
- X-seq: zsh-workers 35739
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: PATCH: ztrftime: Handle all non-zsh format chars with strftime if present (v2)
- Date: Thu, 9 Jul 2015 06:31:07 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=RNDdnp2k393bIs1v4MeDw77Q8BEEaayYvQaDPinuDpw=; b=hBlsSE/E+eEi0MVF2C0rIxetoa0uW7KQgvKRfsKrxMrgjMhpUgV4gwYdGDL+o7Ti8y rKSrDqWVWhy846syMQmyaTLHhx7lFJPTHZ0pWAqqFaMC7/5Aqo+CURmuZ79nMjNbupPl X7x8Q3vEJ1PZQ64l2o7wuYgjneGrpcMljOpn25x96C1RApnLoTtAcEydcDf9mXsgily3 M4Hf/PUyacVItLC0lDPrW9k3PffNSDOIIgdmVlzx62EsxQnxNG5TmlAdpgohRc19q9Ph x4UYg1WIOCOMwtlY/XLg0XBPQDQ8CLjO9vgUGm8JVaCJeyoRHmw42FxFwK19FmW/CUKI ZStg==
- In-reply-to: <1436367975-2945-1-git-send-email-mikachu@gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1436366383-23389-1-git-send-email-mikachu@gmail.com> <1436367975-2945-1-git-send-email-mikachu@gmail.com>
On Wed, Jul 8, 2015 at 5:06 PM, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> At this point, even I find the code slightly questionable. And this doesn't even work properly yet:
> % print -P %D\{aa%14a\}
> aa%
> % print -P %D\{aaa%14a\}
> aaa Wed
>
> ---
> Src/utils.c | 26 ++++++++++++++++----------
> 1 file changed, 16 insertions(+), 10 deletions(-)
>
> diff --git a/Src/utils.c b/Src/utils.c
> index 2d53a00..c18a8de 100644
> --- a/Src/utils.c
> +++ b/Src/utils.c
> @@ -2933,6 +2933,11 @@ ztrftime(char *buf, int bufsize, char *fmt, struct tm *tm, long usec)
> if (ztrftimebuf(&bufsize, 2))
> return -1;
> morefmt:
> + if (!((fmt - fmtstart == 1) || (fmt - fmtstart == 2 && strip) || *fmt == '.')) {
> + while (*fmt && strchr("OE^#_-0123456789", *fmt++));
> + if (*fmt++)
> + goto strftimehandling;
> + }
> switch (*fmt++) {
> case '.':
> if (ztrftimebuf(&bufsize, digs))
Okay, fun thinko here, should be
- while (*fmt && strchr("OE^#_-0123456789", *fmt++));
+ while (*fmt && strchr("OE^#_-0123456789", *fmt))
+ fmt++;
I even had to stare at this for a minute to realize why it fixes it.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author