www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2012/12/04/13:10:10

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
X-Authenticated: #27081556
X-Provags-ID: V01U2FsdGVkX18QGsQ1LlkQdl/3VEkHl3yrOHgkYSw5afFzWqO76x
AT6I7qkfEm10Jg
Message-ID: <50BE3C71.4010708@gmx.de>
Date: Tue, 04 Dec 2012 19:09:53 +0100
From: Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121025 Thunderbird/16.0.2
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Updating djgpp's timezone code to version 2012j
X-Y-GMX-Trusted: 0
Reply-To: djgpp-workers AT delorie DOT com

I have produced two patches to update the current djgpp timezone code stored
in the /zoneinfo directory to the current timezone version code. This is 2012j.
I have downloaded tzcode-latest.tar.gz and tzcode-latest.tar.gz from
ftp://ftp.iana.org/tz/.

The first patch updates the existing code to the 2012j version.  The second
patch adjusts the 2012j code to the djgpp specific requirements. From the
original archive I have renamed Makefile to makefile, README to readme
and Theory to theory to make these files fit with the old repository names.
I assume that there was a DOS file system specific reason why all those names
have been lower cased in those days before they were added to the repository.
The files www.htm and arts.htm should be removed from repository because
they are called tz-link.htm and tz-art.htm now.  In /zoneinfo there are two
directories, one /australi and one /australia.  One should be removed because
it makes problems when installing on SFN systems.  There are also two files
called usno1989 and usno1989a.  It is clear that these names are not 8.3 clean.
Only one is in the repository and it is called usno1989.  I do not know which
of both is the correct one.  usno1989 is the original one from the USNO.  The
second one has some changes from Paul Eggert.  I do not know which one is the
prefered one.  Some help would be apreciated.


The first patch only adjusts the existing code to the new version of tz.
It is very long and I will not put it in this mail.  I think it will not
provide any major insight.  If someone wants to inspect it I will send it
as zipped file to that person.
The second patch makes all DJGPP specific adjustments.  The second patch
is based on the djdiffs file in /zoneinfo.  Also all committs to repository
for all files especially for the Makefile have been inspected.  If they were
found to be still relevant for the current version they have been adapted
and applied.  IMO updating the old timezone code to this version is the
better approach than trying to fix all those warnings that are produced
when the /zoneinfo code is compiled.

I have testet the changes with gcc344 and gcc472.  I have also crosscompiled
on my linux box using djcross-gcc-4.7.2-1ap.i686.rpm.  It worked.

Suggestions, objections, comments are welcome.

Regards,
Juan M. Guerrero




2012-11-25  Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
     Code and data files downloaded from ftp://ftp.iana.org/tz
     as tzcode-latest.tar.gz and tzdata-latest.tar.gz

     * djgpp/zoneinfo/src/africa:  Update to version 2012j
     * djgpp/zoneinfo/src/antarctica:  Update to version 2012j
     * djgpp/zoneinfo/src/arts.htm:  Update to version 2012j
     * djgpp/zoneinfo/src/asctime.c:  Update to version 2012j
     * djgpp/zoneinfo/src/asia:  Update to version 2012j
     * djgpp/zoneinfo/src/australasia:  Update to version 2012j
     * djgpp/zoneinfo/src/backward:  Update to version 2012j
     * djgpp/zoneinfo/src/checktab.awk:  Update to version 2012j
     * djgpp/zoneinfo/src/date.1:  Update to version 2012j
     * djgpp/zoneinfo/src/date.c:  Update to version 2012j
     * djgpp/zoneinfo/src/difftime.c:  Update to version 2012j
     * djgpp/zoneinfo/src/etcetera:  Update to version 2012j
     * djgpp/zoneinfo/src/europe:  Update to version 2012j
     * djgpp/zoneinfo/src/factory:  Update to version 2012j
     * djgpp/zoneinfo/src/ialloc.c:  Update to version 2012j
     * djgpp/zoneinfo/src/iso3166.tab:  Update to version 2012j
     * djgpp/zoneinfo/src/leapseconds:  Update to version 2012j
     * djgpp/zoneinfo/src/localtime.c:  Update to version 2012j
     * djgpp/zoneinfo/src/makefile:  Update to version 2012j
     * djgpp/zoneinfo/src/newctime.3:  Update to version 2012j
     * djgpp/zoneinfo/src/newstrftime.3:  Update to version 2012j
     * djgpp/zoneinfo/src/newtzset.3:  Update to version 2012j
     * djgpp/zoneinfo/src/northamerica:  Update to version 2012j
     * djgpp/zoneinfo/src/pacificnew:  Update to version 2012j
     * djgpp/zoneinfo/src/private.h:  Update to version 2012j
     * djgpp/zoneinfo/src/readme:  Update to version 2012j
     * djgpp/zoneinfo/src/scheck.c:  Update to version 2012j
     * djgpp/zoneinfo/src/solar87:  Update to version 2012j
     * djgpp/zoneinfo/src/solar88:  Update to version 2012j
     * djgpp/zoneinfo/src/solar89:  Update to version 2012j
     * djgpp/zoneinfo/src/southamerica:  Update to version 2012j
     * djgpp/zoneinfo/src/strftime.c:  Update to version 2012j
     * djgpp/zoneinfo/src/systemv:  Update to version 2012j
     * djgpp/zoneinfo/src/theory:  Update to version 2012j
     * djgpp/zoneinfo/src/time2posix.3:  Update to version 2012j
     * djgpp/zoneinfo/src/tz-art.htm:  Update to version 2012j
     * djgpp/zoneinfo/src/tz-link.htm:  Update to version 2012j
     * djgpp/zoneinfo/src/tzfile.5:  Update to version 2012j
     * djgpp/zoneinfo/src/tzfile.h:  Update to version 2012j
     * djgpp/zoneinfo/src/tzselect.8:  Update to version 2012j
     * djgpp/zoneinfo/src/tzselect.ksh:  Update to version 2012j
     * djgpp/zoneinfo/src/usno1988:  Update to version 2012j
     * djgpp/zoneinfo/src/usno1989:  Update to version 2012j
     * djgpp/zoneinfo/src/usno1989a:  Update to version 2012j
     * djgpp/zoneinfo/src/usno1995:  Update to version 2012j
     * djgpp/zoneinfo/src/usno1997:  Update to version 2012j
     * djgpp/zoneinfo/src/usno1998:  Update to version 2012j
     * djgpp/zoneinfo/src/workman.sh:  Update to version 2012j
     * djgpp/zoneinfo/src/www.htm:  Update to version 2012j
     * djgpp/zoneinfo/src/yearistype.sh:  Update to version 2012j
     * djgpp/zoneinfo/src/zdump.8:  Update to version 2012j
     * djgpp/zoneinfo/src/zdump.c:  Update to version 2012j
     * djgpp/zoneinfo/src/zic.8:  Update to version 2012j
     * djgpp/zoneinfo/src/zic.c:  Update to version 2012j
     * djgpp/zoneinfo/src/zone.tab:  Update to version 2012j
     * djgpp/zoneinfo/src/zoneinfo2tdf.pl:  Update to version 2012j







2012-11-24  Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>

     * djgpp/zoneinfo/src/date.c [OLD_TIME]:  Only if OLD_TIME defined
     include utmp.h.
     [__MSDOS__]:  For MSDOS do not declare and do not define oops().
     (main):  Cast variable to correct type.
     [TSP_SETDATE]:  Only if TSP_SETDATE defined include syslog.h,
     sys/socket.h, netinet/in.h, netdb.h and protocols/timed.h and
     define TSPTYPES.
     (reset) [__MSDOS__]:  MSDOS does not support TSP_SETDATE.
     (convert):  Cast variable to correct type.

     * djgpp/zoneinfo/src/localtime.c:  Define IS_SLASH and IS_ABSOLUTE
     for portable testing of absolute file names.
     (tzload):  Use IS_ABSOLUTE for portable testing of absolute file
     names.
     [WRONG]:  Cast variable to correct type.
     [!__DJGPP__]:  Use DJGPP's libc implementations of localtime,
      localtime_r, gmtime, gmtime_r, ctime, ctime_r and mktime.

     * djgpp/zoneinfo/src/private.h [STD_INSPIRED]:  Provide function
     declarations.
     [__MSDOS__]:  Define IS_SLASH(c), HAS_DEVICE, IS_ABSOLUTE and
     TZDIR macros.

     * djgpp/zoneinfo/src/zdump.c (show) [TM_GMTOFF]:  Cast variable
     to correct type.

     * djgpp/zoneinfo/src/zic.c [HAVE_SYS_WAIT_H]:  Include sys/wait.h
     and define WEXITSTATUS if not defined.
     [IS_SLASH, IS_ABSOLUTE]:  If not defined define them.
     (dolink):  Use IS_ABSOLUTE for portable testing of absolute file
     names.  Replace '+' by '%' in file names or directory names.
     (itsdir) [D_OK]:  On MSDOS/WINDOWS use access() to check if it is
     a directory.
     (writezone):  Replace '+' by '%' in file names or directory names.
     (mkdirs):  Use HAS_DEVICE and IS_SLASH to handle directory craetiong
     in a portable way.

     * djgpp/zoneinfo/src/asctime.c [!__DJGPP__]:  Use DJGPP's libc
     implementations of asctime and asctime_r.





diff -aprNU5 djgpp.orig/zoneinfo/src/asctime.c djgpp/zoneinfo/src/asctime.c
--- djgpp.orig/zoneinfo/src/asctime.c    2012-12-01 22:59:32 +0000
+++ djgpp/zoneinfo/src/asctime.c    2012-12-01 23:04:28 +0000
@@ -1,5 +1,9 @@
+#ifndef __DJGPP__
+/*  Use DJGPP's own implementation of asctime and asctime_r.  */
+
+
  /*
  ** This file is in the public domain, so clarified as of
  ** 1996-06-05 by Arthur David Olson.
  */

@@ -128,5 +132,6 @@ asctime_r(register const struct tm *time
  char *
  asctime(register const struct tm *timeptr)
  {
      return asctime_r(timeptr, buf_asctime);
  }
+#endif  /* !__DJGPP__ */
diff -aprNU5 djgpp.orig/zoneinfo/src/date.c djgpp/zoneinfo/src/date.c
--- djgpp.orig/zoneinfo/src/date.c    2012-12-01 22:59:32 +0000
+++ djgpp/zoneinfo/src/date.c    2012-12-01 23:04:28 +0000
@@ -28,11 +28,13 @@ static char sccsid[] = "@(#)date.c    4.23
  #include "private.h"
  #if HAVE_ADJTIME || HAVE_SETTIMEOFDAY
  #include "sys/time.h"    /* for struct timeval, struct timezone */
  #endif /* HAVE_ADJTIME || HAVE_SETTIMEOFDAY */
  #include "locale.h"
+#ifdef OLD_TIME
  #include "utmp.h"    /* for OLD_TIME (or its absence) */
+#endif
  #if HAVE_UTMPX_H
  #include "utmpx.h"
  #endif

  #ifndef OTIME_MSG
@@ -72,11 +74,13 @@ static void        display(const char *);
  static void        dogmt(void);
  static void        errensure(void);
  static void        iffy(time_t, time_t, const char *, const char *);
  int            main(int, char**);
  static const char *    nondigit(const char *);
+#ifndef __MSDOS__
  static void        oops(const char *);
+#endif
  static void        reset(time_t, int);
  static int        sametm(const struct tm *, const struct tm *);
  static void        timeout(FILE *, const char *, const struct tm *);
  static void        usage(void);
  static void        wildinput(const char *, const char *,
@@ -246,11 +250,11 @@ _("date: error: multiple values in comma
          tv.tv_usec = (int) ((adjust - tv.tv_sec) * 1000000L);
          if (adjtime(&tv, NULL) != 0)
              oops("adjtime");
  #endif /* HAVE_ADJTIME */
  #if !HAVE_ADJTIME
-        reset(now + adjust, nflag);
+        reset(now + (time_t)adjust, nflag);
  #endif /* !HAVE_ADJTIME */
          /*
          ** Sun silently ignores everything else; we follow suit.
          */
          exit(retval);
@@ -424,16 +428,18 @@ reset(const time_t newt, const int nflag
  #ifndef BSD4_4
  #define TIME_NAME    ""
  #endif /* !defined BSD4_4 */
  #endif /* !defined TIME_NAME */

+#ifdef TSP_SETDATE
  #include "syslog.h"
  #include "sys/socket.h"
  #include "netinet/in.h"
  #include "netdb.h"
  #define TSPTYPES
  #include "protocols/timed.h"
+#endif /* TSP_SETDATE */

  extern int        logwtmp();

  #if HAVE_SETTIMEOFDAY == 1
  #define settimeofday(t, tz) (settimeofday)(t)
@@ -457,10 +463,11 @@ reset(const time_t newt, const int nflag
  #endif /* defined EBUG */
      username = getlogin();
      if (username == NULL || *username == '\0') /* single-user or no tty */
          username = "root";
      tv.tv_sec = newt;
+#ifndef __MSDOS__
  #ifdef TSP_SETDATE
      if (nflag || !netsettime(tv))
  #endif /* defined TSP_SETDATE */
      {
          /*
@@ -471,10 +478,11 @@ reset(const time_t newt, const int nflag
              logwtmp("{", TIME_NAME, "");    /* } */
              syslog(LOG_AUTH | LOG_NOTICE, _("date set by %s"),
                  username);
          } else    oops("settimeofday");
      }
+#endif /* !__MSDOS__ */
  }

  #endif /* !defined OLD_TIME */

  static void
@@ -509,10 +517,11 @@ usage(void)
  [-t min-west] [-a sss.fff] [[yyyy]mmddhhmm[yyyy][.ss]] [+format]\n"));
      errensure();
      exit(retval);
  }

+#ifndef __MSDOS__
  static void
  oops(const char *const string)
  {
      int        e = errno;

@@ -520,10 +529,11 @@ oops(const char *const string)
      errno = e;
      (void) perror(string);
      errensure();
      display(NULL);
  }
+#endif /* !__MSDOS__ */

  static void
  display(const char *const format)
  {
      struct tm    tm;
@@ -634,11 +644,11 @@ convert(register const char * const valu
                  _("seconds part is not two digits"));
          secs = ATOI2(cp);
      }

      cp = value;
-    switch (dotp - cp) {
+    switch ((int)(dotp - cp)) {
          default:
              wildinput(_("time"), value,
                  _("main part is wrong length"));
          case 12:
              if (!dousg) {
@@ -685,11 +695,11 @@ convert(register const char * const valu
      tm.tm_min = mins;
      tm.tm_sec = secs;
      tm.tm_isdst = -1;
      outtm = tm;
      outt = mktime(&outtm);
-    return sametm(&tm, &outtm) ? outt : -1;
+    return sametm(&tm, &outtm) ? outt : (time_t)-1;
  }

  /*
  ** Code from here on out is either based on code provided by UCB
  ** or is only called just before the program exits.
diff -aprNU5 djgpp.orig/zoneinfo/src/localtime.c djgpp/zoneinfo/src/localtime.c
--- djgpp.orig/zoneinfo/src/localtime.c    2012-12-01 22:59:32 +0000
+++ djgpp/zoneinfo/src/localtime.c    2012-12-01 23:04:28 +0000
@@ -27,10 +27,21 @@
  #ifndef TZ_ABBR_ERR_CHAR
  #define TZ_ABBR_ERR_CHAR    '_'
  #endif /* !defined TZ_ABBR_ERR_CHAR */

  /*
+** Portable testing for absolute file names.
+*/
+
+#ifndef IS_SLASH
+#define IS_SLASH(c)     ((c) == '/')
+#endif
+#ifndef IS_ABSOLUTE
+#define IS_ABSOLUTE(n)  (IS_SLASH((n)[0]))
+#endif
+
+/*
  ** SunOS 4.1.1 headers lack O_BINARY.
  */

  #ifdef O_BINARY
  #define OPEN_MODE    (O_RDONLY | O_BINARY)
@@ -197,14 +208,17 @@ static struct state    gmtmem;

  static char        lcl_TZname[TZ_STRLEN_MAX + 1];
  static int        lcl_is_set;
  static int        gmt_is_set;

+#ifndef __DJGPP__
+/*  Use DJGPP's own definition of tzname.  */
  char *            tzname[2] = {
      wildabbr,
      wildabbr
  };
+#endif  /* !__DJGPP__ */

  /*
  ** Section 4.12.3 of X3.159-1989 requires that
  **    Except for the strftime function, these functions [asctime,
  **    ctime, gmtime, localtime] return values in one of two static
@@ -358,11 +372,11 @@ tzload(register const char *name, regist
          */
          char        fullname[FILENAME_MAX + 1];

          if (name[0] == ':')
              ++name;
-        doaccess = name[0] == '/';
+        doaccess = IS_ABSOLUTE(name);
          if (!doaccess) {
              if ((p = TZDIR) == NULL)
                  goto oops;
              if ((strlen(p) + strlen(name) + 1) >= sizeof fullname)
                  goto oops;
@@ -1300,10 +1314,12 @@ localsub(const time_t *const timep, cons
      tmp->TM_ZONE = &sp->chars[ttisp->tt_abbrind];
  #endif /* defined TM_ZONE */
      return result;
  }

+#ifndef __DJGPP__
+/*  Use DJGPP's own implementation of localtime and localtime_r. */
  struct tm *
  localtime(const time_t *const timep)
  {
      tzset();
      return localsub(timep, 0L, &tm);
@@ -1316,10 +1332,11 @@ localtime(const time_t *const timep)
  struct tm *
  localtime_r(const time_t *const timep, struct tm *tmp)
  {
      return localsub(timep, 0L, tmp);
  }
+#endif  /* !__DJGPP__ */

  /*
  ** gmtsub is to gmtime as localsub is to localtime.
  */

@@ -1357,10 +1374,12 @@ gmtsub(const time_t *const timep, const
      }
  #endif /* defined TM_ZONE */
      return result;
  }

+#ifndef __DJGPP__
+/*  Use DJGPP's own implementation of gmtime and gmtime_r.  */
  struct tm *
  gmtime(const time_t *const timep)
  {
      return gmtsub(timep, 0L, &tm);
  }
@@ -1372,10 +1391,11 @@ gmtime(const time_t *const timep)
  struct tm *
  gmtime_r(const time_t *const timep, struct tm *tmp)
  {
      return gmtsub(timep, 0L, tmp);
  }
+#endif  /* !__DJGPP__ */

  #ifdef STD_INSPIRED

  struct tm *
  offtime(const time_t *const timep, const long offset)
@@ -1527,10 +1547,12 @@ timesub(const time_t *const timep, const
      tmp->TM_GMTOFF = offset;
  #endif /* defined TM_GMTOFF */
      return tmp;
  }

+#ifndef __DJGPP__
+/*  Use DJGPP's own implementation of ctime and ctime_r.  */
  char *
  ctime(const time_t *const timep)
  {
  /*
  ** Section 4.12.3.2 of X3.159-1989 requires that
@@ -1546,10 +1568,11 @@ ctime_r(const time_t *const timep, char
  {
      struct tm    mytm;

      return asctime_r(localtime_r(timep, &mytm), buf);
  }
+#endif  /* !__DJGPP__ */

  /*
  ** Adapted from code provided by Robert Elz, who writes:
  **    The "best" way to do mktime I think is based on an idea of Bob
  **    Kridle's (so its said...) from a long time ago.
@@ -1557,11 +1580,11 @@ ctime_r(const time_t *const timep, char
  **    just 32 bits, its a max of 32 iterations (even at 64 bits it
  **    would still be very reasonable).
  */

  #ifndef WRONG
-#define WRONG    (-1)
+#define WRONG  ((time_t)-1)
  #endif /* !defined WRONG */

  /*
  ** Normalize logic courtesy Paul Eggert.
  */
@@ -1907,16 +1930,19 @@ time1(struct tm *const tmp,
          }
      }
      return WRONG;
  }

+#ifndef __DJGPP__
+/*  Use DJGPP's own implementation of mktime.  */
  time_t
  mktime(struct tm *const tmp)
  {
      tzset();
      return time1(tmp, localsub, 0L);
  }
+#endif  /* !__DJGPP__ */

  #ifdef STD_INSPIRED

  time_t
  timelocal(struct tm *const tmp)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019