1995-02-18 01:27:10 +00:00
|
|
|
#ifndef lint
|
|
|
|
#ifndef NOID
|
* time/tzfile.h, time/private.h, time/zdump.c, time/zic.c,
time/africa, time/asia, time/australasia, time/europe,
time/northamerica, time/southamerica: Updated from ADO 96h.
* Make-dist (all-headers): Filter $(sysdep_headers) out of $(headers).
(try-sysdeps, +sysdep-names): Check sysdeps/libm-ieee754 too.
* Makerules (distinfo-vars): Add sysdep_headers.
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Append to
this instead of $(headers).
* sysdeps/unix/sysv/linux/alpha/Makefile: Likewise.
* Make-dist [subdirs-dirs]: Don't prefix $(subdir-dirs) with
$(subdir); we are already there.
* sysdeps/unix/sysv/sysv4/solaris2/sparc/Dist: Removed.
1996-06-05 23:25:04 +00:00
|
|
|
static char elsieid[] = "@(#)zdump.c 7.24";
|
1995-02-18 01:27:10 +00:00
|
|
|
#endif /* !defined NOID */
|
|
|
|
#endif /* !defined lint */
|
|
|
|
|
|
|
|
/*
|
|
|
|
** This code has been made independent of the rest of the time
|
|
|
|
** conversion package to increase confidence in the verification it provides.
|
|
|
|
** You can use this code to help in verifying other implementations.
|
|
|
|
*/
|
|
|
|
|
Wed Mar 8 13:38:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* posix/glob/configure.bat: Fixes from DJ.
* time/backward, time/europe, time/northamerica, time/pacificnew,
time/zdump.c, time/zic.c, time/tzfile.h, time/private.h,
time/ialloc.c: Code and data updated from ADO's 95b.
* time/emkdir.c: File removed.
* time/Makefile (distribute, extra-objs, zic): Omit it.
* time/localtime.c: Deansideclized. Never #define __tzname et al
to non-__ names.
* locale/lc-ctype.c (__ctype_tolower, __ctype_toupper): Use int *
instead of short int *.
* ctype/ctype-info.c: Likewise.
* ctype/ctype.h: Likewise.
* locale/langinfo.h (_NL_CTYPE_CLASS): Use this (just one) instead
of EB and EL versions.
1995-03-09 10:00:12 +00:00
|
|
|
#include "stdio.h" /* for stdout, stderr, perror */
|
1995-02-18 01:27:10 +00:00
|
|
|
#include "string.h" /* for strcpy */
|
|
|
|
#include "sys/types.h" /* for time_t */
|
|
|
|
#include "time.h" /* for struct tm */
|
Wed Mar 8 13:38:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* posix/glob/configure.bat: Fixes from DJ.
* time/backward, time/europe, time/northamerica, time/pacificnew,
time/zdump.c, time/zic.c, time/tzfile.h, time/private.h,
time/ialloc.c: Code and data updated from ADO's 95b.
* time/emkdir.c: File removed.
* time/Makefile (distribute, extra-objs, zic): Omit it.
* time/localtime.c: Deansideclized. Never #define __tzname et al
to non-__ names.
* locale/lc-ctype.c (__ctype_tolower, __ctype_toupper): Use int *
instead of short int *.
* ctype/ctype-info.c: Likewise.
* ctype/ctype.h: Likewise.
* locale/langinfo.h (_NL_CTYPE_CLASS): Use this (just one) instead
of EB and EL versions.
1995-03-09 10:00:12 +00:00
|
|
|
#include "stdlib.h" /* for exit, malloc, atoi */
|
1995-02-18 01:27:10 +00:00
|
|
|
|
|
|
|
#ifndef MAX_STRING_LENGTH
|
|
|
|
#define MAX_STRING_LENGTH 1024
|
|
|
|
#endif /* !defined MAX_STRING_LENGTH */
|
|
|
|
|
|
|
|
#ifndef TRUE
|
|
|
|
#define TRUE 1
|
|
|
|
#endif /* !defined TRUE */
|
|
|
|
|
|
|
|
#ifndef FALSE
|
|
|
|
#define FALSE 0
|
|
|
|
#endif /* !defined FALSE */
|
|
|
|
|
|
|
|
#ifndef EXIT_SUCCESS
|
|
|
|
#define EXIT_SUCCESS 0
|
|
|
|
#endif /* !defined EXIT_SUCCESS */
|
|
|
|
|
|
|
|
#ifndef EXIT_FAILURE
|
|
|
|
#define EXIT_FAILURE 1
|
|
|
|
#endif /* !defined EXIT_FAILURE */
|
|
|
|
|
|
|
|
#ifndef SECSPERMIN
|
|
|
|
#define SECSPERMIN 60
|
|
|
|
#endif /* !defined SECSPERMIN */
|
|
|
|
|
|
|
|
#ifndef MINSPERHOUR
|
|
|
|
#define MINSPERHOUR 60
|
|
|
|
#endif /* !defined MINSPERHOUR */
|
|
|
|
|
|
|
|
#ifndef SECSPERHOUR
|
|
|
|
#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR)
|
|
|
|
#endif /* !defined SECSPERHOUR */
|
|
|
|
|
|
|
|
#ifndef HOURSPERDAY
|
|
|
|
#define HOURSPERDAY 24
|
|
|
|
#endif /* !defined HOURSPERDAY */
|
|
|
|
|
|
|
|
#ifndef EPOCH_YEAR
|
|
|
|
#define EPOCH_YEAR 1970
|
|
|
|
#endif /* !defined EPOCH_YEAR */
|
|
|
|
|
|
|
|
#ifndef TM_YEAR_BASE
|
|
|
|
#define TM_YEAR_BASE 1900
|
|
|
|
#endif /* !defined TM_YEAR_BASE */
|
|
|
|
|
|
|
|
#ifndef DAYSPERNYEAR
|
|
|
|
#define DAYSPERNYEAR 365
|
|
|
|
#endif /* !defined DAYSPERNYEAR */
|
|
|
|
|
|
|
|
#ifndef isleap
|
|
|
|
#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
|
|
|
|
#endif /* !defined isleap */
|
|
|
|
|
1996-02-27 00:55:03 +00:00
|
|
|
#if HAVE_GETTEXT - 0
|
|
|
|
#include "locale.h" /* for setlocale */
|
|
|
|
#include "libintl.h"
|
|
|
|
#endif /* HAVE_GETTEXT - 0 */
|
|
|
|
|
1995-02-18 01:27:10 +00:00
|
|
|
#ifndef GNUC_or_lint
|
|
|
|
#ifdef lint
|
|
|
|
#define GNUC_or_lint
|
|
|
|
#endif /* defined lint */
|
Wed Mar 8 13:38:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* posix/glob/configure.bat: Fixes from DJ.
* time/backward, time/europe, time/northamerica, time/pacificnew,
time/zdump.c, time/zic.c, time/tzfile.h, time/private.h,
time/ialloc.c: Code and data updated from ADO's 95b.
* time/emkdir.c: File removed.
* time/Makefile (distribute, extra-objs, zic): Omit it.
* time/localtime.c: Deansideclized. Never #define __tzname et al
to non-__ names.
* locale/lc-ctype.c (__ctype_tolower, __ctype_toupper): Use int *
instead of short int *.
* ctype/ctype-info.c: Likewise.
* ctype/ctype.h: Likewise.
* locale/langinfo.h (_NL_CTYPE_CLASS): Use this (just one) instead
of EB and EL versions.
1995-03-09 10:00:12 +00:00
|
|
|
#ifndef lint
|
1995-02-18 01:27:10 +00:00
|
|
|
#ifdef __GNUC__
|
|
|
|
#define GNUC_or_lint
|
|
|
|
#endif /* defined __GNUC__ */
|
Wed Mar 8 13:38:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* posix/glob/configure.bat: Fixes from DJ.
* time/backward, time/europe, time/northamerica, time/pacificnew,
time/zdump.c, time/zic.c, time/tzfile.h, time/private.h,
time/ialloc.c: Code and data updated from ADO's 95b.
* time/emkdir.c: File removed.
* time/Makefile (distribute, extra-objs, zic): Omit it.
* time/localtime.c: Deansideclized. Never #define __tzname et al
to non-__ names.
* locale/lc-ctype.c (__ctype_tolower, __ctype_toupper): Use int *
instead of short int *.
* ctype/ctype-info.c: Likewise.
* ctype/ctype.h: Likewise.
* locale/langinfo.h (_NL_CTYPE_CLASS): Use this (just one) instead
of EB and EL versions.
1995-03-09 10:00:12 +00:00
|
|
|
#endif /* !defined lint */
|
1995-02-18 01:27:10 +00:00
|
|
|
#endif /* !defined GNUC_or_lint */
|
|
|
|
|
|
|
|
#ifndef INITIALIZE
|
|
|
|
#ifdef GNUC_or_lint
|
|
|
|
#define INITIALIZE(x) ((x) = 0)
|
|
|
|
#endif /* defined GNUC_or_lint */
|
|
|
|
#ifndef GNUC_or_lint
|
|
|
|
#define INITIALIZE(x)
|
|
|
|
#endif /* !defined GNUC_or_lint */
|
|
|
|
#endif /* !defined INITIALIZE */
|
|
|
|
|
Wed Feb 21 02:25:07 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* Rules (others): Depend on $(extra-objs), $(install-lib),
$(install-bin), $(install-sbin), in object directory.
* Makeconfig (link-libc): Don't pass -rpath option with default
path, since ld.so should use the same default.
* Makerules (build-shlib): Likewise.
* Makerules (make-target-directory): Use mkinstalldirs.
* sysdeps/mach/i386/sysdep.h: Include unix/i386/sysdep.h to
redefine ENTRY et al.
* sysdeps/unix/sysv/linux/i386/sysdep.h (NO_UNDERSCORES, ENTRY):
Macros removed. The code in unix/i386/sysdep.h should now suffice.
* sysdeps/unix/i386/sysdep.h (ALIGNARG): New macro, defns for
[HAVE_ELF] and not.
(ENTRY): Use it in .align directive.
(CALL_MCOUNT): New macro, empty unless [PROF].
(ENTRY): Do CALL_MCOUNT just after the label.
* Makeconfig (CPPFLAGS-.po): New variable, use -DPROF so assembly
code can call mcount.
Tue Feb 20 23:05:16 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* time/private.h, time/zdump.c, time/zic.c: Updated verbatim from ADO;
translation markings are now integrated in his distribution.
* stdlib/strtod.c (round_and_return): Add missing (mp_limb) 1 cast.
* po: New directory where `LANG.po' files for message translations
will reside.
* po/SYS_libc.pot: New file, template of message strings as in source.
* MakeTAGS: New rules to build po/SYS_libc.pot automatically from
the source using xgettext.
* Makerules ($(..)po/%.pot): New rule.
* manual/Makefile (../po/manual.pot): New target, make it empty.
* sysdeps/unix/bsd/alarm.c: Moved to sysdeps/unix/alarm.c.
* sysdeps/unix/bsd/nice.c: Moved to sysdeps/unix/nice.c.
* sysdeps/unix/bsd/stime.c: Moved to sysdeps/unix/stime.c.
* sysdeps/unix/bsd/time.c: Moved to sysdeps/unix/time.c.
* sysdeps/unix/bsd/utime.c: Moved to sysdeps/unix/utime.c.
1996-02-22 15:52:20 +00:00
|
|
|
/*
|
|
|
|
** For the benefit of GNU folk...
|
1996-02-27 00:55:03 +00:00
|
|
|
** `_(MSGID)' uses the current locale's message library string for MSGID.
|
|
|
|
** The default is to use gettext if available, and use MSGID otherwise.
|
Wed Feb 21 02:25:07 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* Rules (others): Depend on $(extra-objs), $(install-lib),
$(install-bin), $(install-sbin), in object directory.
* Makeconfig (link-libc): Don't pass -rpath option with default
path, since ld.so should use the same default.
* Makerules (build-shlib): Likewise.
* Makerules (make-target-directory): Use mkinstalldirs.
* sysdeps/mach/i386/sysdep.h: Include unix/i386/sysdep.h to
redefine ENTRY et al.
* sysdeps/unix/sysv/linux/i386/sysdep.h (NO_UNDERSCORES, ENTRY):
Macros removed. The code in unix/i386/sysdep.h should now suffice.
* sysdeps/unix/i386/sysdep.h (ALIGNARG): New macro, defns for
[HAVE_ELF] and not.
(ENTRY): Use it in .align directive.
(CALL_MCOUNT): New macro, empty unless [PROF].
(ENTRY): Do CALL_MCOUNT just after the label.
* Makeconfig (CPPFLAGS-.po): New variable, use -DPROF so assembly
code can call mcount.
Tue Feb 20 23:05:16 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* time/private.h, time/zdump.c, time/zic.c: Updated verbatim from ADO;
translation markings are now integrated in his distribution.
* stdlib/strtod.c (round_and_return): Add missing (mp_limb) 1 cast.
* po: New directory where `LANG.po' files for message translations
will reside.
* po/SYS_libc.pot: New file, template of message strings as in source.
* MakeTAGS: New rules to build po/SYS_libc.pot automatically from
the source using xgettext.
* Makerules ($(..)po/%.pot): New rule.
* manual/Makefile (../po/manual.pot): New target, make it empty.
* sysdeps/unix/bsd/alarm.c: Moved to sysdeps/unix/alarm.c.
* sysdeps/unix/bsd/nice.c: Moved to sysdeps/unix/nice.c.
* sysdeps/unix/bsd/stime.c: Moved to sysdeps/unix/stime.c.
* sysdeps/unix/bsd/time.c: Moved to sysdeps/unix/time.c.
* sysdeps/unix/bsd/utime.c: Moved to sysdeps/unix/utime.c.
1996-02-22 15:52:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _
|
1996-02-27 00:55:03 +00:00
|
|
|
#if HAVE_GETTEXT - 0
|
|
|
|
#define _(msgid) gettext(msgid)
|
|
|
|
#else /* !(HAVE_GETTEXT - 0) */
|
|
|
|
#define _(msgid) msgid
|
|
|
|
#endif /* !(HAVE_GETTEXT - 0) */
|
Wed Feb 21 02:25:07 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* Rules (others): Depend on $(extra-objs), $(install-lib),
$(install-bin), $(install-sbin), in object directory.
* Makeconfig (link-libc): Don't pass -rpath option with default
path, since ld.so should use the same default.
* Makerules (build-shlib): Likewise.
* Makerules (make-target-directory): Use mkinstalldirs.
* sysdeps/mach/i386/sysdep.h: Include unix/i386/sysdep.h to
redefine ENTRY et al.
* sysdeps/unix/sysv/linux/i386/sysdep.h (NO_UNDERSCORES, ENTRY):
Macros removed. The code in unix/i386/sysdep.h should now suffice.
* sysdeps/unix/i386/sysdep.h (ALIGNARG): New macro, defns for
[HAVE_ELF] and not.
(ENTRY): Use it in .align directive.
(CALL_MCOUNT): New macro, empty unless [PROF].
(ENTRY): Do CALL_MCOUNT just after the label.
* Makeconfig (CPPFLAGS-.po): New variable, use -DPROF so assembly
code can call mcount.
Tue Feb 20 23:05:16 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* time/private.h, time/zdump.c, time/zic.c: Updated verbatim from ADO;
translation markings are now integrated in his distribution.
* stdlib/strtod.c (round_and_return): Add missing (mp_limb) 1 cast.
* po: New directory where `LANG.po' files for message translations
will reside.
* po/SYS_libc.pot: New file, template of message strings as in source.
* MakeTAGS: New rules to build po/SYS_libc.pot automatically from
the source using xgettext.
* Makerules ($(..)po/%.pot): New rule.
* manual/Makefile (../po/manual.pot): New target, make it empty.
* sysdeps/unix/bsd/alarm.c: Moved to sysdeps/unix/alarm.c.
* sysdeps/unix/bsd/nice.c: Moved to sysdeps/unix/nice.c.
* sysdeps/unix/bsd/stime.c: Moved to sysdeps/unix/stime.c.
* sysdeps/unix/bsd/time.c: Moved to sysdeps/unix/time.c.
* sysdeps/unix/bsd/utime.c: Moved to sysdeps/unix/utime.c.
1996-02-22 15:52:20 +00:00
|
|
|
#endif /* !defined _ */
|
|
|
|
|
1996-02-27 00:55:03 +00:00
|
|
|
#ifndef TZ_DOMAIN
|
|
|
|
#define TZ_DOMAIN "tz"
|
|
|
|
#endif /* !defined TZ_DOMAIN */
|
|
|
|
|
1995-02-18 01:27:10 +00:00
|
|
|
extern char ** environ;
|
|
|
|
extern int getopt();
|
|
|
|
extern char * optarg;
|
|
|
|
extern int optind;
|
|
|
|
extern time_t time();
|
|
|
|
extern char * tzname[2];
|
|
|
|
|
|
|
|
static char * abbr();
|
|
|
|
static long delta();
|
|
|
|
static time_t hunt();
|
|
|
|
static int longest;
|
|
|
|
static char * progname;
|
|
|
|
static void show();
|
|
|
|
|
|
|
|
int
|
|
|
|
main(argc, argv)
|
|
|
|
int argc;
|
|
|
|
char * argv[];
|
|
|
|
{
|
Wed Mar 8 13:38:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* posix/glob/configure.bat: Fixes from DJ.
* time/backward, time/europe, time/northamerica, time/pacificnew,
time/zdump.c, time/zic.c, time/tzfile.h, time/private.h,
time/ialloc.c: Code and data updated from ADO's 95b.
* time/emkdir.c: File removed.
* time/Makefile (distribute, extra-objs, zic): Omit it.
* time/localtime.c: Deansideclized. Never #define __tzname et al
to non-__ names.
* locale/lc-ctype.c (__ctype_tolower, __ctype_toupper): Use int *
instead of short int *.
* ctype/ctype-info.c: Likewise.
* ctype/ctype.h: Likewise.
* locale/langinfo.h (_NL_CTYPE_CLASS): Use this (just one) instead
of EB and EL versions.
1995-03-09 10:00:12 +00:00
|
|
|
register int i;
|
|
|
|
register int c;
|
1995-02-18 01:27:10 +00:00
|
|
|
register int vflag;
|
|
|
|
register char * cutoff;
|
|
|
|
register int cutyear;
|
|
|
|
register long cuttime;
|
|
|
|
char ** fakeenv;
|
|
|
|
time_t now;
|
Wed Mar 8 13:38:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* posix/glob/configure.bat: Fixes from DJ.
* time/backward, time/europe, time/northamerica, time/pacificnew,
time/zdump.c, time/zic.c, time/tzfile.h, time/private.h,
time/ialloc.c: Code and data updated from ADO's 95b.
* time/emkdir.c: File removed.
* time/Makefile (distribute, extra-objs, zic): Omit it.
* time/localtime.c: Deansideclized. Never #define __tzname et al
to non-__ names.
* locale/lc-ctype.c (__ctype_tolower, __ctype_toupper): Use int *
instead of short int *.
* ctype/ctype-info.c: Likewise.
* ctype/ctype.h: Likewise.
* locale/langinfo.h (_NL_CTYPE_CLASS): Use this (just one) instead
of EB and EL versions.
1995-03-09 10:00:12 +00:00
|
|
|
time_t t;
|
|
|
|
time_t newt;
|
1995-02-18 01:27:10 +00:00
|
|
|
time_t hibit;
|
Wed Mar 8 13:38:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* posix/glob/configure.bat: Fixes from DJ.
* time/backward, time/europe, time/northamerica, time/pacificnew,
time/zdump.c, time/zic.c, time/tzfile.h, time/private.h,
time/ialloc.c: Code and data updated from ADO's 95b.
* time/emkdir.c: File removed.
* time/Makefile (distribute, extra-objs, zic): Omit it.
* time/localtime.c: Deansideclized. Never #define __tzname et al
to non-__ names.
* locale/lc-ctype.c (__ctype_tolower, __ctype_toupper): Use int *
instead of short int *.
* ctype/ctype-info.c: Likewise.
* ctype/ctype.h: Likewise.
* locale/langinfo.h (_NL_CTYPE_CLASS): Use this (just one) instead
of EB and EL versions.
1995-03-09 10:00:12 +00:00
|
|
|
struct tm tm;
|
|
|
|
struct tm newtm;
|
1995-02-18 01:27:10 +00:00
|
|
|
|
|
|
|
INITIALIZE(cuttime);
|
1996-02-27 00:55:03 +00:00
|
|
|
#if HAVE_GETTEXT - 0
|
|
|
|
(void) setlocale(LC_MESSAGES, "");
|
|
|
|
#ifdef TZ_DOMAINDIR
|
|
|
|
(void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR);
|
|
|
|
#endif /* defined(TEXTDOMAINDIR) */
|
|
|
|
(void) textdomain(TZ_DOMAIN);
|
|
|
|
#endif /* HAVE_GETTEXT - 0 */
|
1995-02-18 01:27:10 +00:00
|
|
|
progname = argv[0];
|
|
|
|
vflag = 0;
|
|
|
|
cutoff = NULL;
|
|
|
|
while ((c = getopt(argc, argv, "c:v")) == 'c' || c == 'v')
|
|
|
|
if (c == 'v')
|
|
|
|
vflag = 1;
|
|
|
|
else cutoff = optarg;
|
|
|
|
if (c != EOF ||
|
|
|
|
(optind == argc - 1 && strcmp(argv[optind], "=") == 0)) {
|
|
|
|
(void) fprintf(stderr,
|
Sat Nov 25 02:48:47 1995 Ulrich Drepper <drepper@gnu.ai.mit.edu>
* assert/assert-perr.c, assert/assert.c, inet/rcmd.c,
malloc/mcheck.c, malloc/vm-limit.c, posix/getconf.c, posix/id.c,
resolv/herror.c, sunrpc/auth_unix.c, sunrpc/clnt_perr.c,
sunrpc/clnt_raw.c, sunrpc/get_myaddr.c, sunrpc/pmap_clnt.c,
sunrpc/pmap_rmt.c, sunrpc/portmap.c, sunrpc/rpc_main.c,
sunrpc/rpc_parse.c, sunrpc/rpc_scan.c, sunrpc/rpc_util.c,
sunrpc/rpcinfo.c, sunrpc/svc_simple.c, sunrpc/svc_tcp.c,
sunrpc/svc_udp.c, time/zdump.c, time/zic.c: Mark translatable
strings.
Sat Nov 25 02:48:47 1995 Ulrich Drepper <drepper@gnu.ai.mit.edu>
* assert/assert-perr.c, assert/assert.c, inet/rcmd.c,
malloc/mcheck.c, malloc/vm-limit.c, posix/getconf.c, posix/id.c,
resolv/herror.c, sunrpc/auth_unix.c, sunrpc/clnt_perr.c,
sunrpc/clnt_raw.c, sunrpc/get_myaddr.c, sunrpc/pmap_clnt.c,
sunrpc/pmap_rmt.c, sunrpc/portmap.c, sunrpc/rpc_main.c,
sunrpc/rpc_parse.c, sunrpc/rpc_scan.c, sunrpc/rpc_util.c,
sunrpc/rpcinfo.c, sunrpc/svc_simple.c, sunrpc/svc_tcp.c,
sunrpc/svc_udp.c, time/zdump.c, time/zic.c: Mark translatable
strings.
1995-11-26 17:37:11 +00:00
|
|
|
_("%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n"),
|
1995-02-18 01:27:10 +00:00
|
|
|
argv[0], argv[0]);
|
|
|
|
(void) exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
if (cutoff != NULL) {
|
|
|
|
int y;
|
|
|
|
|
|
|
|
cutyear = atoi(cutoff);
|
|
|
|
cuttime = 0;
|
|
|
|
for (y = EPOCH_YEAR; y < cutyear; ++y)
|
|
|
|
cuttime += DAYSPERNYEAR + isleap(y);
|
|
|
|
cuttime *= SECSPERHOUR * HOURSPERDAY;
|
|
|
|
}
|
|
|
|
(void) time(&now);
|
|
|
|
longest = 0;
|
|
|
|
for (i = optind; i < argc; ++i)
|
|
|
|
if (strlen(argv[i]) > longest)
|
|
|
|
longest = strlen(argv[i]);
|
|
|
|
for (hibit = 1; (hibit << 1) != 0; hibit <<= 1)
|
|
|
|
continue;
|
|
|
|
{
|
Wed Mar 8 13:38:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* posix/glob/configure.bat: Fixes from DJ.
* time/backward, time/europe, time/northamerica, time/pacificnew,
time/zdump.c, time/zic.c, time/tzfile.h, time/private.h,
time/ialloc.c: Code and data updated from ADO's 95b.
* time/emkdir.c: File removed.
* time/Makefile (distribute, extra-objs, zic): Omit it.
* time/localtime.c: Deansideclized. Never #define __tzname et al
to non-__ names.
* locale/lc-ctype.c (__ctype_tolower, __ctype_toupper): Use int *
instead of short int *.
* ctype/ctype-info.c: Likewise.
* ctype/ctype.h: Likewise.
* locale/langinfo.h (_NL_CTYPE_CLASS): Use this (just one) instead
of EB and EL versions.
1995-03-09 10:00:12 +00:00
|
|
|
register int from;
|
|
|
|
register int to;
|
1995-02-18 01:27:10 +00:00
|
|
|
|
|
|
|
for (i = 0; environ[i] != NULL; ++i)
|
|
|
|
continue;
|
Wed Mar 8 13:38:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* posix/glob/configure.bat: Fixes from DJ.
* time/backward, time/europe, time/northamerica, time/pacificnew,
time/zdump.c, time/zic.c, time/tzfile.h, time/private.h,
time/ialloc.c: Code and data updated from ADO's 95b.
* time/emkdir.c: File removed.
* time/Makefile (distribute, extra-objs, zic): Omit it.
* time/localtime.c: Deansideclized. Never #define __tzname et al
to non-__ names.
* locale/lc-ctype.c (__ctype_tolower, __ctype_toupper): Use int *
instead of short int *.
* ctype/ctype-info.c: Likewise.
* ctype/ctype.h: Likewise.
* locale/langinfo.h (_NL_CTYPE_CLASS): Use this (just one) instead
of EB and EL versions.
1995-03-09 10:00:12 +00:00
|
|
|
fakeenv = (char **) malloc((size_t) ((i + 2) *
|
|
|
|
sizeof *fakeenv));
|
1995-02-18 01:27:10 +00:00
|
|
|
if (fakeenv == NULL ||
|
Wed Mar 8 13:38:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* posix/glob/configure.bat: Fixes from DJ.
* time/backward, time/europe, time/northamerica, time/pacificnew,
time/zdump.c, time/zic.c, time/tzfile.h, time/private.h,
time/ialloc.c: Code and data updated from ADO's 95b.
* time/emkdir.c: File removed.
* time/Makefile (distribute, extra-objs, zic): Omit it.
* time/localtime.c: Deansideclized. Never #define __tzname et al
to non-__ names.
* locale/lc-ctype.c (__ctype_tolower, __ctype_toupper): Use int *
instead of short int *.
* ctype/ctype-info.c: Likewise.
* ctype/ctype.h: Likewise.
* locale/langinfo.h (_NL_CTYPE_CLASS): Use this (just one) instead
of EB and EL versions.
1995-03-09 10:00:12 +00:00
|
|
|
(fakeenv[0] = (char *) malloc((size_t) (longest +
|
|
|
|
4))) == NULL) {
|
|
|
|
(void) perror(progname);
|
|
|
|
(void) exit(EXIT_FAILURE);
|
1995-02-18 01:27:10 +00:00
|
|
|
}
|
|
|
|
to = 0;
|
|
|
|
(void) strcpy(fakeenv[to++], "TZ=");
|
|
|
|
for (from = 0; environ[from] != NULL; ++from)
|
|
|
|
if (strncmp(environ[from], "TZ=", 3) != 0)
|
|
|
|
fakeenv[to++] = environ[from];
|
|
|
|
fakeenv[to] = NULL;
|
|
|
|
environ = fakeenv;
|
|
|
|
}
|
|
|
|
for (i = optind; i < argc; ++i) {
|
|
|
|
static char buf[MAX_STRING_LENGTH];
|
|
|
|
|
|
|
|
(void) strcpy(&fakeenv[0][3], argv[i]);
|
* time/tzfile.h, time/private.h, time/zdump.c, time/zic.c,
time/africa, time/asia, time/australasia, time/europe,
time/northamerica, time/southamerica: Updated from ADO 96h.
* Make-dist (all-headers): Filter $(sysdep_headers) out of $(headers).
(try-sysdeps, +sysdep-names): Check sysdeps/libm-ieee754 too.
* Makerules (distinfo-vars): Add sysdep_headers.
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Append to
this instead of $(headers).
* sysdeps/unix/sysv/linux/alpha/Makefile: Likewise.
* Make-dist [subdirs-dirs]: Don't prefix $(subdir-dirs) with
$(subdir); we are already there.
* sysdeps/unix/sysv/sysv4/solaris2/sparc/Dist: Removed.
1996-06-05 23:25:04 +00:00
|
|
|
if (!vflag) {
|
|
|
|
show(argv[i], now, FALSE);
|
1995-02-18 01:27:10 +00:00
|
|
|
continue;
|
* time/tzfile.h, time/private.h, time/zdump.c, time/zic.c,
time/africa, time/asia, time/australasia, time/europe,
time/northamerica, time/southamerica: Updated from ADO 96h.
* Make-dist (all-headers): Filter $(sysdep_headers) out of $(headers).
(try-sysdeps, +sysdep-names): Check sysdeps/libm-ieee754 too.
* Makerules (distinfo-vars): Add sysdep_headers.
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Append to
this instead of $(headers).
* sysdeps/unix/sysv/linux/alpha/Makefile: Likewise.
* Make-dist [subdirs-dirs]: Don't prefix $(subdir-dirs) with
$(subdir); we are already there.
* sysdeps/unix/sysv/sysv4/solaris2/sparc/Dist: Removed.
1996-06-05 23:25:04 +00:00
|
|
|
}
|
1995-02-18 01:27:10 +00:00
|
|
|
/*
|
|
|
|
** Get lowest value of t.
|
|
|
|
*/
|
|
|
|
t = hibit;
|
|
|
|
if (t > 0) /* time_t is unsigned */
|
|
|
|
t = 0;
|
|
|
|
show(argv[i], t, TRUE);
|
|
|
|
t += SECSPERHOUR * HOURSPERDAY;
|
|
|
|
show(argv[i], t, TRUE);
|
|
|
|
tm = *localtime(&t);
|
|
|
|
(void) strncpy(buf, abbr(&tm), (sizeof buf) - 1);
|
|
|
|
for ( ; ; ) {
|
|
|
|
if (cutoff != NULL && t >= cuttime)
|
|
|
|
break;
|
|
|
|
newt = t + SECSPERHOUR * 12;
|
|
|
|
if (cutoff != NULL && newt >= cuttime)
|
|
|
|
break;
|
|
|
|
if (newt <= t)
|
|
|
|
break;
|
|
|
|
newtm = *localtime(&newt);
|
|
|
|
if (delta(&newtm, &tm) != (newt - t) ||
|
|
|
|
newtm.tm_isdst != tm.tm_isdst ||
|
|
|
|
strcmp(abbr(&newtm), buf) != 0) {
|
|
|
|
newt = hunt(argv[i], t, newt);
|
|
|
|
newtm = *localtime(&newt);
|
|
|
|
(void) strncpy(buf, abbr(&newtm),
|
|
|
|
(sizeof buf) - 1);
|
|
|
|
}
|
|
|
|
t = newt;
|
|
|
|
tm = newtm;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
** Get highest value of t.
|
|
|
|
*/
|
|
|
|
t = ~((time_t) 0);
|
|
|
|
if (t < 0) /* time_t is signed */
|
|
|
|
t &= ~hibit;
|
|
|
|
t -= SECSPERHOUR * HOURSPERDAY;
|
|
|
|
show(argv[i], t, TRUE);
|
|
|
|
t += SECSPERHOUR * HOURSPERDAY;
|
|
|
|
show(argv[i], t, TRUE);
|
|
|
|
}
|
|
|
|
if (fflush(stdout) || ferror(stdout)) {
|
Sat Nov 25 02:48:47 1995 Ulrich Drepper <drepper@gnu.ai.mit.edu>
* assert/assert-perr.c, assert/assert.c, inet/rcmd.c,
malloc/mcheck.c, malloc/vm-limit.c, posix/getconf.c, posix/id.c,
resolv/herror.c, sunrpc/auth_unix.c, sunrpc/clnt_perr.c,
sunrpc/clnt_raw.c, sunrpc/get_myaddr.c, sunrpc/pmap_clnt.c,
sunrpc/pmap_rmt.c, sunrpc/portmap.c, sunrpc/rpc_main.c,
sunrpc/rpc_parse.c, sunrpc/rpc_scan.c, sunrpc/rpc_util.c,
sunrpc/rpcinfo.c, sunrpc/svc_simple.c, sunrpc/svc_tcp.c,
sunrpc/svc_udp.c, time/zdump.c, time/zic.c: Mark translatable
strings.
Sat Nov 25 02:48:47 1995 Ulrich Drepper <drepper@gnu.ai.mit.edu>
* assert/assert-perr.c, assert/assert.c, inet/rcmd.c,
malloc/mcheck.c, malloc/vm-limit.c, posix/getconf.c, posix/id.c,
resolv/herror.c, sunrpc/auth_unix.c, sunrpc/clnt_perr.c,
sunrpc/clnt_raw.c, sunrpc/get_myaddr.c, sunrpc/pmap_clnt.c,
sunrpc/pmap_rmt.c, sunrpc/portmap.c, sunrpc/rpc_main.c,
sunrpc/rpc_parse.c, sunrpc/rpc_scan.c, sunrpc/rpc_util.c,
sunrpc/rpcinfo.c, sunrpc/svc_simple.c, sunrpc/svc_tcp.c,
sunrpc/svc_udp.c, time/zdump.c, time/zic.c: Mark translatable
strings.
1995-11-26 17:37:11 +00:00
|
|
|
(void) fprintf(stderr, _("%s: Error writing standard output "),
|
1995-02-18 01:27:10 +00:00
|
|
|
argv[0]);
|
Sat Nov 25 02:48:47 1995 Ulrich Drepper <drepper@gnu.ai.mit.edu>
* assert/assert-perr.c, assert/assert.c, inet/rcmd.c,
malloc/mcheck.c, malloc/vm-limit.c, posix/getconf.c, posix/id.c,
resolv/herror.c, sunrpc/auth_unix.c, sunrpc/clnt_perr.c,
sunrpc/clnt_raw.c, sunrpc/get_myaddr.c, sunrpc/pmap_clnt.c,
sunrpc/pmap_rmt.c, sunrpc/portmap.c, sunrpc/rpc_main.c,
sunrpc/rpc_parse.c, sunrpc/rpc_scan.c, sunrpc/rpc_util.c,
sunrpc/rpcinfo.c, sunrpc/svc_simple.c, sunrpc/svc_tcp.c,
sunrpc/svc_udp.c, time/zdump.c, time/zic.c: Mark translatable
strings.
Sat Nov 25 02:48:47 1995 Ulrich Drepper <drepper@gnu.ai.mit.edu>
* assert/assert-perr.c, assert/assert.c, inet/rcmd.c,
malloc/mcheck.c, malloc/vm-limit.c, posix/getconf.c, posix/id.c,
resolv/herror.c, sunrpc/auth_unix.c, sunrpc/clnt_perr.c,
sunrpc/clnt_raw.c, sunrpc/get_myaddr.c, sunrpc/pmap_clnt.c,
sunrpc/pmap_rmt.c, sunrpc/portmap.c, sunrpc/rpc_main.c,
sunrpc/rpc_parse.c, sunrpc/rpc_scan.c, sunrpc/rpc_util.c,
sunrpc/rpcinfo.c, sunrpc/svc_simple.c, sunrpc/svc_tcp.c,
sunrpc/svc_udp.c, time/zdump.c, time/zic.c: Mark translatable
strings.
1995-11-26 17:37:11 +00:00
|
|
|
(void) perror(_("standard output"));
|
1995-02-18 01:27:10 +00:00
|
|
|
(void) exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
|
|
|
|
/* gcc -Wall pacifier */
|
|
|
|
for ( ; ; )
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
static time_t
|
|
|
|
hunt(name, lot, hit)
|
|
|
|
char * name;
|
|
|
|
time_t lot;
|
|
|
|
time_t hit;
|
|
|
|
{
|
|
|
|
time_t t;
|
|
|
|
struct tm lotm;
|
|
|
|
struct tm tm;
|
|
|
|
static char loab[MAX_STRING_LENGTH];
|
|
|
|
|
|
|
|
lotm = *localtime(&lot);
|
|
|
|
(void) strncpy(loab, abbr(&lotm), (sizeof loab) - 1);
|
|
|
|
while ((hit - lot) >= 2) {
|
|
|
|
t = lot / 2 + hit / 2;
|
|
|
|
if (t <= lot)
|
|
|
|
++t;
|
|
|
|
else if (t >= hit)
|
|
|
|
--t;
|
|
|
|
tm = *localtime(&t);
|
|
|
|
if (delta(&tm, &lotm) == (t - lot) &&
|
|
|
|
tm.tm_isdst == lotm.tm_isdst &&
|
|
|
|
strcmp(abbr(&tm), loab) == 0) {
|
|
|
|
lot = t;
|
|
|
|
lotm = tm;
|
|
|
|
} else hit = t;
|
|
|
|
}
|
|
|
|
show(name, lot, TRUE);
|
|
|
|
show(name, hit, TRUE);
|
|
|
|
return hit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
** Thanks to Paul Eggert (eggert@twinsun.com) for logic used in delta.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static long
|
|
|
|
delta(newp, oldp)
|
|
|
|
struct tm * newp;
|
|
|
|
struct tm * oldp;
|
|
|
|
{
|
|
|
|
long result;
|
|
|
|
int tmy;
|
|
|
|
|
|
|
|
if (newp->tm_year < oldp->tm_year)
|
|
|
|
return -delta(oldp, newp);
|
|
|
|
result = 0;
|
|
|
|
for (tmy = oldp->tm_year; tmy < newp->tm_year; ++tmy)
|
|
|
|
result += DAYSPERNYEAR + isleap(tmy + TM_YEAR_BASE);
|
|
|
|
result += newp->tm_yday - oldp->tm_yday;
|
|
|
|
result *= HOURSPERDAY;
|
|
|
|
result += newp->tm_hour - oldp->tm_hour;
|
|
|
|
result *= MINSPERHOUR;
|
|
|
|
result += newp->tm_min - oldp->tm_min;
|
|
|
|
result *= SECSPERMIN;
|
|
|
|
result += newp->tm_sec - oldp->tm_sec;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern struct tm * localtime();
|
|
|
|
|
|
|
|
static void
|
|
|
|
show(zone, t, v)
|
|
|
|
char * zone;
|
|
|
|
time_t t;
|
|
|
|
int v;
|
|
|
|
{
|
|
|
|
struct tm * tmp;
|
|
|
|
|
|
|
|
(void) printf("%-*s ", longest, zone);
|
|
|
|
if (v)
|
|
|
|
(void) printf("%.24s GMT = ", asctime(gmtime(&t)));
|
|
|
|
tmp = localtime(&t);
|
|
|
|
(void) printf("%.24s", asctime(tmp));
|
|
|
|
if (*abbr(tmp) != '\0')
|
|
|
|
(void) printf(" %s", abbr(tmp));
|
|
|
|
if (v) {
|
|
|
|
(void) printf(" isdst=%d", tmp->tm_isdst);
|
|
|
|
#ifdef TM_GMTOFF
|
|
|
|
(void) printf(" gmtoff=%ld", tmp->TM_GMTOFF);
|
|
|
|
#endif /* defined TM_GMTOFF */
|
|
|
|
}
|
|
|
|
(void) printf("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
abbr(tmp)
|
|
|
|
struct tm * tmp;
|
|
|
|
{
|
|
|
|
register char * result;
|
|
|
|
static char nada;
|
|
|
|
|
|
|
|
if (tmp->tm_isdst != 0 && tmp->tm_isdst != 1)
|
|
|
|
return &nada;
|
|
|
|
result = tzname[tmp->tm_isdst];
|
|
|
|
return (result == NULL) ? &nada : result;
|
|
|
|
}
|