temporarily add ifdef sunos (includes) to assist Steve Romig in debugging
[unix-history] / usr / src / sbin / dump / unctime.c
index 45a8882..ba2bedc 100644 (file)
@@ -1,10 +1,22 @@
+/*-
+ * Copyright (c) 1980 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * %sccs.include.redist.c%
+ */
+
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)unctime.c  1.5 (Berkeley) %G%";
-#endif
+static char sccsid[] = "@(#)unctime.c  5.4 (Berkeley) %G%";
+#endif /* not lint */
 
 #include <sys/types.h>
 
 #include <sys/types.h>
-#include <sys/time.h>
+#include <time.h>
 #include <stdio.h>
 #include <stdio.h>
+#ifdef __STDC__
+#include <stdlib.h>
+#include <string.h>
+#endif
+
 /*
  * Convert a ctime(3) format string into a system format date.
  * Return the date thus calculated.
 /*
  * Convert a ctime(3) format string into a system format date.
  * Return the date thus calculated.
@@ -23,7 +35,10 @@ static char sccsid[] = "@(#)unctime.c        1.5 (Berkeley) %G%";
 #define        E_SECOND        17
 #define        E_YEAR          20
 
 #define        E_SECOND        17
 #define        E_YEAR          20
 
-time_t unctime(str)
+static int lookup();
+
+time_t
+unctime(str)
        char *str;
 {
        struct tm then;
        char *str;
 {
        struct tm then;
@@ -34,9 +49,8 @@ time_t unctime(str)
                str[25] = 0;
        strcpy(dbuf, str);
        dbuf[E_MONTH+3] = 0;
                str[25] = 0;
        strcpy(dbuf, str);
        dbuf[E_MONTH+3] = 0;
-       if ( (then.tm_mon = lookup(&dbuf[E_MONTH])) < 0) {
-               return(-1);;
-       }
+       if ((then.tm_mon = lookup(&dbuf[E_MONTH])) < 0)
+               return (-1);
        then.tm_mday = atoi(&dbuf[E_DAY]);
        then.tm_hour = atoi(&dbuf[E_HOUR]);
        then.tm_min = atoi(&dbuf[E_MINUTE]);
        then.tm_mday = atoi(&dbuf[E_DAY]);
        then.tm_hour = atoi(&dbuf[E_HOUR]);
        then.tm_min = atoi(&dbuf[E_MINUTE]);
@@ -48,7 +62,7 @@ time_t unctime(str)
 static char months[] =
        "JanFebMarAprMayJunJulAugSepOctNovDec";
 
 static char months[] =
        "JanFebMarAprMayJunJulAugSepOctNovDec";
 
-static
+static int
 lookup(str)
        char *str;
 {
 lookup(str)
        char *str;
 {
@@ -67,8 +81,10 @@ lookup(str)
  */
 
 struct tm *localtime();
  */
 
 struct tm *localtime();
+static int dcmp();
 
 
-time_t emitl(dp)
+time_t
+emitl(dp)
        struct tm *dp;
 {
        time_t conv;
        struct tm *dp;
 {
        time_t conv;
@@ -97,7 +113,7 @@ time_t emitl(dp)
        if (dp->a < dp2->a) \
                return(-1)
 
        if (dp->a < dp2->a) \
                return(-1)
 
-static
+static int
 dcmp(dp, dp2)
        register struct tm *dp, *dp2;
 {
 dcmp(dp, dp2)
        register struct tm *dp, *dp2;
 {