1
0
mirror of https://frontier.innolan.net/rainlance/amiga-tz.git synced 2025-11-21 04:33:44 +00:00

137 Commits

Author SHA1 Message Date
06cd2ed30a AmigaOS modifications 2015-06-22 23:49:55 +02:00
79d9677def AmigaOS changes 2015-06-20 23:29:11 +02:00
bfc08e664e Port 'bool' usage to clang 3.4.
* date.c (convert, reset):
Fix prototype to match function, as the C standard requires.
2014-08-25 19:41:21 -07:00
234c9c3b13 Fix unlikely buffer overrun when setting date across network.
* date.c (netsettime) [TSP_SETDATE]: Don't assume gethostname
returns a null-terminated string.
2014-08-25 08:19:48 -07:00
7eb7c7349c Use bool for boolean.
The tz source code predates C99 and so used int, 0 and 1 for boolean,
but nowadays bool is available and makes the code clearer.
Include backwards-compatibility definitions for pre-C99 platforms,
and don't go beyond what the backwards-compatibility defintions support.
* date.c (main, reset, sametm, convert, checkfinal, iffy, netsettime):
* localtime.c (struct ttinfo, struct state, gmt_is_set)
(differ_by_repeat, tzload, typesequiv, getoffset, transtime)
(tzparse, gmtload, tzsetwall_unlocked, tzset_unlocked, gmtcheck)
(localtime_tzset, timesub, increment_overflow)
(increment_overflow32, increment_overflow_time)
(normalize_overflow, normalize_overflow32, time2sub, time2)
(time1):
* strftime.c (_fmt, _yconv, _loc):
* zdump.c (warned, errout, is_alpha, my_localtime, abbrok)
(main, hunt, show):
* zic.c (struct rule, errors, warnings, leapseen, noise)
(leap_types, ttisstds, ttisgmts, error, warning, main, dolink)
(associate, infile, gethms, inzone, inzcont, inzsub, inleap)
(rulesub, is32, writezone, doabbr, stringoffset, stringrule)
(stringzone, outzone, addtype, leapadd, yearistype, is_space)
(is_alpha, ciequal, itsabbr, mkdirs):
Use bool for boolean.
* localtime.c (tzload, tzparse):
* zic.c (stringoffset, mkdirs):
Return true for success and false for failure instead of 0 and -1.
All callers changed.
* private.h, zdump.c (TRUE, FALSE): Remove, replacing by ...
(true, false, bool): Define by <stdbool.h> if C99 or later,
by macros otherwise.
* tzfile.h: Remove mention of TRUE and FALSE from commentary.
* zic.c (addtype): Remove now-unnecessary checks that a bool is a
boolean.
2014-08-25 08:19:48 -07:00
5bfa967c17 Avoid (void) before calls.
Although the cast to void in usage like '(void) printf ("Hello")'
may have been helpful decades ago when Lint Was Your Friend,
nowadays such casts are not helpful.  The tz code is currently not
consistent about this: sometimes the casts are present, and
sometimes absent.  As they make the code harder to read, let's
remove them.
* asctime.c, date.c, ialloc.c, localtime.c, strftime.c, zdump.c, zic.c:
Don't cast calls to 'void'.
2014-08-25 08:19:47 -07:00
6bc7f54afa * date.c, localtime.c, zdump.c: Simplify prototypes for static functions
by removing prototypes that aren't needed, and by removing names
of arguments.  This will make future changes simpler and easier to
follow.
* NEWS: Document this.
2014-08-25 08:19:47 -07:00
a95a6ddad1 date: port to Ubuntu 14.04 with -DHAVE_UTMPX_H=1
* date.c (WTMPX_FILE): Define to _PATH_WTMPX if not already defined
and if _PATH_WTMPX is defined.
(reset): Do not use WTMPX_FILE if it is not defined.
* NEWS: Document this.
2014-08-25 08:19:47 -07:00
da8d4338f2 Minor spelling, accent, or English fixes. 2014-08-06 22:51:12 -07:00
99544d30aa Update to pacify recent GCC's static checking.
These changes pacify gcc 4.8.2-19ubuntu1 on Ubuntu 14.04,
and take advantage of recently-added GCC options when compiling
with GCC_DEBUG_FLAGS.
* Makefile (GCC_DEBUG_FLAGS): Add -Wdeclaration-after-statement,
-Wjump-misses-init, -Wsuggest-attribute=format.
* date.c (copyright, sccsid):
* strftime.c (sccsid):
Remove unused vars.
* date.c (main):
* localtime.c (tzparse):
Remove no-longer-needed uses of INITIALIZE; GCC is smart enough to
figure these out on its own now.
* localtime.c (gmtsub): Redo initialization of gmt_is_set to pacify GCC.
Retry malloc next time even if it failed this time.
* private.h, zdump.c (GNUC_or_lint): Remove, as it provoked a GCC
diagnostic about unused macros in some cases.  Instead, just use
'lint'.  All uses removed.
(TZ_DOMAIN): Don't define unless needed, as otherwise it provokes
a GCC diagnostic about unused macros.
* private.h (INITIALIZE): Simplify accordingly.
* NEWS: Document this.
2014-06-18 23:35:58 -07:00
a577b388f3 Distinguish hyphen from minus from dashes.
Most of this patch is to commentary, to distinguish better among
the similar characters hyphen '-', minus sign '−', en dash '–' (used
for ranges), and em dash '—'.  Render ordinary dashes in text as
spaced en dashes, as this gives better-looking results in monospaced
fonts.
* yearistype.sh, zic.c: Reword diagnostics so that they do not use
hyphens as if they were dashes.  Since we are sticking to ASCII in
programs, we can't use proper dashes in diagnostics.
2014-06-17 18:46:31 -07:00
9a8aa790bc Don't abuse "`" to mean open quote.
This was appropriate before Unicode, where "`" and "'" often balanced
in visual output, but that's been obsolete for a while.
Overall, single-quote 'like this' instead of `like this', and
double-quote "like this" or (in typeset output) “like this”
instead of ``like this''.  While we're at it, fix some glitches
with hyphens versus minus versus en dash versus em dash.
* Makefile ($(MANTXTS)): Use UTF-8 locale to produce *.txt output.
* checktab.awk, tzselect.ksh:
Quote 'like this' in diagnostics, instead of `like this'.
* date.1, newctime.3, newtzset.3, time2posix.3, zic.8 (q, lq, rq):
New macros.  Use them for better double-quoting in output.
* workman.sh: Tell Perl that its stdin and stdout are UTF-8.
* NEWS: Document this.
2014-06-15 13:27:37 -07:00
42801d2b1f Correct some UTC-vs-UT solecisms.
In several places the code and documentation incorrectly used
"UTC" to describe time stamps that might precede the introduction
of UTC and for which UTC is therefore undefined.  Change these
uses to "UT", as that's the correct term when talking about these
time stamps.  Problem reported by Steve Allen in
<http://mm.icann.org/pipermail/tz/2013-September/019907.html>.
The major compatibility issue here is with 'zdump -v'; it'll now
output "UT" instead of the possibly-incorrect "UTC".
Many files change in minor ways in the commentary.
* zdump.c (show):
* zic.c (inzsub, addtype):
In output, say "UT" rather than "UTC", since the time stamp we're
talking about might precede the introduction of UTC.
2013-09-04 19:07:31 -07:00
98cf55b78e * date.c (nondigit): Add ATTRIBUTE_PURE, to pacify GCC 4.8.1. 2013-08-16 22:02:27 -07:00
b90b803c05 Add FreeBSD-style -r option to 'date'.
* date.1: Document -r.
* date.c (main, usage): Support -r.
(main, reset): Remove EBUG code.
(display): New argument NOW.  Do not exit; that's now the
caller's responsibility.  All callers changed.
(display, timeout, convert, checkfinal, iffy):
Don't assume that localtime and gmtime succeed.
This prevents a core dump for, e.g., 'date -r 0xffffffffffffffff'.
* private.h: Include float.h.
(strtoimax): New macro, for pre-C99 systems that lack strtoimax.
(time_t_min, time_t_max): New constants, from zdump, with
different names to avoid a clash when zdump.c includes private.h.
2013-08-09 02:01:31 -07:00
3e560d0811 * date.c: Pacify GCC 4.7.3.
(atof, getlogin, mktime, strchr, time, strftime):
Remove old-style declarations.  GCC 4.7.3 warns about them,
and they aren't needed nowadays anyway.
(main) [HAVE_SETTIMEOFDAY != 2]: "Use" dsttime and minuteswest
to pacify GCC 4.7.3.
2013-08-08 10:18:15 -07:00
f0133dd86a Port to NetBSD, where, e.g., 'time_t' is wider than 'long'.
I audited the code and fixed as many width-asssumptions as I could
find, including several places where the code assumed that 'time_t'
was no wider than 'long'; this assumption is not true on 32-bit
NetBSD platforms.  This caught every problem that is already fixed
in the NetBSD zic.c, and caught quite a few more.
* Makefile: Add comments re HAVE_DOS_FILE_NAMES and HAVE_INTTYPES_H.
* date.c (checkfinal, netsettime): Don't use 'long' where 'int' will do.
* difftime.c (difftime): Mark with ATTRIBUTE_CONST.
Use uintmax_t, not unsigned long, for the widest unsigned integer type.
Use long double, not double, if time_t is wider than uintmax_t;
this can in theory help on nonstandard platforms, such as GCC
with 64-bit uintmax_t and 128-bit __int128_t.
* localtime.c (struct ttinfo.tt_gmtoff, struct rule.r_time)
(detzcode, getsecs, getoffset, gmtsub, localsub, increment_overflow32)
(normalize_overflow32, time1, time2, timesub, transtime, tzparse)
(time2sub, timeoff, gtime):
* tzfile.h (SECSPERDAY):
* zdump.c (SECSPERDAY):
* zic.c (convert, puttzcode):
Use int_fast32_t, not long, when all we care is that values up to
2**31 can be stored.  This doesn't fix any bugs, but it allows
more opportunity for compiler optimization.
(struct lsinfo.ls_corr, timesub, leapcorr):
Use int_fast64_t, not long, when values up to 2**63 can be stored.
(timesub): Make it clearer when we are truncating 0.5 to 0.
(increment_overflow32): Rename from long_increment_overflow.
All uses changed.
(normalize_overflow32): Rename from long_normalize_overflow.
All uses changed.
* private.h (HAVE_INTTYPES_H, ATTRIBUTE_CONST): New macros.
Include <inttypes.h> if HAVE_INTTYPES_H.
(INT_FAST64_MIN, INT_FAST64_MAX, SCNdFAST64, int_fast32_t, PRIdMAX)
(uintmax_t, PRIuMAX, _Noreturn):
Define to reasonable values if it's an older compiler.
* scheck.c (scheck): Add support for arbitrary formats, such as
those that SCNdFAST64 can expand to, at the price of no longer
supporting weird conversion specs like "%[%]".
* strftime.c (_fmt): Use intmax_t and uintmax_t to format time_t,
not long and unsigned long.
* zdump.c (int_fast32_t, intmax_t, PRIdMAX, SCNdMAX):
Define for pre-C99 compilers, like private.h does.
(delta, yeartot, main): Use intmax_t, not long.
(hunt): Use time_t, not long, since the diff must be nonnegative.
(tformat): Allow for time_t wider than long.
* zic.c (ZIC_MIN, ZIC_MAX, SCNdZIC): New macros.
(OFFSET_STRLEN_MAXIMUM, RULE_STRLEN_MAXIMUM): Remove.
(struct rule): Make r_loyear, r_hiyear, r_tod, r_stdoff, z_gmtoff,
z_stdoff zic_t, not long.
(addtype, gethms, oadd, rpytime, tadd, gmtoffs, corr, inleap)
(stringoffset, stringrule, outzone, addtype, adjleap, rpytime)
(LDAYSPERWEEK):
Use zic_t, not long.
(leapminyear, leapmaxyear, min_year, max_year, rulesub, updateminmax)
(outzone, rpytime):
Use zic_t, not int.
(usage): Now _Noreturn.
(main): Use S_IWGRP, not 'unix', to determine whether to call umask.
(writezone): Omit unnecessary cast.
(mkdirs): Use HAVE_DOS_FILE_NAMES, not 'unix', to determine
whether to parse DOS file anmes.
(eitol): Remove; no longer needed.
2013-05-27 21:26:18 -07:00
2151ca6b20 Restore 'register'.
* asctime.c (asctime_r, asctime):
* date.c (main, dogmt, reset, nondigit, sametm, convert, checkfinal):
* ialloc.c (icatalloc):
* localtime.c (detzcode, detzcode64, settzname, tzload)
(typesequiv, getzname, getqzname, getnum, getsecs, getoffset)
(getrule, transtime, tzparse, tzset, localsub, gmtsub)
(leaps_thru_end_of, timesub, increment_overflow)
(long_increment_overflow, normalize_overflow)
(long_normalize_overflow, tmcomp, time2sub, time1, leapcorr):
* scheck.c (scheck):
* strftime.c (_yconv):
* zdump.c (my_localtime, abbrok, main, yeartot, hunt)
(delta, show, abbr, dumptime):
* zic.c (main, dolink, itsdir, associate, infile, inrule)
(inzone, inzcont, inzsub, inleap, inlink, rulesub, convert64)
(writezone, doabbr, stringoffset, stringrule, stringzone)
(outzone, addtype, leapadd, adjleap, ciequal, itsabbr, byword)
(getfields, rpytime, newabbr, mkdirs):
Restore the uses of 'register', reverting that part of the
"More C modernization" patch.  See Arthur David Olson in
<http://mm.icann.org/pipermail/tz/2012-October/018385.html>.
2012-10-26 17:37:42 -07:00
c350bfd55f More C modernization.
* Makefile (typecheck): Add -D__time_t_defined to CFLAGS,
for glibc 2.15.
* asctime.c (asctime_r, asctime):
* date.c (main, dogmt, reset, nondigit, sametm, convert, checkfinal):
* ialloc.c (icatalloc):
* localtime.c (detzcode, detzcode64, settzname, tzload)
(typesequiv, getzname, getqzname, getnum, getsecs, getoffset)
(getrule, transtime, tzparse, tzset, localsub, gmtsub)
(leaps_thru_end_of, timesub, increment_overflow)
(long_increment_overflow, normalize_overflow)
(long_normalize_overflow, tmcomp, time2sub, time1, leapcorr):
* scheck.c (scheck):
* strftime.c (_yconv):
* zdump.c (my_localtime, abbrok, main, yeartot, hunt)
(delta, show, abbr, dumptime):
* zic.c (main, dolink, itsdir, associate, infile, inrule)
(inzone, inzcont, inzsub, inleap, inlink, rulesub, convert64)
(writezone, doabbr, stringoffset, stringrule, stringzone)
(outzone, addtype, leapadd, adjleap, ciequal, itsabbr, byword)
(getfields, rpytime, newabbr, mkdirs):
Omit 'register', as it adds no value these days.  See Christos Zoulas in
<http://mm.icann.org/pipermail/tz/2012-October/018376.html>.
* date.c (netsettime) [TSP_SETDATE]: Add forward decl.
Don't rely on implicit int.  Now static.  Use NULL, not 0.
* zdump.c: Include "limits.h".
(absolute_min_time, absolute_max_time): Compute at compile-time,
as the run-time tests relied on undefined behavior.
(checkabsolutes): Rename from setabsolutes.  Just check, since
there's nothing to set now.  All uses changed.
2012-10-26 00:48:01 -07:00
400ecf36bb Assume C89.
* Makefile (GCC_DEBUG_FLAGS): Modernize for GCC 4.6.3 x86.
* asctime.c (asctime_r, asctime):
* date.c (main, dogmt, reset, wildinput, nondigit, oops, display)
(timeout, sametm, netsettime):
* difftime.c (difftime):
* ialloc.c (icatalloc, icpyalloc):
* localtime.c (detzcode, detzcode64, differ_by_repeat)
(tzload, typesequiv, getzname, getnum, getsecs, getoffset)
(getrule, transtime, tzparse, gmtload, tzsetwall, tzset)
(localsub, localtime, localtime_r, gmtsub, gmtime, gmtime_r)
(offtime, leaps_thru_end_of, timesub, ctime, ctime_r)
(increment_overflow, long_increment_overflow)
(normalize_overflow, long_normalize_overflow, tmcomp, time2sub)
(time2, time1, mktime, timelocal, timegm, timeoff, gtime)
(leapcorr, time2posix, posix2time):
* scheck.c (scheck):
* strftime.c (strftime, _fmt, _conv, _add, _yconv, _loc):
* zdump.c (my_localtime, abbrok, usage, main, yeartot)
(delta, abbr, dumptime):
* zic.c (memcheck, eats, eat, error, warning, main)
(dolink, itsdir, rcomp, associate, infile, gethms, inrule)
(inzone, inzcont, inzsub, inleap, inlink, rulesub, convert)
(convert64, puttzcode, puttzcode64, atcomp, is32, writezone, DO)
(doabbr, updateminmax, stringoffset, stringrule, stringzone)
(outzone, addtt, addtype, leapadd, yearistype, lowerit, ciequal)
(itsabbr, byword, getfields, oadd, tadd, rpytime, newabbr)
(mkdirs, eitol):
Assume C89 or better.  Mostly this consists of using function
prototypes.  In a few places, prototypes are required for
portability to hosts where time_t does not promote to itself and
where a preceding prototype does not override a definition.  But
while we're at it we might as well be consistent: it's safe to
assume at-least-C89 these days.
* ialloc.c (nonzero, imalloc, icalloc, irealloc, ifree, icfree):
Remove; no longer needed now that we assume C89 or better.
All callers changed to use malloc, calloc, realloc, free.
* localtime.c (getzname, getqzname, leaps_thru_end_of, transtime):
* zdump.c (delta, yeartot):
* zic.c (eitol):
Now pure.
* private.h, zdump.c (ATTRIBUTE_PURE): New macro.
* private.h (icalloc, imalloc, irealloc, icfree, ifree): Remove decls.
* zic.c: Remove no-longer-necessary forward decls.
(max_time, min_time): Now const.
(setboundaries): Remove.
2012-10-12 07:53:12 -07:00
dccd5a16af Switch from SCCS to git.
Remove the SCCS keyword '%W%' from all files.
Mostly this just remove comments.
Remove trailing white space, too.
* Makefile (TZCODE_VERSION): New macro.
(version.h): New rule.
(tzselect): Interpolate TZCODE_VERSION.
(clean): Remove version.h.
(zdump.o, zic.o): Depend on version.h.
* asctime.c, date.c, difftime.c, ialloc.c, localtime.c, scheck.c:
* strftime.c, zdump.c, zic.c: Remove elsieid.
* private.h: Remove privatehid.
* tzfile.h: Remove tzfilehid.
* tzselect.h (TZCODE_VERSION): Rename from VERSION.
* zdump.c, zic.c: Include "version.h",
and use TZCODE_VERSION instead of elsieid.
2012-07-18 17:30:38 -07:00
e2d04a6625 change comptm to savetm to avoid possible overflow
SCCS-file: date.c
SCCS-SID: 8.5
2012-07-18 03:03:11 -04:00
0b443afe62 noncontroversial changes
SCCS-file: date.c
SCCS-SID: 8.4
2012-07-18 03:03:03 -04:00
50055a8fa5 P macro goes
SCCS-file: date.c
SCCS-SID: 8.3
2012-07-18 03:03:02 -04:00
0a696ef691 STDC elimination
SCCS-file: date.c
SCCS-SID: 8.2
2012-07-18 03:02:57 -04:00
1f06ee0c1d White-suggested STDC mods
SCCS-file: date.c
SCCS-SID: 7.45
2012-07-18 03:02:52 -04:00
5bc67b96f1 Pizzini long mod
SCCS-file: date.c
SCCS-SID: 7.44
2012-07-18 03:02:52 -04:00
bafe80dccf Eggert STDC mods
SCCS-file: date.c
SCCS-SID: 7.43
2012-07-18 03:02:52 -04:00
571d9bc24e eliminate cast of exit result
SCCS-file: date.c
SCCS-SID: 7.42
2012-07-18 03:02:51 -04:00
825cc4e5a0 delinted
SCCS-file: date.c
SCCS-SID: 7.41
2012-07-18 03:02:47 -04:00
dca47d48c1 modular arithmetic
SCCS-file: date.c
SCCS-SID: 7.40
2012-07-18 03:02:45 -04:00
f20f271478 setlocale work
SCCS-file: date.c
SCCS-SID: 7.39
2012-07-18 03:02:45 -04:00
ccdf029666 eggert mods
SCCS-file: date.c
SCCS-SID: 7.38
2012-07-18 03:02:38 -04:00
846872c18a sizeof style
SCCS-file: date.c
SCCS-SID: 7.37
2012-07-18 03:02:38 -04:00
73cd968d87 Eggert mods
SCCS-file: date.c
SCCS-SID: 7.36
2012-07-18 03:02:36 -04:00
efbbcfd1c6 void return bug fix
SCCS-file: date.c
SCCS-SID: 7.35
2012-07-18 03:02:34 -04:00
c4df15977c Eggert mods
SCCS-file: date.c
SCCS-SID: 7.34
2012-07-18 03:02:29 -04:00
91d0099d94 getopt work
SCCS-file: date.c
SCCS-SID: 7.33
2012-07-18 03:02:26 -04:00
77b5a31346 yet more GNU work
SCCS-file: date.c
SCCS-SID: 7.32
2012-07-18 03:02:22 -04:00
f8151ae8a1 Eggert suggested changes
SCCS-file: date.c
SCCS-SID: 7.31
2012-07-18 03:02:22 -04:00
5c316b13e3 eggert mods
SCCS-file: date.c
SCCS-SID: 7.30
2012-07-18 03:02:20 -04:00
cf3233e7ac US/ goes
SCCS-file: date.c
SCCS-SID: 7.29
2012-07-18 03:02:20 -04:00
556c6f3f7d zap space-tab sequences
SCCS-file: date.c
SCCS-SID: 7.28
2012-07-18 03:02:18 -04:00
23ac75d5a0 HAVE_SETLOCALE goes
SCCS-file: date.c
SCCS-SID: 7.27
2012-07-18 03:02:17 -04:00
0a177f5bff simplified
SCCS-file: date.c
SCCS-SID: 7.26
2012-07-18 03:02:17 -04:00
837d68e985 delinting
SCCS-file: date.c
SCCS-SID: 7.25
2012-07-18 03:02:17 -04:00
4f81d4e480 defluffed
SCCS-file: date.c
SCCS-SID: 7.24
2012-07-18 03:02:16 -04:00
5200d1f0b4 endif commentary added
SCCS-file: date.c
SCCS-SID: 7.23
2012-07-18 03:02:16 -04:00
ff94981fc9 more spacing work
SCCS-file: date.c
SCCS-SID: 7.22
2012-07-18 03:02:16 -04:00
0c5580d4fa simplified #if
SCCS-file: date.c
SCCS-SID: 7.21
2012-07-18 03:02:16 -04:00