Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: bug in ztrftime(): '%e' and '%f' specifiers swapped



Greg Klanderman wrote:
> You have inadvertently swapped the meanings of the '%e' and '%f' format
> specifiers.

Thanks for tracking this down.

> However, I find this equivalent patch to be more readable:

Interesting how subjective this is, I find it significantly less so
(though they're certainly equivalent so this is all rather minor and if
you hadn't sent two patches I'd never even have thought about it):

- there is no immediate visual cue that the formats do different things
- the test for the format letter is repeated without it being obvious it
  is the same test
- it's made even less obvious because the second test has to advance
  back down the format string since the key letter isn't saved in a
  variable [we do this sort of thing all the time elsewhere, though]
- the fact that 'f' sets the "strip" feature unconditionally is obscured
- I'm not that keen on "||" and "&&" in assignments anyway [again, the
  shell is full of stuff I'm not that keen on]

so I've committed the first one.

> Btw, are the zsh extension format specifiers documented?

See the description of the %D format in the description of prompt
escapes, which is where these first occurred; feel free to add some more
cross references, I see there isn't one in the zsh/datetime description,
for example.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author