]> git.wh0rd.org - dump.git/blobdiff - dump/optr.c
Check for the e2fsprogs header <ext2fs/ext2_fs.h> instead of the kernel header if...
[dump.git] / dump / optr.c
index 9383cf6b69614f1378bc9daadb5e67859004adf0..471ea5b9693bf4556186e858fd94aa77339206ef 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: optr.c,v 1.19 2001/02/21 16:13:05 stelian Exp $";
+       "$Id: optr.c,v 1.23 2001/06/18 10:58:28 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -61,10 +61,15 @@ static const char rcsid[] =
 #include <sys/stat.h>
 
 #ifdef __linux__
+#ifdef HAVE_EXT2FS_EXT2_FS_H
+#include <ext2fs/ext2_fs.h>
+#else
 #include <linux/ext2_fs.h>
+#endif
 #include <ext2fs/ext2fs.h>
 #include <bsdcompat.h>
 #include <signal.h>
+#include <time.h>
 #endif
 
 #include "dump.h"
@@ -100,11 +105,7 @@ query(const char *question)
        FILE    *mytty;
        time_t  firstprompt, when_answered;
 
-#ifdef __linux__
-       (void)time4(&(firstprompt));
-#else
-       (void)time((time_t *)&(firstprompt));
-#endif
+       firstprompt = time(NULL);
 
        if ((mytty = fopen(_PATH_TTY, "r")) == NULL)
                quit("fopen on %s fails: %s\n", _PATH_TTY, strerror(errno));
@@ -137,16 +138,12 @@ query(const char *question)
        if (signal(SIGALRM, sig) == SIG_IGN)
                signal(SIGALRM, SIG_IGN);
        (void) fclose(mytty);
-#ifdef __linux__
-       (void)time4(&(when_answered));
-#else
-       (void)time((time_t *)&(when_answered));
-#endif
+       when_answered = time(NULL);
        /*
         * Adjust the base for time estimates to ignore time we spent waiting
         * for operator input.
         */
-       if ((tstart_writing != 0) && (when_answered != (time_t)-1) && (firstprompt != (time_t)-1))
+       if (tstart_writing != 0)
                tstart_writing += (when_answered - firstprompt);
        return(back);
 }
@@ -246,7 +243,7 @@ broadcast(const char *message)
                return;
        }
 
-       clock = time((time_t *)0);
+       clock = time(NULL);
        localclock = localtime(&clock);
 
        if ((f_utmp = fopen(_PATH_UTMP, "r")) == NULL) {
@@ -323,13 +320,8 @@ time_t     tschedule = 0;
 void
 timeest(void)
 {
-       time_t tnow;
+       time_t tnow = time(NULL);
 
-#ifdef __linux__
-       (void) time4(&tnow);
-#else
-       (void) time((time_t *) &tnow);
-#endif
        if (tnow >= tschedule) {
                char *buf = mktimeest(tnow);
                tschedule = tnow + 300;
@@ -504,7 +496,7 @@ fstabsearch(const char *key)
 {
        register struct pfstab *pf;
        register struct fstab *fs;
-       char *rn;
+       const char *rn;
 
        for (pf = table; pf != NULL; pf = pf->pf_next) {
                fs = pf->pf_fstab;
@@ -600,7 +592,7 @@ lastdump(char arg) /* w ==> just what to do; W ==> most recent dumps */
        struct pfstab *pf;
        time_t tnow;
 
-       (void) time(&tnow);
+       tnow = time(NULL);
        getfstab();             /* /etc/fstab input */
        initdumptimes(0);       /* dumpdates input */
        if (ddatev == NULL && table == NULL) {