]> git.wh0rd.org - dump.git/blobdiff - dump/optr.c
Andreas Dilger fixes (CPP, ext2 features, const char etc).
[dump.git] / dump / optr.c
index 99d7295cbb04ae5470ffcc5abb47dce027dc5199..b8e6ff5e28cdeaf756b95c41572ba9007a2cd7dd 100644 (file)
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: optr.c,v 1.16 2000/12/04 15:43:16 stelian Exp $";
+       "$Id: optr.c,v 1.21 2001/03/19 13:22:48 stelian Exp $";
 #endif /* not lint */
 
+#include <config.h>
 #include <sys/param.h>
 #include <sys/wait.h>
 #include <sys/time.h>
@@ -64,6 +65,7 @@ static const char rcsid[] =
 #include <ext2fs/ext2fs.h>
 #include <bsdcompat.h>
 #include <signal.h>
+#include <time.h>
 #endif
 
 #include "dump.h"
@@ -322,7 +324,7 @@ time_t      tschedule = 0;
 void
 timeest(void)
 {
-       time_t  tnow, deltat;
+       time_t tnow;
 
 #ifdef __linux__
        (void) time4(&tnow);
@@ -330,17 +332,13 @@ timeest(void)
        (void) time((time_t *) &tnow);
 #endif
        if (tnow >= tschedule) {
+               char *buf = mktimeest(tnow);
                tschedule = tnow + 300;
-               if (blockswritten < 500)
-                       return;
-               if (blockswritten > tapesize)
-                       tapesize = blockswritten;
-               deltat = tstart_writing - tnow +
-                       (1.0 * (tnow - tstart_writing))
-                       / blockswritten * tapesize;
-               msg("%3.2f%% done, finished in %d:%02d\n",
-                       (blockswritten * 100.0) / tapesize,
-                       deltat / 3600, (deltat % 3600) / 60);
+               if (buf) {
+                       fprintf(stderr, "  DUMP: ");
+                       fwrite(buf, strlen(buf), 1, stderr);
+                       fflush(stderr);
+               }
        }
 }
 
@@ -507,7 +505,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;
@@ -570,7 +568,7 @@ static void
 print_wmsg(char arg, int dumpme, const char *dev, int level,
           const char *mtpt, time_t ddate)
 {
-       char *date;
+       char *date = NULL;
        
        if (ddate) {
                char *d;