X-Git-Url: https://git.wh0rd.org/?p=dump.git;a=blobdiff_plain;f=restore%2Ftape.c;h=a8616a1069eaf3b7a90635bc523c6b4a716fffd6;hp=d7e8ed635be54041c6872d5512e64eca52d861ea;hb=c534413c6ada5778ccbb76f36bdcff672037d0cc;hpb=6d9ffa3ebaadf8f1709aa4e6a8956fab4abf4f64 diff --git a/restore/tape.c b/restore/tape.c index d7e8ed6..a8616a1 100644 --- a/restore/tape.c +++ b/restore/tape.c @@ -46,13 +46,14 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.39 2001/05/26 11:04:46 stelian Exp $"; + "$Id: tape.c,v 1.42 2001/07/18 12:54:06 stelian Exp $"; #endif /* not lint */ #include #include #include #include +#include #include #include #include @@ -67,7 +68,11 @@ static const char rcsid[] = #ifdef __linux__ #include #include +#ifdef HAVE_EXT2FS_EXT2_FS_H +#include +#else #include +#endif #include #include #else /* __linux__ */ @@ -253,10 +258,18 @@ newcomprbuf(int size) void setup(void) { - int i, j, *ip; + int i, j, *ip, bot_code; struct STAT stbuf; Vprintf(stdout, "Verify tape and initialize maps\n"); + if (bot_script) { + msg("Launching %s\n", bot_script); + bot_code = system_command(bot_script, magtape, 1); + if (bot_code != 0 && bot_code != 1) { + msg("Restore aborted by the beginning of tape script\n"); + exit(1); + } + } #ifdef RRESTORE if (host) mt = rmtopen(magtape, 0); @@ -370,7 +383,7 @@ getvol(long nextvol) union u_spcl tmpspcl; # define tmpbuf tmpspcl.s_spcl char buf[TP_BSIZE]; - int haderror = 0; + int haderror = 0, bot_code; if (nextvol == 1) { tapesread = 0; @@ -434,7 +447,15 @@ again: snprintf(magtape, MAXPATHLEN, "%s%03ld", magtapeprefix, newvol); magtape[MAXPATHLEN - 1] = '\0'; } - if (!Mflag || haderror) { + if (bot_script && !haderror) { + msg("Launching %s\n", bot_script); + bot_code = system_command(bot_script, magtape, newvol); + if (bot_code != 0 && bot_code != 1) { + msg("Restore aborted by the beginning of tape script\n"); + exit(1); + } + } + if (haderror || (bot_code && !Mflag)) { haderror = 0; fprintf(stderr, "Mount tape volume %ld\n", (long)newvol); fprintf(stderr, "Enter ``none'' if there are no more tapes\n"); @@ -448,8 +469,11 @@ again: return; } if (buf[0] != '\n') { + char *pos; (void) strncpy(magtape, buf, sizeof(magtape)); magtape[sizeof(magtape) - 1] = '\0'; + if ((pos = strchr(magtape, '\n'))) + magtape[pos - magtape] = '\0'; } } #ifdef RRESTORE