SCCS-vsn: sbin/restore/main.c 2.4
/* Copyright (c) 1981 Regents of the University of California */
/* Copyright (c) 1981 Regents of the University of California */
-char version[] = "@(#)main.c 2.3 %G%";
+#ifndef lint
+char version[] = "@(#)main.c 2.4 %G%";
+#endif
/* Modified to include h option (recursively extract all files within
* a subtree) and m option (recreate the heirarchical structure of
* that subtree and move extracted files to their proper homes).
* 8/29/80 by Mike Litzkow
*
/* Modified to include h option (recursively extract all files within
* a subtree) and m option (recreate the heirarchical structure of
* that subtree and move extracted files to their proper homes).
* 8/29/80 by Mike Litzkow
*
+ * Modified to work on the new file system
+ * 1/19/82 by Kirk McKusick
+ *
* Includes the s (skip files) option for use with multiple dumps on
* a single tape.
*/
* Includes the s (skip files) option for use with multiple dumps on
* a single tape.
*/
#define BIC(i,w) (MWORD(w,i) &= ~MBIT(i))
#define BIT(i,w) (MWORD(w,i) & MBIT(i))
#define BIC(i,w) (MWORD(w,i) &= ~MBIT(i))
#define BIT(i,w) (MWORD(w,i) & MBIT(i))
-ino_t ino, maxi;
-struct inode *cur_ip;
int eflag = 0, hflag = 0, mflag = 0, cvtdir = 0;
long fssize;
int eflag = 0, hflag = 0, mflag = 0, cvtdir = 0;
long fssize;
char tapename[] = "/dev/rmt8";
char *magtape = tapename;
int mt;
char tapename[] = "/dev/rmt8";
char *magtape = tapename;
int mt;
} *xtrlist[MAXINO];
int xtrcnt = 0;
} *xtrlist[MAXINO];
int xtrcnt = 0;
char *dumpmap;
char *clrimap;
char clearedbuf[MAXBSIZE];
extern char *ctime();
char *dumpmap;
char *clrimap;
char clearedbuf[MAXBSIZE];
extern char *ctime();
ino_t search();
int dirwrite();
ino_t search();
int dirwrite();
{
register char *cp;
char command;
{
register char *cp;
char command;
if (ioctl(mt,MTIOCTOP,&tcom) < 0)
perror("ioctl MTFSF");
}
if (ioctl(mt,MTIOCTOP,&tcom) < 0)
perror("ioctl MTFSF");
}
- blkclr(clearedbuf, MAXBSIZE);
+ blkclr(clearedbuf, (long)MAXBSIZE);
switch(command) {
case 't':
if (readhdr(&spcl) == 0) {
switch(command) {
case 't':
if (readhdr(&spcl) == 0) {
{
register struct inotab *itp;
int namelen;
{
register struct inotab *itp;
int namelen;
register struct direct *dp;
char locname[BUFSIZ + 1];
register struct direct *dp;
char locname[BUFSIZ + 1];
*/
getfile(f1, f2, size)
int (*f2)(), (*f1)();
*/
getfile(f1, f2, size)
int (*f2)(), (*f1)();
{
register int i;
char buf[MAXBSIZE / TP_BSIZE][TP_BSIZE];
{
register int i;
char buf[MAXBSIZE / TP_BSIZE][TP_BSIZE];
+#ifdef lint
+ buf = buf;
+#endif
if (lseek(ofile, size, 1) == -1) {
perror("extract seek");
done(1);
if (lseek(ofile, size, 1) == -1) {
perror("extract seek");
done(1);
long size;
{
struct odirect *odp, *edp;
long size;
{
struct odirect *odp, *edp;
- struct direct *dp, cvtbuf;
edp = &buf[size / sizeof(struct odirect)];
for (odp = buf; odp < edp; odp++) {
edp = &buf[size / sizeof(struct odirect)];
for (odp = buf; odp < edp; odp++) {
+#ifdef lint
+ buf = buf, size = size;
+#endif
fprintf(stderr, "unallocated block in symbolic link\n");
done(1);
}
fprintf(stderr, "unallocated block in symbolic link\n");
done(1);
}
struct s_spcl tmpbuf;
char c;
struct s_spcl tmpbuf;
char c;
done(1);
i = NTREC*TP_BSIZE;
blkclr(tbf, i);
done(1);
i = NTREC*TP_BSIZE;
blkclr(tbf, i);
+ if (lseek(mt, i, 1) < 0) {
+ fprintf(stderr, "continuation failed\n");
+ done(1);
+ }
}
if (i == 0) {
bct = NTREC + 1;
}
if (i == 0) {
bct = NTREC + 1;
- blkcpy(&tbf[(bct++*TP_BSIZE)], b, TP_BSIZE);
+ blkcpy(&tbf[(bct++*TP_BSIZE)], b, (long)TP_BSIZE);
blkcpy(from, to, size)
char *from, *to;
blkcpy(from, to, size)
char *from, *to;
+#ifdef lint
+ from = from, to = to, size = size;
+#endif
asm(" movc3 12(ap),*4(ap),*8(ap)");
}
blkclr(buf, size)
char *buf;
asm(" movc3 12(ap),*4(ap),*8(ap)");
}
blkclr(buf, size)
char *buf;
+#ifdef lint
+ buf = buf, size = size;
+#endif
asm("movc5 $0,(r0),$0,8(ap),*4(ap)");
}
asm("movc5 $0,(r0),$0,8(ap),*4(ap)");
}
i = spcl.c_count;
if (*mapp == 0)
i = spcl.c_count;
if (*mapp == 0)
- *mapp = (char *)(calloc(i, (TP_BSIZE/(NBBY/BITS))));
+ *mapp = (char *)calloc(i, (TP_BSIZE/(NBBY/BITS)));
m = *mapp;
while (i--) {
readtape((char *) m);
m = *mapp;
while (i--) {
readtape((char *) m);
return;
for (;;) {
if (dp->d_reclen < DIRBLKSIZ - dirloc) {
return;
for (;;) {
if (dp->d_reclen < DIRBLKSIZ - dirloc) {
- blkcpy(dp, dirbuf + dirloc, dp->d_reclen);
+ blkcpy((char *)dp, dirbuf + dirloc, (long)dp->d_reclen);
prev = dirloc;
dirloc += dp->d_reclen;
return;
prev = dirloc;
dirloc += dp->d_reclen;
return;
register struct odirect *odp;
register struct direct *ndp;
{
register struct odirect *odp;
register struct direct *ndp;
{
- struct inotab *itp;
-
- blkclr(ndp, sizeof *ndp);
+ blkclr((char *)ndp, (long)(sizeof *ndp));
ndp->d_ino = odp->d_ino;
strncpy(ndp->d_name, odp->d_name, ODIRSIZ);
ndp->d_namlen = strlen(ndp->d_name);
ndp->d_ino = odp->d_ino;
strncpy(ndp->d_name, odp->d_name, ODIRSIZ);
ndp->d_namlen = strlen(ndp->d_name);
dirp = (DIR *)malloc(sizeof(DIR));
dirp->dd_fd = open(name, 0);
if (dirp->dd_fd == -1) {
dirp = (DIR *)malloc(sizeof(DIR));
dirp->dd_fd = open(name, 0);
if (dirp->dd_fd == -1) {
return NULL;
}
dirp->dd_loc = 0;
return NULL;
}
dirp->dd_loc = 0;
void
seekdir(dirp, loc, base)
register DIR *dirp;
void
seekdir(dirp, loc, base)
register DIR *dirp;
{
if (loc == telldir(dirp))
return;
loc -= base;
if (loc < 0)
fprintf(stderr, "bad seek pointer to seekdir %d\n", loc);
{
if (loc == telldir(dirp))
return;
loc -= base;
if (loc < 0)
fprintf(stderr, "bad seek pointer to seekdir %d\n", loc);
- lseek(dirp->dd_fd, base + (loc & ~(DIRBLKSIZ - 1)), 0);
+ (void)lseek(dirp->dd_fd, base + (loc & ~(DIRBLKSIZ - 1)), 0);
dirp->dd_loc = loc & (DIRBLKSIZ - 1);
if (dirp->dd_loc != 0)
dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf, DIRBLKSIZ);
dirp->dd_loc = loc & (DIRBLKSIZ - 1);
if (dirp->dd_loc != 0)
dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf, DIRBLKSIZ);