From: Stelian Pop Date: Fri, 10 Mar 2000 10:03:09 +0000 (+0000) Subject: Added the device name and volume number as arguments to the end of tape script. X-Git-Tag: release_0_4b16~2 X-Git-Url: https://git.wh0rd.org/?p=dump.git;a=commitdiff_plain;h=365a7c7c86abbe2b0a1e76e4e9fc8523bd73a8a1 Added the device name and volume number as arguments to the end of tape script. --- diff --git a/CHANGES b/CHANGES index 005be8d..136f607 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.51 2000/03/09 13:12:31 stelian Exp $ +$Id: CHANGES,v 1.52 2000/03/10 10:03:09 stelian Exp $ Changes between versions 0.4b15 and 0.4b16 (released ?????????????) =================================================================== @@ -23,6 +23,9 @@ Changes between versions 0.4b15 and 0.4b16 (released ?????????????) Thanks to Dejan Muhamedagic for the patch. +5. Added the device name and the current volume number + as arguments to the end of tape script (dump -F option). + Changes between versions 0.4b14 and 0.4b15 (released March 2, 2000) =================================================================== diff --git a/dump/dump.8.in b/dump/dump.8.in index 50c8fde..46121c1 100644 --- a/dump/dump.8.in +++ b/dump/dump.8.in @@ -30,7 +30,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dump.8.in,v 1.13 2000/03/02 12:07:36 stelian Exp $ +.\" $Id: dump.8.in,v 1.14 2000/03/10 10:03:09 stelian Exp $ .\" .Dd __DATE__ .Dt DUMP 8 @@ -195,7 +195,9 @@ program is this can be overridden by the environment variable .Ev RMT . .It Fl F Ar script -Run script at the end of each tape. The script must return 0 if +Run script at the end of each tape. The device name and the +current volume number are passed on the command line. +The script must return 0 if .Nm should continue without asking the user to change the tape, 1 if .Nm diff --git a/dump/tape.c b/dump/tape.c index aa8f730..45828a5 100644 --- a/dump/tape.c +++ b/dump/tape.c @@ -40,7 +40,7 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.16 2000/03/02 12:07:36 stelian Exp $"; + "$Id: tape.c,v 1.17 2000/03/10 10:03:09 stelian Exp $"; #endif /* not lint */ #ifdef __linux__ @@ -107,7 +107,7 @@ static void enslave __P((void)); static void flushtape __P((void)); static void killall __P((void)); static void rollforward __P((void)); -static int system_command __P((const char *command)); +static int system_command __P((const char *, const char *, int)); /* * Concurrent dump mods (Caltech) - disk block reading and tape writing @@ -410,8 +410,9 @@ flushtape(void) * Returns -1 if an error occured, the exit status of * the command on success. */ -int system_command(const char *command) { +int system_command(const char *command, const char *device, int volnum) { int pid, status; + char commandstr[4096]; pid = fork(); if (pid == -1) { @@ -421,7 +422,9 @@ int system_command(const char *command) { if (pid == 0) { setuid(getuid()); setgid(getgid()); - execl("/bin/sh", "sh", "-c", command, NULL); + snprintf(commandstr, sizeof(commandstr), "%s %s %d", command, device, volnum); + commandstr[sizeof(commandstr) - 1] = '\0'; + execl("/bin/sh", "sh", "-c", commandstr, NULL); perror(" DUMP: unable to execute shell"); exit(-1); } @@ -496,7 +499,7 @@ trewind(void) eot_code = 1; if (eot_script) { msg("Launching %s\n", eot_script); - eot_code = system_command(eot_script); + eot_code = system_command(eot_script, tape, tapeno); } if (eot_code != 0 && eot_code != 1) { msg("Dump aborted by the end of tape script\n");