zdump.c (30829) | zdump.c (42997) |
---|---|
1#ifndef lint 2#ifndef NOID | 1#ifndef lint 2#ifndef NOID |
3static char elsieid[] = "@(#)zdump.c 7.24"; | 3static char elsieid[] = "@(#)zdump.c 7.28"; |
4#endif /* !defined NOID */ 5#endif /* !defined lint */ 6 7#ifndef lint 8static const char rcsid[] = | 4#endif /* !defined NOID */ 5#endif /* !defined lint */ 6 7#ifndef lint 8static const char rcsid[] = |
9 "$Id$"; | 9 "$Id: zdump.c,v 1.5 1999/01/21 17:12:49 wollman Exp $"; |
10#endif /* not lint */ 11 12/* 13** This code has been made independent of the rest of the time 14** conversion package to increase confidence in the verification it provides. 15** You can use this code to help in verifying other implementations. 16*/ 17 --- 95 unchanged lines hidden (view full) --- 113#define _(msgid) msgid 114#endif /* !(HAVE_GETTEXT - 0) */ 115#endif /* !defined _ */ 116 117#ifndef TZ_DOMAIN 118#define TZ_DOMAIN "tz" 119#endif /* !defined TZ_DOMAIN */ 120 | 10#endif /* not lint */ 11 12/* 13** This code has been made independent of the rest of the time 14** conversion package to increase confidence in the verification it provides. 15** You can use this code to help in verifying other implementations. 16*/ 17 --- 95 unchanged lines hidden (view full) --- 113#define _(msgid) msgid 114#endif /* !(HAVE_GETTEXT - 0) */ 115#endif /* !defined _ */ 116 117#ifndef TZ_DOMAIN 118#define TZ_DOMAIN "tz" 119#endif /* !defined TZ_DOMAIN */ 120 |
121#ifndef P 122#ifdef __STDC__ 123#define P(x) x 124#endif /* defined __STDC__ */ 125#ifndef __STDC__ 126#define P(x) () 127#endif /* !defined __STDC__ */ 128#endif /* !defined P */ 129 |
|
121extern char ** environ; 122extern char * tzname[2]; 123 | 130extern char ** environ; 131extern char * tzname[2]; 132 |
124static char * abbr(); 125static long delta(); 126static time_t hunt(); 127static int longest; 128static void show(); 129static void usage __P((void)); | 133static char * abbr P((struct tm * tmp)); 134static long delta P((struct tm * newp, struct tm * oldp)); 135static time_t hunt P((char * name, time_t lot, time_t hit)); 136static size_t longest; 137static char * progname; 138static void show P((char * zone, time_t t, int v)); |
130 131int 132main(argc, argv) 133int argc; 134char * argv[]; 135{ 136 register int i; 137 register int c; --- 18 unchanged lines hidden (view full) --- 156 (void) textdomain(TZ_DOMAIN); 157#endif /* HAVE_GETTEXT - 0 */ 158 vflag = 0; 159 cutoff = NULL; 160 while ((c = getopt(argc, argv, "c:v")) == 'c' || c == 'v') 161 if (c == 'v') 162 vflag = 1; 163 else cutoff = optarg; | 139 140int 141main(argc, argv) 142int argc; 143char * argv[]; 144{ 145 register int i; 146 register int c; --- 18 unchanged lines hidden (view full) --- 165 (void) textdomain(TZ_DOMAIN); 166#endif /* HAVE_GETTEXT - 0 */ 167 vflag = 0; 168 cutoff = NULL; 169 while ((c = getopt(argc, argv, "c:v")) == 'c' || c == 'v') 170 if (c == 'v') 171 vflag = 1; 172 else cutoff = optarg; |
164 if (c != EOF || | 173 if ((c != EOF && c != -1) || |
165 (optind == argc - 1 && strcmp(argv[optind], "=") == 0)) { 166 usage(); 167 } 168 if (cutoff != NULL) { 169 int y; 170 171 cutyear = atoi(cutoff); 172 cuttime = 0; --- 149 unchanged lines hidden (view full) --- 322 result += newp->tm_hour - oldp->tm_hour; 323 result *= MINSPERHOUR; 324 result += newp->tm_min - oldp->tm_min; 325 result *= SECSPERMIN; 326 result += newp->tm_sec - oldp->tm_sec; 327 return result; 328} 329 | 174 (optind == argc - 1 && strcmp(argv[optind], "=") == 0)) { 175 usage(); 176 } 177 if (cutoff != NULL) { 178 int y; 179 180 cutyear = atoi(cutoff); 181 cuttime = 0; --- 149 unchanged lines hidden (view full) --- 331 result += newp->tm_hour - oldp->tm_hour; 332 result *= MINSPERHOUR; 333 result += newp->tm_min - oldp->tm_min; 334 result *= SECSPERMIN; 335 result += newp->tm_sec - oldp->tm_sec; 336 return result; 337} 338 |
330extern struct tm * localtime(); 331 | |
332static void 333show(zone, t, v) 334char * zone; 335time_t t; 336int v; 337{ 338 struct tm * tmp; 339 | 339static void 340show(zone, t, v) 341char * zone; 342time_t t; 343int v; 344{ 345 struct tm * tmp; 346 |
340 (void) printf("%-*s ", longest, zone); | 347 (void) printf("%-*s ", (int) longest, zone); |
341 if (v) | 348 if (v) |
342 (void) printf("%.24s GMT = ", asctime(gmtime(&t))); | 349 (void) printf("%.24s UTC = ", asctime(gmtime(&t))); |
343 tmp = localtime(&t); 344 (void) printf("%.24s", asctime(tmp)); 345 if (*abbr(tmp) != '\0') 346 (void) printf(" %s", abbr(tmp)); 347 if (v) { 348 (void) printf(" isdst=%d", tmp->tm_isdst); 349#ifdef TM_GMTOFF 350 (void) printf(" gmtoff=%ld", tmp->TM_GMTOFF); --- 17 unchanged lines hidden --- | 350 tmp = localtime(&t); 351 (void) printf("%.24s", asctime(tmp)); 352 if (*abbr(tmp) != '\0') 353 (void) printf(" %s", abbr(tmp)); 354 if (v) { 355 (void) printf(" isdst=%d", tmp->tm_isdst); 356#ifdef TM_GMTOFF 357 (void) printf(" gmtoff=%ld", tmp->TM_GMTOFF); --- 17 unchanged lines hidden --- |