summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9d6426e)
SCCS-vsn: sbin/restore/tape.c 5.14
SCCS-vsn: sbin/restore/restore.h 5.2
SCCS-vsn: sbin/restore/dirs.c 5.5
SCCS-vsn: sbin/restore/main.c 5.4
SCCS-vsn: sbin/restore/symtab.c 5.2
SCCS-vsn: sbin/restore/utilities.c 5.3
SCCS-vsn: sbin/restore/main.c 5.4
-static char sccsid[] = "@(#)dirs.c 5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)dirs.c 5.5 (Berkeley) %G%";
#endif not lint
#include "restore.h"
#endif not lint
#include "restore.h"
perror("read");
done(1);
}
perror("read");
done(1);
}
- if (write(ofile, buf, (int) size) == -1) {
+ if (!Nflag && write(ofile, buf, (int) size) == -1) {
fprintf(stderr,
"write error extracting inode %d, name %s\n",
curfile.ino, curfile.name);
fprintf(stderr,
"write error extracting inode %d, name %s\n",
curfile.ino, curfile.name);
#endif not lint
#ifndef lint
#endif not lint
#ifndef lint
-static char sccsid[] = "@(#)main.c 5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c 5.4 (Berkeley) %G%";
#include <signal.h>
int bflag = 0, cvtflag = 0, dflag = 0, vflag = 0, yflag = 0;
#include <signal.h>
int bflag = 0, cvtflag = 0, dflag = 0, vflag = 0, yflag = 0;
-int hflag = 1, mflag = 1;
+int hflag = 1, mflag = 1, Nflag = 0;
char command = '\0';
long dumpnum = 1;
long volno = 0;
char command = '\0';
long dumpnum = 1;
long volno = 0;
case 'm':
mflag = 0;
break;
case 'm':
mflag = 0;
break;
+ case 'N':
+ Nflag++;
+ break;
case 'v':
vflag++;
break;
case 'v':
vflag++;
break;
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)restore.h 5.1 (Berkeley) %G%
+ * @(#)restore.h 5.2 (Berkeley) %G%
extern int dflag; /* print out debugging info */
extern int hflag; /* restore heirarchies */
extern int mflag; /* restore by name instead of inode number */
extern int dflag; /* print out debugging info */
extern int hflag; /* restore heirarchies */
extern int mflag; /* restore by name instead of inode number */
+extern int Nflag; /* do not write the disk */
extern int vflag; /* print out actions taken */
extern int yflag; /* always try to recover from tape errors */
/*
extern int vflag; /* print out actions taken */
extern int yflag; /* always try to recover from tape errors */
/*
-static char sccsid[] = "@(#)symtab.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)symtab.c 5.2 (Berkeley) %G%";
struct symtableheader hdr;
vprintf(stdout, "Check pointing the restore\n");
struct symtableheader hdr;
vprintf(stdout, "Check pointing the restore\n");
if ((fd = fopen(filename, "w")) == NULL) {
perror("fopen");
panic("cannot create save file %s for symbol table\n",
if ((fd = fopen(filename, "w")) == NULL) {
perror("fopen");
panic("cannot create save file %s for symbol table\n",
-static char sccsid[] = "@(#)tape.c 5.13 (Berkeley) %G%";
+static char sccsid[] = "@(#)tape.c 5.14 (Berkeley) %G%";
#endif not lint
#include "restore.h"
#endif not lint
#include "restore.h"
case IFCHR:
case IFBLK:
vprintf(stdout, "extract special file %s\n", name);
case IFCHR:
case IFBLK:
vprintf(stdout, "extract special file %s\n", name);
+ if (Nflag) {
+ skipfile();
+ return (GOOD);
+ }
if (mknod(name, mode, (int)curfile.dip->di_rdev) < 0) {
fprintf(stderr, "%s: ", name);
(void) fflush(stderr);
if (mknod(name, mode, (int)curfile.dip->di_rdev) < 0) {
fprintf(stderr, "%s: ", name);
(void) fflush(stderr);
case IFREG:
vprintf(stdout, "extract file %s\n", name);
case IFREG:
vprintf(stdout, "extract file %s\n", name);
+ if (Nflag) {
+ skipfile();
+ return (GOOD);
+ }
if ((ofile = creat(name, 0666)) < 0) {
fprintf(stderr, "%s: ", name);
(void) fflush(stderr);
if ((ofile = creat(name, 0666)) < 0) {
fprintf(stderr, "%s: ", name);
(void) fflush(stderr);
if (write(ofile, buf, (int) size) == -1) {
fprintf(stderr, "write error extracting inode %d, name %s\n",
curfile.ino, curfile.name);
if (write(ofile, buf, (int) size) == -1) {
fprintf(stderr, "write error extracting inode %d, name %s\n",
curfile.ino, curfile.name);
-static char sccsid[] = "@(#)utilities.c 5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)utilities.c 5.3 (Berkeley) %G%";
#endif not lint
#include "restore.h"
#endif not lint
#include "restore.h"
renameit(from, to)
char *from, *to;
{
renameit(from, to)
char *from, *to;
{
- if (rename(from, to) < 0) {
+ if (!Nflag && rename(from, to) < 0) {
fprintf(stderr, "Warning: cannot rename %s to %s", from, to);
(void) fflush(stderr);
perror("");
fprintf(stderr, "Warning: cannot rename %s to %s", from, to);
(void) fflush(stderr);
perror("");
if (np->e_type != NODE)
badentry(np, "newnode: not a node");
cp = myname(np);
if (np->e_type != NODE)
badentry(np, "newnode: not a node");
cp = myname(np);
- if (mkdir(cp, 0777) < 0) {
+ if (!Nflag && mkdir(cp, 0777) < 0) {
np->e_flags |= EXISTED;
fprintf(stderr, "Warning: ");
(void) fflush(stderr);
np->e_flags |= EXISTED;
fprintf(stderr, "Warning: ");
(void) fflush(stderr);
ep->e_flags |= REMOVED;
ep->e_flags &= ~TMPNAME;
cp = myname(ep);
ep->e_flags |= REMOVED;
ep->e_flags &= ~TMPNAME;
cp = myname(ep);
+ if (!Nflag && rmdir(cp) < 0) {
fprintf(stderr, "Warning: ");
(void) fflush(stderr);
perror(cp);
fprintf(stderr, "Warning: ");
(void) fflush(stderr);
perror(cp);
ep->e_flags |= REMOVED;
ep->e_flags &= ~TMPNAME;
cp = myname(ep);
ep->e_flags |= REMOVED;
ep->e_flags &= ~TMPNAME;
cp = myname(ep);
+ if (!Nflag && unlink(cp) < 0) {
fprintf(stderr, "Warning: ");
(void) fflush(stderr);
perror(cp);
fprintf(stderr, "Warning: ");
(void) fflush(stderr);
perror(cp);
- if (symlink(existing, new) < 0) {
+ if (!Nflag && symlink(existing, new) < 0) {
fprintf(stderr,
"Warning: cannot create symbolic link %s->%s: ",
new, existing);
fprintf(stderr,
"Warning: cannot create symbolic link %s->%s: ",
new, existing);
return (FAIL);
}
} else if (type == HARDLINK) {
return (FAIL);
}
} else if (type == HARDLINK) {
- if (link(existing, new) < 0) {
+ if (!Nflag && link(existing, new) < 0) {
fprintf(stderr,
"Warning: cannot create hard link %s->%s: ",
new, existing);
fprintf(stderr,
"Warning: cannot create hard link %s->%s: ",
new, existing);