/* ** tzdump - display time zone info in TZ format ** ** Example: ** tzdump Australia/ACT ** ** This program was almost named unzic. However, since zic's input isn't ** fully recoverable from its output, that name would be a bit misleading. */ #if !defined(lint) && !defined(__lint) static const char rcsid[] = "@(#)$Id$"; static const char rcsname[] = "@(#)$Name$"; /* ** Bugs: ** o There should be a method for searching for timezone name and ** abbreviation aliases. */ # define RCSID rcsid # define RCSNAME rcsname #else # define RCSID NULL # define RCSNAME NULL #endif #ifdef ENABLETRACE # define TRACE(args) (void)printf args #else # define TRACE(args) #endif /* Ought to have an autoconf configure script */ #define HAVE_STRNCPY #define HAVE_STRNCAT #undef HAVE_SNPRINTF #include #include #include #include #include #include #include #include #include "tzfile.h" #ifndef TZNAME_MAX #endif #ifndef TZDIR # define TZDIR "/usr/share/lib/zoneinfo" #endif #ifndef MAXPATHLEN # define MAXPATHLEN 1024 #endif #ifndef SECSPERMIN # define SECSPERMIN 60 #endif #ifndef MINSPERHOUR # define MINSPERHOUR 60 #endif #ifndef SECSPERHOUR # define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) #endif #define TIMEBUFSIZE 16 #define ZIBUFSIZE 4096 #if 0 /* From Solaris 2.5 and 2.6 */ #define TZ_MAX_TIMES 370 #define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ #define TZ_MAX_TYPES 20 /* Maximum number of local time types */ #define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ #define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ #endif /* 0 */ #if 0 /* Compute size required for ZoneInfoBufferSize */ sizeof (struct tzhead) + TZ_MAX_TIMES * (4 + 1) * sizeof (char) + TZ_MAX_TYPES * (4 + 2) * sizeof (char) + TZ_MAX_CHARS * sizeof (char) + TZ_MAX_LEAPS * (4 + 4) * sizeof (char) + TZ_MAX_TYPES * sizeof (char) # ifdef STRUCT_TZHEAD_TTISGMTCNT + TZ_MAX_TYPES * sizeof (char) # endif #endif /* 0 */ char *usage = "[timezone ...]"; char *help = ""; char *progname, *filename; char *zoneinfopath = NULL; int quietflag = 0; int verboseflag = 0; char *comment = ""; /* ** TZ variable can either be: ** : ** ("zoneinfo timezone") ** or ** [[]][,[/