#ifndef lint
static const char rcsid[] =
- "$Id: tape.c,v 1.68 2003/02/11 09:56:48 stelian Exp $";
+ "$Id: tape.c,v 1.72 2003/02/17 11:21:29 stelian Exp $";
#endif /* not lint */
#include <config.h>
temptape = magtape;
#ifdef RRESTORE
- if (host)
+ if (!Afile && host)
mt = rmtopen(temptape, O_RDONLY);
else
#endif
else
mt = OPEN(temptape, O_RDONLY, 0);
if (mt < 0)
- err(1, "%s", magtape);
+ err(1, "%s", temptape);
if (!Afile) {
volno = 1;
setmagtapein();
return;
}
closemt();
+
+ /*
+ * if using an archive file, reset its name so readtape()
+ * could properly use remote access.
+ */
+ Afile = NULL;
+
if (Mflag) {
snprintf(magtape, MAXPATHLEN, "%s%03ld", magtapeprefix, newvol);
magtape[MAXPATHLEN - 1] = '\0';
#endif
getmore:
#ifdef RRESTORE
- if (host)
+ if (!Afile && host)
i = rmtread(&tapebuf[rd], cnt);
else
#endif
i = ntrec * TP_BSIZE;
memset(tapebuf, 0, (size_t)i);
#ifdef RRESTORE
- if (host)
+ if (!Afile && host)
seek_failed = (rmtseek(i, 1) < 0);
else
#endif
size = len;
while (size > 0) {
#ifdef RRESTORE
- if (host)
+ if (!Afile && host)
i = rmtread(buf, size);
else
#endif
if (mt < 0)
return;
#ifdef RRESTORE
- if (host)
+ if (!Afile && host)
rmtclose();
else
#endif
magtapein = ioctl(mt, MTIOCGET, (char *)&mt_stat) == 0;
}
- Vprintf(stdout,"Input is from %s\n",
+ Vprintf(stdout,"Input is from a %s %s\n",
+ host ? "remote" : "local",
magtapein ? "tape" :
Vflag ? "multi-volume (no tape)" : "file/pipe");
}
do {
cntloop++;
gethead(&spcl);
- } while (!(spcl.c_inumber == theino && spcl.c_type == TS_INODE && spcl.c_date == dumpdate) && (cntloop < 32));
+ } while (!(spcl.c_inumber == theino && spcl.c_type == TS_INODE && spcl.c_date == dumpdate) && (cntloop < ntrec));
#ifdef DEBUG_QFA
fprintf(stderr, "%ld reads\n", cntloop);
- if (cntloop == 32) {
+ if (cntloop == ntrec) {
fprintf(stderr, "DEBUG: bufsize %d\n", bufsize);
fprintf(stderr, "DEBUG: ntrec %ld\n", ntrec);
- fprintf(stderr, "DEBUG: %ld reads\n", cntloop);
}
#endif
findinode(&spcl);