FW: tzcode2006a.tar.gz on Irix 6.5.18m

Paul Eggert eggert at CS.UCLA.EDU
Thu Feb 2 21:07:49 UTC 2006


Andrew Donaldson writes:

> We found that the zdump utility, used with the -v option, would only
> output the first times.

Thanks for reporting this.  What options did you use to compile zdump?
Did you compile it in 32- or 64-bit mode, for example?

> I am unsure why the tzcode2006a.tar.gz version of zdump behaved
> differently.

Have you used other zdump.c versions besides tzclassic?  If so, do you
recall the most recent one that worked?  Here are the recentish
versions that I know about, along with their sizes (in bytes) and
dates.

    6302 Aug 26  1993 tz-1993d/zdump.c
    6675 Oct 15  1993 tz-1993f/zdump.c
    6673 Nov 22  1993 tz-1993g/zdump.c
    6690 May  5  1994 tz-1994f/zdump.c
    7252 Dec  8  1994 tz-1994h/zdump.c
    7353 Mar 11  1995 tz-1995c/zdump.c
    8135 Feb 21  1996 tz-1996e/zdump.c
    8142 May  2  1996 tz-1996f/zdump.c
    8155 Jan 20  1997 tz-1997a/zdump.c
    8442 Mar  7  1997 tz-1997c/zdump.c
    8442 Dec 29  1997 tz-1997i/zdump.c
    8426 Jan 19  1999 tz-1999a/zdump.c
    8420 Mar 13  2001 tz-2001a/zdump.c
    8494 Sep 16  2003 tz-2003c/zdump.c
    8494 Jul 19  2004 tz-2004b/zdump.c
    9488 Aug 11  2004 tz-2004c/zdump.c
    9495 Sep  6  2004 tz-2004d/zdump.c
   10070 Oct 18  2004 tz-2004f/zdump.c
   13542 Dec 30  2004 tz-2005a/zdump.c
   14523 Jan 17  2005 tz-2005d/zdump.c
   14517 Feb  7  2005 tz-2005e/zdump.c
   14572 Apr  4  2005 tz-2005h/zdump.c
   15557 Jul 14  2005 tz-2005j/zdump.c
   15539 Aug 29 09:15 tz-2005m/zdump.c
   15550 Nov 28 07:52 tz-2005o/zdump.c
   15617 Dec  5 07:11 tz-2005p/zdump.c
   15644 Dec 12 07:46 tz-2005q/zdump.c
   15656 Dec 27 06:05 tz-2005r/zdump.c


> To compile tzcode2006a.tar.gz I had to make these changes:
>
> $ diff localtime.c localtime.c.orig
> 512d511
> < /*
> 517,518d515
> < */
> < const char *  getqzname P((const char * strp, const char delim))

I looked at that bit of code, and it's clear that zdump.c is violating
that C Standard in this area, and it's conceivable that this might be
causing your problem.

The C Standard says that you cannot do something like this:

   /* forward declaration */
   static void foo (char);

   /* implementation */
   static void foo (c) char c; { }

because the implementation relies on the argument being promoted to an
integer, whereas the declaration says the argument is not promoted.
getqzname violates this rule when __STDC__ is defined, with its 'char'
argument.

I found some other instances of this problem, with time_t rather than
char; this is also an issue because time_t might be narrower than int
(at least in theory -- the C Standard allows this and its examples
take this possibility into account).

The fix for this is to use ANSI-style prototypes for cases where this
might arise.  Here is a patch for this.  This patch should be
installed even if it doesn't fix your particular problem, since it
does fix a standards violation.



===================================================================
RCS file: RCS/date.c,v
retrieving revision 2005.17
retrieving revision 2005.17.0.1
diff -pu -r2005.17 -r2005.17.0.1
--- date.c	2005/12/12 15:46:36	2005.17
+++ date.c	2006/02/02 20:47:49	2005.17.0.1
@@ -352,9 +352,13 @@ dogmt()
 
 /*ARGSUSED*/
 static void
+#ifdef __STDC__
+reset(const time_t newt, const int nflag)
+#else
 reset(newt, nflag)
 const time_t	newt;
 const int	nflag;
+#endif
 {
 	register int		fid;
 	time_t			oldt;
@@ -619,10 +623,14 @@ register const struct tm * const btmp;
 #define ATOI2(ar)	(ar[0] - '0') * 10 + (ar[1] - '0'); ar += 2;
 
 static time_t
+#ifdef __STDC__
+convert(register const char * const value, const int dousg, const time_t t)
+#else
 convert(value, dousg, t)
 register const char * const	value;
 const int			dousg;
 const time_t			t;
+#endif
 {
 	register const char *	cp;
 	register const char *	dotp;
@@ -726,11 +734,18 @@ const time_t			t;
 */
 
 static void
+#ifdef __STDC__
+checkfinal(const char * const	value,
+	   const int		didusg,
+	   const time_t		t,
+	   const time_t		oldnow)
+#else
 checkfinal(value, didusg, t, oldnow)
 const char * const	value;
 const int		didusg;
 const time_t		t;
 const time_t		oldnow;
+#endif
 {
 	time_t		othert;
 	struct tm	tm;
@@ -789,11 +804,16 @@ const time_t		oldnow;
 }
 
 static void
+#ifdef __STDC__
+iffy(const time_t thist, const time_t thatt,
+     const char * const value, const char * const reason)
+#else
 iffy(thist, thatt, value, reason)
 const time_t		thist;
 const time_t		thatt;
 const char * const	value;
 const char * const	reason;
+#endif
 {
 	struct tm	tm;
 
===================================================================
RCS file: RCS/localtime.c,v
retrieving revision 2005.17
retrieving revision 2005.17.0.1
diff -pu -r2005.17 -r2005.17.0.1
--- localtime.c	2005/12/08 16:35:40	2005.17
+++ localtime.c	2006/02/02 20:40:46	2005.17.0.1
@@ -510,9 +510,13 @@ register const char *	strp;
 */
 
 static const char *
+#ifdef __STDC__
+getqzname(register const char *strp, const char delim)
+#else
 getqzname(strp, delim)
 register const char *	strp;
 const char		delim;
+#endif
 {
 	register char	c;
 
===================================================================
RCS file: RCS/zdump.c,v
retrieving revision 2005.18
retrieving revision 2005.18.0.1
diff -pu -r2005.18 -r2005.18.0.1
--- zdump.c	2005/12/27 14:05:26	2005.18
+++ zdump.c	2006/02/02 20:42:22	2005.18.0.1
@@ -468,10 +468,14 @@ const long	y;
 }
 
 static time_t
+#ifdef __STDC__
+hunt(char *name, time_t lot, time_t hit)
+#else
 hunt(name, lot, hit)
 char *	name;
 time_t	lot;
 time_t	hit;
+#endif
 {
 	time_t			t;
 	long			diff;
@@ -541,10 +545,14 @@ struct tm *	oldp;
 }
 
 static void
+#ifdef __STDC__
+show(char *zone, time_t t, int v)
+#else
 show(zone, t, v)
 char *	zone;
 time_t	t;
 int	v;
+#endif
 {
 	register struct tm *	tmp;
 



More information about the tz mailing list