e flag, not c flag
[unix-history] / usr / src / old / dump.4.1 / dumpmain.c
index c89dd92..68502c1 100644 (file)
@@ -1,4 +1,13 @@
-static char *sccsid = "@(#)dumpmain.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[] = "@(#)dumpmain.c 5.1 (Berkeley) %G%";
+#endif not lint
+
 #include "dump.h"
 
 int    notify = 0;     /* notify operator flag */
 #include "dump.h"
 
 int    notify = 0;     /* notify operator flag */
@@ -34,8 +43,12 @@ main(argc, argv)
        }
        while(*arg)
        switch (*arg++) {
        }
        while(*arg)
        switch (*arg++) {
+       case 'w':
+               lastdump('w');          /* tell us only what has to be done */
+               exit(0);
+               break;
        case 'W':                       /* what to do */
        case 'W':                       /* what to do */
-               lastdump();
+               lastdump('W');          /* tell us the current state of what has been done */
                exit(0);                /* do nothing else */
                break;
 
                exit(0);                /* do nothing else */
                break;
 
@@ -91,9 +104,13 @@ 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);
        }
                Exit(X_ABORT);
        }
+       if(strcmp(tape, "-") == 0) {
+               pipeout++;
+               tape = "standard output";
+       }
        if(argc > 1) {
                argv++;
                argc--;
        if(argc > 1) {
                argv++;
                argc--;
@@ -194,8 +211,10 @@ main(argc, argv)
        msg("DUMP IS DONE\n");
 
        putitime();
        msg("DUMP IS DONE\n");
 
        putitime();
-       close(to);
-       rewind();
+       if (!pipeout) {
+               close(to);
+               rewind();
+       }
        broadcast("DUMP IS DONE!\7\7\n");
        Exit(X_FINOK);
 }
        broadcast("DUMP IS DONE!\7\7\n");
        Exit(X_FINOK);
 }
@@ -221,7 +240,7 @@ char *rawname(cp)
        char *cp;
 {
        static char rawbuf[32];
        char *cp;
 {
        static char rawbuf[32];
-       char *dp = rindex(cp, '/');
+       char *dp = (char *)rindex(cp, '/');
 
        if (dp == 0)
                return (0);
 
        if (dp == 0)
                return (0);