static char sccsid
[] = "@(#)main.c 3.13 (Berkeley) 84/02/07";
/* Copyright (c) 1983 Regents of the University of California */
* 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 and
* interactive tape browser.
* 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";
if (signal(SIGINT
, onintr
) == SIG_IGN
)
(void) signal(SIGINT
, SIG_IGN
);
if (signal(SIGTERM
, onintr
) == SIG_IGN
)
(void) signal(SIGTERM
, SIG_IGN
);
fprintf(stderr
, "Usage:\n%s%s%s%s%s",
"\trestore tfhsvy [file file ...]\n",
"\trestore xfhmsvy [file file ...]\n",
for (cp
= *argv
++; *cp
; cp
++) {
fprintf(stderr
, "missing device specifier\n");
* dumpnum (skip to) for multifile dump tapes
fprintf(stderr
, "missing dump number\n");
fprintf(stderr
, "Dump number must be a positive integer\n");
"%c and %c are mutually exclusive\n",
fprintf(stderr
, "Bad key character %c\n", *cp
);
fprintf(stderr
, "must specify i, t, r, R, or x\n");
* Incremental restoration of a file system.
* This is an incremental dump tape.
vprintf(stdout
, "Begin incremental restore\n");
vprintf(stdout
, "Calculate node updates.\n");
treescan(".", ROOTINO
, nodeupdates
);
* This is a level zero dump tape.
vprintf(stdout
, "Begin level 0 restore\n");
vprintf(stdout
, "Calculate extraction list.\n");
treescan(".", ROOTINO
, nodeupdates
);
vprintf(stdout
, "Verify the directory structure\n");
treescan(".", ROOTINO
, verifyfile
);
dumpsymtable(symtbl
, (long)1);
* Resume an incremental file system restoration.
dumpsymtable(symtbl
, (long)1);
treescan(name
, ino
, listfile
);
* Batch extraction of tape contents.
treescan(name
, ino
, addfile
);
* Read and execute commands from the terminal.
register struct entry
*np
;
getcmd(curdir
, cmd
, name
);
* Add elements to the extraction list.
treescan(name
, ino
, addfile
);
* Change working directory.
if (inodetype(ino
) == LEAF
) {
fprintf(stderr
, "%s: not a directory\n", name
);
(void) strcpy(curdir
, name
);
* Delete elements from the extraction list.
if (np
== NIL
|| (np
->e_flags
& NEW
) == 0) {
fprintf(stderr
, "%s: not on extraction list\n", name
);
treescan(name
, np
->e_ino
, deletefile
);
* Extract the requested list.
* List available commands.
fprintf(stderr
, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
"Available commands are:\n",
"\tls [arg] - list directory\n",
"\tcd arg - change directory\n",
"\tpwd - print current directory\n",
"\tadd [arg] - add `arg' to list of",
" files to be extracted\n",
"\tdelete [arg] - delete `arg' from",
" list of files to be extracted\n",
"\textract - extract requested files\n",
"\tquit - immediately exit program\n",
"\tverbose - toggle verbose flag",
" (useful with ``ls'')\n",
"\thelp or `?' - print this list\n",
"If no `arg' is supplied, the current",
* Print current directory.
fprintf(stderr
, "%s\n", &curdir
[1]);
fprintf(stderr
, "verbose mode off\n");
fprintf(stderr
, "verbose mode on\n");
* Just restore requested directory modes.
fprintf(stderr
, "debugging mode off\n");
fprintf(stderr
, "debugging mode on\n");
fprintf(stderr
, "%s: unknown command; type ? for help\n", cmd
);