From d339304329df2d458e54c02eac10a27cb31d9cb1 Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Sat, 26 Feb 2000 01:35:48 +0000 Subject: [PATCH] Added the prompt command in restore interactive mode. --- CHANGES | 8 +++++++- THANKS | 3 ++- compat/include/pathnames.h | 4 +--- configure | 2 +- configure.in | 2 +- dump/dump.h | 3 +-- dump/main.c | 3 +-- dump/tape.c | 9 +++++---- restore/interactive.c | 41 ++++++++++++++++++++++++++++---------- 9 files changed, 50 insertions(+), 25 deletions(-) diff --git a/CHANGES b/CHANGES index 752cc8a..9fa3c59 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,10 @@ -$Id: CHANGES,v 1.43 2000/02/10 10:22:04 stelian Exp $ +$Id: CHANGES,v 1.44 2000/02/26 01:35:48 stelian Exp $ + +Changes between versions 0.4b14 and 0.4b15 (released ?????????????????) +======================================================================= + +1. Added a prompt command in interactive restore mode. Thanks + to Andreas Dilger for the patch. Changes between versions 0.4b13 and 0.4b14 (released February 10, 2000) ======================================================================= diff --git a/THANKS b/THANKS index 7c464d5..284c05a 100644 --- a/THANKS +++ b/THANKS @@ -1,4 +1,4 @@ -$Id: THANKS,v 1.21 2000/02/10 09:42:32 stelian Exp $ +$Id: THANKS,v 1.22 2000/02/26 01:35:48 stelian Exp $ Dump and restore were written by the people of the CSRG at the University of California, Berkeley. @@ -27,6 +27,7 @@ Rob Cermak cermak@ahab.rutgers.edu Isaac Chuang ike@isl.stanford.edu Rainer Clasen bj@ncc.cicely.de Abhijit Dasgupta abhijit@ans.net +Andreas Dilger adilger@home.com Jason Fearon jasonf@netrider.org.au Jeremy Fitzhardinge jeremy@goop.org Eirik Fuller eirik@netcom.com diff --git a/compat/include/pathnames.h b/compat/include/pathnames.h index fb8f500..29bbd68 100644 --- a/compat/include/pathnames.h +++ b/compat/include/pathnames.h @@ -4,7 +4,7 @@ * Remy Card , 1994-1997 * Stelian Pop , 1999-2000 * - * $Id: pathnames.h,v 1.6 2000/01/21 10:17:41 stelian Exp $ + * $Id: pathnames.h,v 1.7 2000/02/26 01:35:48 stelian Exp $ */ /* @@ -43,6 +43,4 @@ #include #define _PATH_DEFTAPE "/dev/st0" -#define _PATH_DTMP "/etc/dtmp" -#define _PATH_LOCK "/tmp/dumplockXXXXXX" #define _PATH_RMT "/etc/rmt" /* path on remote host */ diff --git a/configure b/configure index cf65578..60c7d2d 100755 --- a/configure +++ b/configure @@ -1632,7 +1632,7 @@ ext2fs_lib=no fi if test "$ext2fs_h" = no -o "$ext2fs_lib" = no; then - { echo "configure: error: You need to install the Ext2fs libraries from the E2fsprogs distribution first" 1>&2; exit 1; } + { echo "configure: error: You need to install the Ext2fs libraries from the E2fsprogs distribution first - hint: make install-libs" 1>&2; exit 1; } fi for ac_func in err errx verr verrx vwarn vwarnx warn warnx realpath lchown diff --git a/configure.in b/configure.in index fbc45e4..6cf0b35 100644 --- a/configure.in +++ b/configure.in @@ -226,7 +226,7 @@ dnl AC_CHECK_HEADER(ext2fs/ext2fs.h, [ext2fs_h=yes], [ext2fs_h=no]) AC_CHECK_LIB(ext2fs, ext2fs_open, [ext2fs_lib=yes], [ext2fs_lib=no], [-lcom_err]) if test "$ext2fs_h" = no -o "$ext2fs_lib" = no; then - AC_MSG_ERROR(You need to install the Ext2fs libraries from the E2fsprogs distribution first) + AC_MSG_ERROR(You need to install the Ext2fs libraries from the E2fsprogs distribution first - hint: make install-libs) fi dnl diff --git a/dump/dump.h b/dump/dump.h index 23331ff..994706c 100644 --- a/dump/dump.h +++ b/dump/dump.h @@ -4,7 +4,7 @@ * Remy Card , 1994-1997 * Stelian Pop , 1999-2000 * - * $Id: dump.h,v 1.10 2000/02/04 20:22:21 stelian Exp $ + * $Id: dump.h,v 1.11 2000/02/26 01:35:48 stelian Exp $ */ /*- @@ -71,7 +71,6 @@ char *disk; /* name of the disk file */ char tape[NAME_MAX]; /* name of the tape file */ char *tapeprefix; /* prefix of the tape file */ char *dumpdates; /* name of the file containing dump date information*/ -char *temp; /* name of the file for doing rewrite of dumpdates */ char lastlevel; /* dump level of previous dump */ char level; /* dump level of this dump */ int uflag; /* update flag */ diff --git a/dump/main.c b/dump/main.c index 806de5e..bc4de01 100644 --- a/dump/main.c +++ b/dump/main.c @@ -40,7 +40,7 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.15 2000/02/04 20:22:21 stelian Exp $"; + "$Id: main.c,v 1.16 2000/02/26 01:35:48 stelian Exp $"; #endif /* not lint */ #include @@ -144,7 +144,6 @@ main(int argc, char *argv[]) if ((tapeprefix = getenv("TAPE")) == NULL) tapeprefix = _PATH_DEFTAPE; dumpdates = _PATH_DUMPDATES; - temp = _PATH_DTMP; strcpy(labelstr, "none"); /* XXX safe strcpy. */ if (TP_BSIZE / DEV_BSIZE == 0 || TP_BSIZE % DEV_BSIZE != 0) quit("TP_BSIZE must be a multiple of DEV_BSIZE\n"); diff --git a/dump/tape.c b/dump/tape.c index b3964a8..f413394 100644 --- a/dump/tape.c +++ b/dump/tape.c @@ -40,7 +40,7 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.12 2000/02/10 09:42:32 stelian Exp $"; + "$Id: tape.c,v 1.13 2000/02/26 01:35:48 stelian Exp $"; #endif /* not lint */ #ifdef __linux__ @@ -732,10 +732,11 @@ restore_check_point: msg("Dumping volume %d on %s\n", tapeno, tape); } #ifdef RDUMP - while ((tapefd = (host ? rmtopen(tape, 2) : - pipeout ? 1 : open(tape, O_WRONLY|O_CREAT, 0666))) < 0) + while ((tapefd = (host ? rmtopen(tape, 2) : pipeout ? + fileno(stdout) : + open(tape, O_WRONLY|O_CREAT, 0666))) < 0) #else - while ((tapefd = (pipeout ? 1 : + while ((tapefd = (pipeout ? fileno(stdout) : open(tape, O_WRONLY|O_CREAT, 0666))) < 0) #endif { diff --git a/restore/interactive.c b/restore/interactive.c index 28b4d37..0bd6aaa 100644 --- a/restore/interactive.c +++ b/restore/interactive.c @@ -40,7 +40,7 @@ #ifndef lint static const char rcsid[] = - "$Id: interactive.c,v 1.8 2000/01/21 10:17:41 stelian Exp $"; + "$Id: interactive.c,v 1.9 2000/02/26 01:35:48 stelian Exp $"; #endif /* not lint */ #include @@ -79,7 +79,7 @@ extern char * __progname; static int runshell; static jmp_buf reset; static char *nextarg = NULL; - +static int pflag = 0; /* prompt mode */ /* * Structure and routines associated with listing directories. */ @@ -203,7 +203,7 @@ loop: if (strncmp(cmd, "help", strlen(cmd)) != 0) goto bad; case '?': - fprintf(stderr, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", + fprintf(stderr, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", "Available commands are:\n", "\tls [arg] - list directory\n", "\tcd arg - change directory\n", @@ -218,6 +218,7 @@ loop: "\twhat - list dump header information\n", "\tverbose - toggle verbose flag", " (useful with ``ls'')\n", + "\tprompt - toggle the prompt display\n", "\thelp or `?' - print this list\n", "If no `arg' is supplied, the current", " directory is used\n"); @@ -234,12 +235,26 @@ loop: * Print current directory. */ case 'p': - if (strncmp(cmd, "pwd", strlen(cmd)) != 0) - goto bad; - if (curdir[1] == '\0') - fprintf(stderr, "/\n"); - else - fprintf(stderr, "%s\n", &curdir[1]); + if (strncmp(cmd, "pwd", strlen(cmd)) == 0) { + if (curdir[1] == '\0') + fprintf(stderr, "/\n"); + else + fprintf(stderr, "%s\n", &curdir[1]); + } + /* + * Toggle prompt mode. + */ + else if (strncmp(cmd, "prompt", strlen(cmd)) == 0) { + if (pflag) { + fprintf(stderr, "prompt mode off\n"); + pflag = 0; + break; + } + fprintf(stderr, "prompt mode on\n"); + pflag++; + break; + } + else goto bad; break; /* * Quit. @@ -337,7 +352,13 @@ getcmd(char *curdir, char *cmd, char *name, int size, struct arglist *ap) * Read a command line and trim off trailing white space. */ do { - fprintf(stderr, "%s > ", __progname); + if (pflag) + fprintf(stderr, "%s:%s:%s > ", + __progname, + spcl.c_filesys, + curdir[1] ? &curdir[1] : "/"); + else + fprintf(stderr, "%s > ", __progname); (void) fflush(stderr); (void) fgets(input, BUFSIZ, terminal); } while (!feof(terminal) && input[0] == '\n'); -- 2.39.2