Deleted Added
full compact
40c40
< "$FreeBSD: head/sbin/restore/tape.c 128073 2004-04-09 19:58:40Z markm $";
---
> "$FreeBSD: head/sbin/restore/tape.c 128175 2004-04-13 02:58:06Z green $";
67a68,69
> static int pipecmdin = 0;
> static FILE *popenfp = NULL;
112c114
< setinput(char *source)
---
> setinput(char *source, int ispipecommand)
120a123,125
> if (ispipecommand)
> pipecmdin++;
> else
184a190,198
> if (pipecmdin) {
> if (setenv("RESTORE_VOLUME", "1", 1) == -1) {
> fprintf(stderr, "Cannot set $RESTORE_VOLUME: %s\n",
> strerror(errno));
> done(1);
> }
> popenfp = popen(magtape, "r");
> mt = popenfp ? fileno(popenfp) : -1;
> } else
306a321,324
> if (pipecmdin) {
> closemt();
> goto getpipecmdhdr;
> }
366a385,397
> if (pipecmdin) {
> char volno[sizeof("2147483647")];
>
> getpipecmdhdr:
> (void)sprintf(volno, "%d", newvol);
> if (setenv("RESTORE_VOLUME", volno, 1) == -1) {
> fprintf(stderr, "Cannot set $RESTORE_VOLUME: %s\n",
> strerror(errno));
> done(1);
> }
> popenfp = popen(magtape, "r");
> mt = popenfp ? fileno(popenfp) : -1;
> } else
496c527
< if (ioctl(mt, MTIOCTOP, (char *)&tcom) < 0)
---
> if (!pipecmdin && ioctl(mt, MTIOCTOP, (char *)&tcom) < 0)
984a1016,1019
> if (pipecmdin) {
> pclose(popenfp);
> popenfp = NULL;
> } else