[tz] zdump new option -i for easier-to-review output

Chris Rorvick chris at rorvick.com
Tue Jun 7 11:33:56 UTC 2016


On Sun, May 29, 2016 at 1:49 PM, Paul Eggert <eggert at cs.ucla.edu> wrote:
> I looked into the format you suggested, along with the other comments noted
> and formats I've seen elsewhere (e.g., Shanks), and came up with the
> attached proposal for a "canonical" -i format for zdump, with the design
> goals being a format that is unambiguous, easy to review, and compact.

I encountered an error when building with the proposed patch with GCC
4.9.3, resolved with the below trivial fix.

Chris

-- >8 --
Subject: [PATCH] Fix error with GCC 4.9.3

  zdump.c: In function 'istrftime':
  zdump.c:1082:3: error: 'for' loop initial declarations are only
allowed in C99 or C11 mode
     for (char const *p = f; ; p++)
     ^
  zdump.c:1082:3: note: use option -std=c99, -std=gnu99, -std=c11 or
-std=gnu11 to compile your code
---
 zdump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/zdump.c b/zdump.c
index 9ecc02a..d5ed5f0 100644
--- a/zdump.c
+++ b/zdump.c
@@ -1077,9 +1077,9 @@ istrftime(char *buf, size_t size, char const *time_fmt,
 {
   char *b = buf;
   size_t s = size;
-  char const *f = time_fmt;
+  char const *f = time_fmt, *p;

-  for (char const *p = f; ; p++)
+  for (p = f; ; p++)
     if (*p == '%' && p[1] == '%')
       p++;
     else if (!*p
-- 
2.8.1



More information about the tz mailing list