BSD 4_3_Reno release
[unix-history] / usr / src / sbin / dump / unctime.c
index d127536..fe535d5 100644 (file)
@@ -1,6 +1,16 @@
-static char *sccsid = "@(#)unctime.c   1.1 (Berkeley) %G%";
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)unctime.c  5.1 (Berkeley) 6/5/85";
+#endif not lint
+
 #include <sys/types.h>
 #include <sys/types.h>
-#include <time.h>
+#include <sys/time.h>
+#include <stdio.h>
 /*
  * 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.
@@ -30,8 +40,9 @@ 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)
+       if ( (then.tm_mon = lookup(&dbuf[E_MONTH])) < 0) {
                return(-1);;
                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]);
@@ -73,7 +84,7 @@ time_t emitl(dp)
        dcopy = *dp;
        dp = &dcopy;
        conv = 0;
        dcopy = *dp;
        dp = &dcopy;
        conv = 0;
-       for (i = 31; i >= 0; i--) {
+       for (i = 30; i >= 0; i--) {
                bit = 1 << i;
                conv |= bit;
                if (dcmp(localtime(&conv), dp) > 0)
                bit = 1 << i;
                conv |= bit;
                if (dcmp(localtime(&conv), dp) > 0)