re-read /etc/dumpdates before updating it
[unix-history] / usr / src / sbin / dump / main.c
index 2eb3a78..816a56a 100644 (file)
@@ -1,4 +1,4 @@
-static char *sccsid = "@(#)main.c      1.11 (Berkeley) %G%";
+static char *sccsid = "@(#)main.c      1.12 (Berkeley) %G%";
 #include "dump.h"
 
 int    notify = 0;     /* notify operator flag */
 #include "dump.h"
 
 int    notify = 0;     /* notify operator flag */
@@ -115,7 +115,7 @@ main(argc, argv)
                break;
 
        default:
                break;
 
        default:
-               printf("bad key '%c%'\n", arg[-1]);
+               fprintf(stderr, "bad key '%c%'\n", arg[-1]);
                Exit(X_ABORT);
        }
        if(argc > 1) {
                Exit(X_ABORT);
        }
        if(argc > 1) {
@@ -123,6 +123,10 @@ main(argc, argv)
                argc--;
                disk = *argv;
        }
                argc--;
                disk = *argv;
        }
+       if (strcmp(tape, "-") == 0) {
+               pipeout++;
+               tape = "standard output";
+       }
 
        /*
         * Determine how to default tape size and density
 
        /*
         * Determine how to default tape size and density
@@ -280,11 +284,14 @@ main(argc, argv)
 
        putitime();
 #ifndef RDUMP
 
        putitime();
 #ifndef RDUMP
-       close(to);
+       if (!pipeout) {
+               close(to);
+               rewind();
+       }
 #else
        tflush(1);
 #else
        tflush(1);
-#endif
        rewind();
        rewind();
+#endif
        broadcast("DUMP IS DONE!\7\7\n");
        Exit(X_FINOK);
 }
        broadcast("DUMP IS DONE!\7\7\n");
        Exit(X_FINOK);
 }
@@ -299,6 +306,10 @@ int        sigterm(){      msg("SIGTERM()  try rewriting\n"); sigAbort();}
 
 sigAbort()
 {
 
 sigAbort()
 {
+       if (pipeout) {
+               msg("Unknown signal, cannot recover\n");
+               dumpabort();
+       }
        msg("Rewriting attempted as response to unknown signal.\n");
        fflush(stderr);
        fflush(stdout);
        msg("Rewriting attempted as response to unknown signal.\n");
        fflush(stderr);
        fflush(stdout);