/* Copyright (c) 1983 Regents of the University of California */
static char sccsid
[] = "@(#)main.c 3.3 (Berkeley) 83/02/27";
* Modified to recursively extract all files within a subtree
* (supressed by the h option) and recreate the heirarchical
* structure of that subtree and move extracted files to their
* proper homes (supressed by the m option).
* Includes the s (skip files) option for use with multiple
* dumps on a single tape.
* 8/29/80 by Mike Litzkow
* Modified to work on the new file system and to recover from
* 1/19/82 by Kirk McKusick
* Full incremental restore running entirely in user code.
* 1/19/83 by Kirk McKusick
int cvtflag
= 0, dflag
= 0, vflag
= 0, yflag
= 0;
int hflag
= 1, mflag
= 1;
char *inputdev
= "/dev/rmt8";
char *symtbl
= "./restoresymtable";
char *dirmodefile
= "./dirmodes";
if (signal(SIGINT
, onintr
) == SIG_IGN
)
if (signal(SIGTERM
, onintr
) == SIG_IGN
)
signal(SIGTERM
, SIG_IGN
);
fprintf(stderr
, "Usage: restor xtfhmsvy file file... or restor rRfsvy\n");
for (cp
= *argv
++; *cp
; cp
++) {
* dumpnum (skip to) for multifile dump tapes
fprintf(stderr
, "Dump number must be a positive integer\n");
"t and %c are mutually exclusive\n",
"R and %c are mutually exclusive\n",
"r and %c are mutually exclusive\n",
"x and %c are mutually exclusive\n",
fprintf(stderr
, "Bad key character %c\n", *cp
);
fprintf(stderr
, "must specify t, r, R, or x\n");
if ((ino
= psearch(*argv
)) == 0 ||
BIT(ino
, dumpmap
) == 0) {
fprintf(stderr
, "%s: not on tape\n", *argv
++);
treescan(*argv
++, ino
, listfile
);
extractdirs(dirmodefile
);
entry
= (struct entry
**)
calloc((int)maxino
, sizeof(struct entry
*));
if (entry
== (struct entry
**)NIL
)
panic("no memory for entry table\n");
(void)addentry(".", ROOTINO
, NODE
);
if ((ino
= psearch(*argv
)) == 0 ||
BIT(ino
, dumpmap
) == 0) {
fprintf(stderr
, "%s: not on tape\n", *argv
++);
treescan(*argv
++, ino
, addfile
);
addfile(*argv
++, ino
, LEAF
);
setdirmodes(dirmodefile
);
entry
= (struct entry
**)
calloc((int)maxino
, sizeof(struct entry
*));
if (entry
== (struct entry
**)NIL
)
panic("no memory for entry table\n");
(void)addentry(".", ROOTINO
, NODE
);
extractdirs(dirmodefile
);
if ((ino
= psearch(".")) == 0 || BIT(ino
, dumpmap
) == 0)
panic("Root directory is not on tape\n");
vprintf(stdout
, "Calculate extraction list.\n");
treescan(".", ino
, markfile
);
setdirmodes(dirmodefile
);
vprintf(stdout
, "Verify the directory structure\n");
treescan(".", ROOTINO
, verifyfile
);
dumpsymtable(symtbl
, (long)1);
setdirmodes(dirmodefile
);
dumpsymtable(symtbl
, (long)1);