speedups and cleanups
[unix-history] / usr / src / sbin / dump / main.c
index 9c062af..78a3b8c 100644 (file)
@@ -1,10 +1,13 @@
-static char *sccsid = "@(#)main.c      1.6 (Berkeley) %G%";
+static char *sccsid = "@(#)main.c      1.10 (Berkeley) %G%";
 #include "dump.h"
 
 int    notify = 0;     /* notify operator flag */
 int    blockswritten = 0;      /* number of blocks written on current tape */
 int    tapeno = 0;     /* current tape number */
 int    density = 160;  /* density in 0.1" units */
 #include "dump.h"
 
 int    notify = 0;     /* notify operator flag */
 int    blockswritten = 0;      /* number of blocks written on current tape */
 int    tapeno = 0;     /* current tape number */
 int    density = 160;  /* density in 0.1" units */
+#ifdef RDUMP
+char   *host;
+#endif
 
 main(argc, argv)
        int     argc;
 
 main(argc, argv)
        int     argc;
@@ -106,7 +109,19 @@ main(argc, argv)
                argc--;
                disk = *argv;
        }
                argc--;
                disk = *argv;
        }
-
+#ifdef RDUMP
+       { char *index();
+         host = tape;
+         tape = index(host, ':');
+         if (tape == 0) {
+               msg("need keyletter ``f'' and device ``host:tape''");
+               exit(1);
+         }
+         *tape++ = 0;
+         if (rmthost(host) == 0)
+               exit(X_ABORT);
+       }
+#endif
        if (signal(SIGHUP, sighup) == SIG_IGN)
                signal(SIGHUP, SIG_IGN);
        if (signal(SIGTRAP, sigtrap) == SIG_IGN)
        if (signal(SIGHUP, sighup) == SIG_IGN)
                signal(SIGHUP, SIG_IGN);
        if (signal(SIGTRAP, sigtrap) == SIG_IGN)
@@ -142,7 +157,11 @@ main(argc, argv)
        msg("Dumping %s ", disk);
        if (dt != 0)
                msgtail("(%s) ", dt->fs_file);
        msg("Dumping %s ", disk);
        if (dt != 0)
                msgtail("(%s) ", dt->fs_file);
+#ifdef RDUMP
+       msgtail("to %s on host %s\n", tape, host);
+#else
        msgtail("to %s\n", tape);
        msgtail("to %s\n", tape);
+#endif
 
        fi = open(disk, 0);
        if (fi < 0) {
 
        fi = open(disk, 0);
        if (fi < 0) {
@@ -204,13 +223,19 @@ main(argc, argv)
        pass(dump, nodmap);
 
        spcl.c_type = TS_END;
        pass(dump, nodmap);
 
        spcl.c_type = TS_END;
-       for(i = 0; i < NTREC; i++)
+#ifndef RDUMP
+       for(i=0; i<NTREC; i++)
                spclrec();
                spclrec();
+#endif
        msg("DUMP: %ld tape blocks on %d tape(s)\n",spcl.c_tapea,spcl.c_volume);
        msg("DUMP IS DONE\n");
 
        putitime();
        msg("DUMP: %ld tape blocks on %d tape(s)\n",spcl.c_tapea,spcl.c_volume);
        msg("DUMP IS DONE\n");
 
        putitime();
+#ifndef RDUMP
        close(to);
        close(to);
+#else
+       tflush(1);
+#endif
        rewind();
        broadcast("DUMP IS DONE!\7\7\n");
        Exit(X_FINOK);
        rewind();
        broadcast("DUMP IS DONE!\7\7\n");
        Exit(X_FINOK);