aboutsummaryrefslogtreecommitdiffstats
path: root/usr.sbin/zic/zdump.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/zic/zdump.c')
-rw-r--r--usr.sbin/zic/zdump.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/usr.sbin/zic/zdump.c b/usr.sbin/zic/zdump.c
index 1058a840efa2..094e17251a54 100644
--- a/usr.sbin/zic/zdump.c
+++ b/usr.sbin/zic/zdump.c
@@ -1,6 +1,6 @@
#ifndef lint
#ifndef NOID
-static char elsieid[] = "@(#)zdump.c 7.24";
+static char elsieid[] = "@(#)zdump.c 7.28";
#endif /* !defined NOID */
#endif /* !defined lint */
@@ -111,19 +111,28 @@ static char elsieid[] = "@(#)zdump.c 7.24";
#define TZ_DOMAIN "tz"
#endif /* !defined TZ_DOMAIN */
+#ifndef P
+#ifdef __STDC__
+#define P(x) x
+#endif /* defined __STDC__ */
+#ifndef __STDC__
+#define P(x) ()
+#endif /* !defined __STDC__ */
+#endif /* !defined P */
+
extern char ** environ;
-extern int getopt();
+extern int getopt P((int argc, char * const argv[],
+ const char * options));
extern char * optarg;
extern int optind;
-extern time_t time();
extern char * tzname[2];
-static char * abbr();
-static long delta();
-static time_t hunt();
-static int longest;
+static char * abbr P((struct tm * tmp));
+static long delta P((struct tm * newp, struct tm * oldp));
+static time_t hunt P((char * name, time_t lot, time_t hit));
+static size_t longest;
static char * progname;
-static void show();
+static void show P((char * zone, time_t t, int v));
int
main(argc, argv)
@@ -159,7 +168,7 @@ char * argv[];
if (c == 'v')
vflag = 1;
else cutoff = optarg;
- if (c != EOF ||
+ if ((c != EOF && c != -1) ||
(optind == argc - 1 && strcmp(argv[optind], "=") == 0)) {
(void) fprintf(stderr,
_("%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n"),
@@ -191,8 +200,7 @@ _("%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n"),
fakeenv = (char **) malloc((size_t) ((i + 2) *
sizeof *fakeenv));
if (fakeenv == NULL ||
- (fakeenv[0] = (char *) malloc((size_t) (longest +
- 4))) == NULL) {
+ (fakeenv[0] = (char *) malloc(longest + 4)) == NULL) {
(void) perror(progname);
(void) exit(EXIT_FAILURE);
}
@@ -255,7 +263,7 @@ _("%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n"),
show(argv[i], t, TRUE);
}
if (fflush(stdout) || ferror(stdout)) {
- (void) fprintf(stderr, _("%s: Error writing standard output "),
+ (void) fprintf(stderr, _("%s: Error writing "),
argv[0]);
(void) perror(_("standard output"));
(void) exit(EXIT_FAILURE);
@@ -326,8 +334,6 @@ struct tm * oldp;
return result;
}
-extern struct tm * localtime();
-
static void
show(zone, t, v)
char * zone;
@@ -336,9 +342,9 @@ int v;
{
struct tm * tmp;
- (void) printf("%-*s ", longest, zone);
+ (void) printf("%-*s ", (int) longest, zone);
if (v)
- (void) printf("%.24s GMT = ", asctime(gmtime(&t)));
+ (void) printf("%.24s UTC = ", asctime(gmtime(&t)));
tmp = localtime(&t);
(void) printf("%.24s", asctime(tmp));
if (*abbr(tmp) != '\0')