Annotation of researchv8dc/cmd/rp07rest.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  *     rp07rest: quick and dirty to copy 4 reels of tape to RP07
                      3:  *     Tape errors are not tolerated.  Input errors are ignored.
                      4:  */
                      5: 
                      6: #include <stdio.h>
                      7: #include <assert.h>
                      8: 
                      9: #define TAPE "/dev/rmt2"       /* tape to use */
                     10: #define SECTSIZE 512           /* bytes per sector */
                     11: #define NSECT 1008000          /* sectors per RP07 */
                     12: #define TRKSIZE 50             /* sectors per track */
                     13: #define NREELS 4               /* reels of tape in the dump */
                     14: #define BPT (NSECT/(NREELS*TRKSIZE))   /* buffer loads per tape */
                     15: 
                     16: char buf[SECTSIZE*TRKSIZE];
                     17: 
                     18: main (argc, argv)
                     19:        int argc;
                     20:        char **argv;
                     21: {
                     22:        register int disk, tape, n, i;
                     23:        int reel;
                     24: 
                     25:        if (argc != 2) {
                     26:                fprintf (stderr, "arg count");
                     27:                exit (1);
                     28:        }
                     29: 
                     30:        disk = open (argv[1], 1);
                     31:        if (disk < 0) {
                     32:                perror (argv[1]);
                     33:                exit (1);
                     34:        }
                     35: 
                     36:        for (reel = 1; reel <= NREELS; reel++) {
                     37: 
                     38:                do {
                     39:                        char answer[500];
                     40:                        do {
                     41:                                printf ("Have you mounted volume %d? ", reel);
                     42:                                gets (answer);
                     43:                        } while (strcmp (answer, "yes") != 0);
                     44: 
                     45:                        tape = open (TAPE, 0);
                     46:                        if (tape < 0)
                     47:                                perror (TAPE);
                     48:                } while (tape < 0);
                     49: 
                     50:                for (i = 0; i < BPT; i++) {
                     51:                        n = read (tape, buf, sizeof(buf));
                     52:                        if (n != sizeof (buf)) {
                     53:                                perror (TAPE);
                     54:                                exit (1);
                     55:                        }
                     56:                        n = write (disk, buf, sizeof(buf));
                     57:                        if (n != sizeof (buf)) {
                     58:                                perror (argv[1]);
                     59:                                exit (1);
                     60:                        }
                     61:                }
                     62: 
                     63:                close (tape);
                     64:        }
                     65: 
                     66:        printf ("End of restore\n");
                     67:        exit (0);
                     68: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.