| 1 | #define MAXSIZE 500 /* max size in blocks of dumped files */ |
| 2 | #define NILIST 100 /* max files extracted at once */ |
| 3 | #define BFACT 20 /* tape blocking factor */ |
| 4 | |
| 5 | int tden 1600; /* tape density */ |
| 6 | int tlen 2200; /* tape length (feet) */ |
| 7 | |
| 8 | char *dump_cmd[] = { /* default args for dump */ |
| 9 | "dump", |
| 10 | "i", |
| 11 | "/dev/rp0", |
| 12 | 0 |
| 13 | }; |
| 14 | |
| 15 | char *rest_cmd[] = { /* defaults for restor */ |
| 16 | "restor", |
| 17 | "t", |
| 18 | 0 |
| 19 | }; |
| 20 | |
| 21 | char *tape "/dev/rmt1"; |
| 22 | char dfile[] "/dev/dtab"; |
| 23 | char tfile[] "/tmp/dtmp"; |
| 24 | char name[100]; |
| 25 | |
| 26 | #define NDTAB 10 |
| 27 | struct { |
| 28 | char dt_name[16]; |
| 29 | time_t dt_date; |
| 30 | } dtab[NDTAB]; |
| 31 | |
| 32 | struct thdr { |
| 33 | ino_t isize; |
| 34 | ino_t maxi; |
| 35 | daddr_t fsize; |
| 36 | time_t cdate; |
| 37 | time_t ddate; |
| 38 | long tsize; |
| 39 | int nflg; |
| 40 | }; |
| 41 | |
| 42 | struct fhdr { |
| 43 | short xmagic; |
| 44 | ino_t xino; |
| 45 | short xmode; |
| 46 | short xnlink; |
| 47 | short xuid; |
| 48 | short xgid; |
| 49 | daddr_t xaddr; |
| 50 | off_t xsize; |
| 51 | time_t xatime; |
| 52 | time_t xmtime; |
| 53 | time_t xctime; |
| 54 | }; |
| 55 | #define FMAGIC 012345 |
| 56 | #define SMAGIC 031415 |
| 57 | |
| 58 | #define DAPTB 127 /* (BSIZE-2*sizeof(short))/sizeof(daddr_t)) */ |
| 59 | |
| 60 | FILE *tmpf; |
| 61 | |
| 62 | long |
| 63 | getsize() |
| 64 | { |
| 65 | register c; |
| 66 | long j; |
| 67 | |
| 68 | c = getc(tmpf); |
| 69 | if(c == EOF) |
| 70 | return((long)-1); |
| 71 | if(c <= 253) |
| 72 | return((long)c); |
| 73 | if(c == 255) |
| 74 | return((long)-1); |
| 75 | j = 0; |
| 76 | for(c=0;c<3;c++) |
| 77 | j = (j<<8) + (getc(tmpf)&0377); |
| 78 | return(j); |
| 79 | } |
| 80 | |
| 81 | putsize(s) |
| 82 | long s; |
| 83 | { |
| 84 | if(s <= 253) { |
| 85 | putc((char)s, tmpf); |
| 86 | return; |
| 87 | } |
| 88 | putc(254, tmpf); |
| 89 | putc((char)(s>>16), tmpf); |
| 90 | putc((char)(s>>8), tmpf); |
| 91 | putc((char)s, tmpf); |
| 92 | } |