diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2015-02-09 15:02:31 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2015-02-09 15:02:31 +0000 |
commit | e516c1d61056c1ed40142a0aeeca1696285fa498 (patch) | |
tree | aed6bc4e8477fcd0c67efc93b44efbadf502fd86 /usr.sbin/zdump | |
parent | 4d5906c2cb9ac6fd59ae9045216bd86151b0a486 (diff) |
uncast
Diffstat (limited to 'usr.sbin/zdump')
-rw-r--r-- | usr.sbin/zdump/zdump.c | 82 |
1 files changed, 40 insertions, 42 deletions
diff --git a/usr.sbin/zdump/zdump.c b/usr.sbin/zdump/zdump.c index 1395f6ec993..b816d19ff5c 100644 --- a/usr.sbin/zdump/zdump.c +++ b/usr.sbin/zdump/zdump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zdump.c,v 1.5 2015/02/09 13:46:22 tedu Exp $ */ +/* $OpenBSD: zdump.c,v 1.6 2015/02/09 15:02:30 tedu Exp $ */ /* ** This file is in the public domain, so clarified as of ** 2009-05-17 by Arthur David Olson. @@ -126,20 +126,20 @@ time_t * tp; 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, " year=%d", tmp->tm_year); - (void) fprintf(stderr, " mon=%d", tmp->tm_mon); - (void) fprintf(stderr, " mday=%d", tmp->tm_mday); - (void) fprintf(stderr, " hour=%d", tmp->tm_hour); - (void) fprintf(stderr, " min=%d", tmp->tm_min); - (void) fprintf(stderr, " sec=%d", tmp->tm_sec); - (void) fprintf(stderr, " isdst=%d", tmp->tm_isdst); - (void) fprintf(stderr, " -> "); - (void) fprintf(stderr, tformat(), t); - (void) fprintf(stderr, "\n"); + fflush(stdout); + fprintf(stderr, "\n%s: ", progname); + fprintf(stderr, tformat(), *tp); + fprintf(stderr, " ->"); + fprintf(stderr, " year=%d", tmp->tm_year); + fprintf(stderr, " mon=%d", tmp->tm_mon); + fprintf(stderr, " mday=%d", tmp->tm_mday); + fprintf(stderr, " hour=%d", tmp->tm_hour); + fprintf(stderr, " min=%d", tmp->tm_min); + fprintf(stderr, " sec=%d", tmp->tm_sec); + fprintf(stderr, " isdst=%d", tmp->tm_isdst); + fprintf(stderr, " -> "); + fprintf(stderr, tformat(), t); + fprintf(stderr, "\n"); } } return tmp; @@ -177,9 +177,8 @@ const char * const zone; } if (wp == NULL) return; - (void) fflush(stdout); - (void) fprintf(stderr, - _("%s: warning: zone \"%s\" abbreviation \"%s\" %s\n"), + fflush(stdout); + fprintf(stderr, _("%s: warning: zone \"%s\" abbreviation \"%s\" %s\n"), progname, zone, abbrp, wp); warned = TRUE; } @@ -189,8 +188,7 @@ usage(stream, status) FILE * const stream; const int status; { - (void) fprintf(stream, -_("usage: %s [-v] [-c [loyear,]hiyear] zonename ...\n"), progname); + fprintf(stream, _("usage: %s [-v] [-c [loyear,]hiyear] zonename ...\n"), progname); exit(status); } @@ -242,7 +240,7 @@ char * argv[]; cutloyear = lo; cuthiyear = hi; } else { -(void) fprintf(stderr, _("%s: wild -c argument %s\n"), + fprintf(stderr, _("%s: wild -c argument %s\n"), progname, cutarg); exit(EXIT_FAILURE); } @@ -251,7 +249,7 @@ char * argv[]; cutlotime = yeartot(cutloyear); cuthitime = yeartot(cuthiyear); } - (void) time(&now); + time(&now); longest = 0; for (i = optind; i < argc; ++i) if (strlen(argv[i]) > longest) @@ -262,12 +260,11 @@ char * argv[]; for (i = 0; environ[i] != NULL; ++i) continue; - fakeenv = (char **) malloc((size_t) ((i + 2) * - sizeof *fakeenv)); + fakeenv = malloc((size_t) ((i + 2) * sizeof *fakeenv)); if (fakeenv == NULL || - (fakeenv[0] = (char *) malloc(longest + 4)) == NULL) { - (void) perror(progname); - exit(EXIT_FAILURE); + (fakeenv[0] = malloc(longest + 4)) == NULL) { + perror(progname); + exit(EXIT_FAILURE); } to = 0; strlcpy(fakeenv[to++], "TZ=", longest + 4); @@ -327,8 +324,8 @@ char * argv[]; show(argv[i], t, TRUE); } if (fflush(stdout) || ferror(stdout)) { - (void) fprintf(stderr, "%s: ", progname); - (void) perror(_("Error writing to standard output")); + fprintf(stderr, "%s: ", progname); + perror(_("Error writing to standard output")); exit(EXIT_FAILURE); } exit(EXIT_SUCCESS); @@ -427,7 +424,7 @@ hunt(char *name, time_t lot, time_t hit) lotmp = my_localtime(&lot); if (lotmp != NULL) { lotm = *lotmp; - (void) strlcpy(loab, abbr(&lotm), sizeof loab); + strlcpy(loab, abbr(&lotm), sizeof loab); } for ( ; ; ) { diff = (long) (hit - lot); @@ -488,30 +485,30 @@ show(char *zone, time_t t, int v) { struct tm * tmp; - (void) printf("%-*s ", (int) longest, zone); + printf("%-*s ", (int) longest, zone); if (v) { tmp = gmtime(&t); if (tmp == NULL) { - (void) printf(tformat(), t); + printf(tformat(), t); } else { dumptime(tmp); - (void) printf(" UTC"); + printf(" UTC"); } - (void) printf(" = "); + printf(" = "); } tmp = my_localtime(&t); dumptime(tmp); if (tmp != NULL) { if (*abbr(tmp) != '\0') - (void) printf(" %s", abbr(tmp)); + printf(" %s", abbr(tmp)); if (v) { - (void) printf(" isdst=%d", tmp->tm_isdst); + printf(" isdst=%d", tmp->tm_isdst); #ifdef TM_GMTOFF - (void) printf(" gmtoff=%ld", tmp->TM_GMTOFF); + printf(" gmtoff=%ld", tmp->TM_GMTOFF); #endif /* defined TM_GMTOFF */ } } - (void) printf("\n"); + printf("\n"); if (tmp != NULL && *abbr(tmp) != '\0') abbrok(abbr(tmp), zone); } @@ -573,7 +570,7 @@ const struct tm * timeptr; int trail; if (timeptr == NULL) { - (void) printf("NULL"); + printf("NULL"); return; } /* @@ -589,7 +586,7 @@ const struct tm * timeptr; (int) (sizeof mon_name / sizeof mon_name[0])) mn = "???"; else mn = mon_name[timeptr->tm_mon]; - (void) printf("%.3s %.3s%3d %.2d:%.2d:%.2d ", + printf("%.3s %.3s%3d %.2d:%.2d:%.2d ", wn, mn, timeptr->tm_mday, timeptr->tm_hour, timeptr->tm_min, timeptr->tm_sec); @@ -606,6 +603,7 @@ const struct tm * timeptr; ++lead; } if (lead == 0) - (void) printf("%d", trail); - else (void) printf("%d%d", lead, ((trail < 0) ? -trail : trail)); + printf("%d", trail); + else + printf("%d%d", lead, ((trail < 0) ? -trail : trail)); } |