]> git.wh0rd.org - dump.git/blobdiff - restore/tape.c
Added '-F script' option to dump.
[dump.git] / restore / tape.c
index 8edca6314dd0528147cc655fc2ebdf88fe448f8b..4bce13d97400c9bf9a1ba34e83cbd00c604b87f2 100644 (file)
@@ -2,7 +2,7 @@
  *     Ported to Linux's Second Extended File System as part of the
  *     dump and restore backup suit
  *     Remy Card <card@Linux.EU.Org>, 1994-1997
- *     Stelian Pop <pop@cybercable.fr>, 1999 
+ *     Stelian Pop <pop@cybercable.fr>, 1999-2000
  */
 
 /*
@@ -45,7 +45,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.9 1999/11/22 21:39:42 tiniou Exp $";
+       "$Id: tape.c,v 1.13 2000/03/02 11:34:51 stelian Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -81,8 +81,8 @@ static const char rcsid[] =
 static long    fssize = MAXBSIZE;
 static int     mt = -1;
 static int     pipein = 0;
-static char    magtape[NAME_MAX];
-static char    magtapeprefix[NAME_MAX];
+static char    magtape[MAXPATHLEN];
+static char    magtapeprefix[MAXPATHLEN];
 static int     blkcnt;
 static int     numtrec;
 static char    *tapebuf;
@@ -165,13 +165,13 @@ setinput(char *source)
        }
        setuid(getuid());       /* no longer need or want root privileges */
        if (Mflag) {
-               strncpy(magtapeprefix, source, NAME_MAX);
-               magtapeprefix[NAME_MAX-1] = '\0';
-               snprintf(magtape, NAME_MAX, "%s%03d", source, 1);
+               strncpy(magtapeprefix, source, MAXPATHLEN);
+               magtapeprefix[MAXPATHLEN-1] = '\0';
+               snprintf(magtape, MAXPATHLEN, "%s%03d", source, 1);
        }
        else
-               strncpy(magtape, source, NAME_MAX);
-       magtape[NAME_MAX - 1] = '\0';
+               strncpy(magtape, source, MAXPATHLEN);
+       magtape[MAXPATHLEN - 1] = '\0';
 }
 
 void
@@ -239,8 +239,17 @@ setup(void)
        }
        if (vflag || command == 't' || command == 'C')
                printdumpinfo();
-       if (filesys == NULL) {
-               filesys = spcl.c_filesys;
+       if (filesys[0] == '\0') {
+               char *dirptr;
+printf("spcl.c_filesys = %s\n", spcl.c_filesys);
+               strncpy(filesys, spcl.c_filesys, NAMELEN);
+               filesys[NAMELEN - 1] = '\0';
+               dirptr = strstr(filesys, " (dir");
+printf("dirptr = %s\n", dirptr);
+               if (dirptr != NULL)
+                       *dirptr = '\0';
+printf("dirptr = %s\n", dirptr);
+printf("filesys = %s\n", filesys);
        }
        dumptime = spcl.c_ddate;
        dumpdate = spcl.c_date;
@@ -262,7 +271,7 @@ setup(void)
        if (spcl.c_type != TS_CLRI)
                errx(1, "Cannot find file removal list");
        maxino = (spcl.c_count * TP_BSIZE * NBBY) + 1;
-       Dprintf(stdout, "maxino = %ld\n", maxino);
+       Dprintf(stdout, "maxino = %ld\n", (long)maxino);
        map = calloc((unsigned)1, (unsigned)howmany(maxino, NBBY));
        if (map == NULL)
                panic("no memory for active inode map\n");
@@ -361,8 +370,8 @@ again:
        }
        closemt();
        if (Mflag) {
-               snprintf(magtape, NAME_MAX, "%s%03ld", magtapeprefix, newvol);
-               magtape[NAME_MAX - 1] = '\0';
+               snprintf(magtape, MAXPATHLEN, "%s%03ld", magtapeprefix, newvol);
+               magtape[MAXPATHLEN - 1] = '\0';
        }
        if (!Mflag || haderror) {
                haderror = 0;
@@ -1439,7 +1448,7 @@ accthdr(struct s_spcl *header)
                fprintf(stderr, "File header, ino %lu", (unsigned long)previno);
                break;
        case TS_ADDR:
-               fprintf(stderr, "File continuation header, ino %ld", previno);
+               fprintf(stderr, "File continuation header, ino %ld", (long)previno);
                break;
        case TS_END:
                fprintf(stderr, "End of tape header");