mirror of
https://frontier.innolan.net/rainlance/amiga-tz.git
synced 2026-09-30 07:40:27 +00:00
more typecheck work
SCCS-file: zdump.c SCCS-SID: 7.60
This commit is contained in:
committed by
Paul Eggert
parent
d81f811957
commit
9505b0cecb
@@ -154,6 +154,42 @@ static void show P((char * zone, time_t t, int v));
|
|||||||
static const char * tformat P((void));
|
static const char * tformat P((void));
|
||||||
static time_t yeartot P((long y));
|
static time_t yeartot P((long y));
|
||||||
|
|
||||||
|
#ifndef TYPECHECK
|
||||||
|
#define my_localtime localtime
|
||||||
|
#else /* !defined TYPECHECK */
|
||||||
|
static struct tm *
|
||||||
|
my_localtime(tp)
|
||||||
|
time_t * tp;
|
||||||
|
{
|
||||||
|
register struct tm * tmp;
|
||||||
|
|
||||||
|
tmp = localtime(tp);
|
||||||
|
if (tp != NULL && tmp != NULL) {
|
||||||
|
struct tm tm;
|
||||||
|
register time_t t;
|
||||||
|
|
||||||
|
tm = *tmp;
|
||||||
|
t = mktime(&tm);
|
||||||
|
if (t - *tp >= 1 || *tp - t >= 1) {
|
||||||
|
(void) fflush(stdout);
|
||||||
|
(void) fprintf(stderr, "\n%s: ", progname);
|
||||||
|
(void) fprintf(stderr, tformat(), *tp);
|
||||||
|
(void) fprintf(stderr, " ->");
|
||||||
|
(void) fprintf(stderr, " sec %d", tmp->tm_sec);
|
||||||
|
(void) fprintf(stderr, " min %d", tmp->tm_min);
|
||||||
|
(void) fprintf(stderr, " hour %d", tmp->tm_hour);
|
||||||
|
(void) fprintf(stderr, " mday %d", tmp->tm_mday);
|
||||||
|
(void) fprintf(stderr, " mon %d", tmp->tm_mon);
|
||||||
|
(void) fprintf(stderr, " year %d", tmp->tm_year);
|
||||||
|
(void) fprintf(stderr, " -> ");
|
||||||
|
(void) fprintf(stderr, tformat(), t);
|
||||||
|
(void) fprintf(stderr, "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
#endif /* !defined TYPECHECK */
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
@@ -266,7 +302,7 @@ _("%s: usage is %s [ --version ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n"),
|
|||||||
show(argv[i], t, TRUE);
|
show(argv[i], t, TRUE);
|
||||||
if (t < cutlotime)
|
if (t < cutlotime)
|
||||||
t = cutlotime;
|
t = cutlotime;
|
||||||
tmp = localtime(&t);
|
tmp = my_localtime(&t);
|
||||||
if (tmp != NULL) {
|
if (tmp != NULL) {
|
||||||
tm = *tmp;
|
tm = *tmp;
|
||||||
(void) strncpy(buf, abbr(&tm), (sizeof buf) - 1);
|
(void) strncpy(buf, abbr(&tm), (sizeof buf) - 1);
|
||||||
@@ -399,7 +435,7 @@ time_t hit;
|
|||||||
register struct tm * tmp;
|
register struct tm * tmp;
|
||||||
char loab[MAX_STRING_LENGTH];
|
char loab[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
lotmp = localtime(&lot);
|
lotmp = my_localtime(&lot);
|
||||||
if (lotmp != NULL) {
|
if (lotmp != NULL) {
|
||||||
lotm = *lotmp;
|
lotm = *lotmp;
|
||||||
(void) strncpy(loab, abbr(&lotm), (sizeof loab) - 1);
|
(void) strncpy(loab, abbr(&lotm), (sizeof loab) - 1);
|
||||||
@@ -414,7 +450,7 @@ time_t hit;
|
|||||||
++t;
|
++t;
|
||||||
else if (t >= hit)
|
else if (t >= hit)
|
||||||
--t;
|
--t;
|
||||||
tmp = localtime(&t);
|
tmp = my_localtime(&t);
|
||||||
if (tmp != NULL)
|
if (tmp != NULL)
|
||||||
tm = *tmp;
|
tm = *tmp;
|
||||||
if ((lotmp == NULL || tmp == NULL) ? (lotmp == tmp) :
|
if ((lotmp == NULL || tmp == NULL) ? (lotmp == tmp) :
|
||||||
@@ -477,7 +513,7 @@ int v;
|
|||||||
}
|
}
|
||||||
(void) printf(" = ");
|
(void) printf(" = ");
|
||||||
}
|
}
|
||||||
tmp = localtime(&t);
|
tmp = my_localtime(&t);
|
||||||
dumptime(tmp);
|
dumptime(tmp);
|
||||||
if (tmp != NULL) {
|
if (tmp != NULL) {
|
||||||
if (*abbr(tmp) != '\0')
|
if (*abbr(tmp) != '\0')
|
||||||
|
|||||||
Reference in New Issue
Block a user