]> git.wh0rd.org - dump.git/blobdiff - dump/main.c
Dump EOM detection is now a default.
[dump.git] / dump / main.c
index eac1f5baad11fdea07589273ef5b15d370c9742b..61afed803398fa5e486422f35a03e80949013399 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: main.c,v 1.25 2000/09/01 14:40:27 stelian Exp $";
+       "$Id: main.c,v 1.27 2000/11/10 13:22:10 stelian Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -143,6 +143,7 @@ main(int argc, char *argv[])
 #endif
 
        tsize = 0;      /* Default later, based on 'c' option for cart tapes */
+       unlimited = 1;
        eot_script = NULL;
        if ((tapeprefix = getenv("TAPE")) == NULL)
                tapeprefix = _PATH_DEFTAPE;
@@ -175,6 +176,7 @@ main(int argc, char *argv[])
                        break;
 
                case 'B':               /* blocks per output file */
+                       unlimited = 0;
                        blocksperfile = numarg("number of blocks per file",
                            1L, 0L);
                        break;
@@ -191,10 +193,12 @@ main(int argc, char *argv[])
                        break;
 
                case 'c':               /* Tape is cart. not 9-track */
+                       unlimited = 0;
                        cartridge = 1;
                        break;
 
                case 'd':               /* density, in bits per inch */
+                       unlimited = 0;
                        density = numarg("density", 10L, 327670L) / 10;
                        if (density >= 625 && !bflag)
                                ntrec = HIGHDENSITYTREC;
@@ -208,7 +212,7 @@ main(int argc, char *argv[])
                        }
                        iexclude_list[iexclude_num++] = numarg("inode to exclude",0L,0L);
                        if (iexclude_list[iexclude_num-1] <= ROOTINO) {
-                               (void)fprintf(stderr, "Cannot exclude inode %d\n", iexclude_list[iexclude_num-1]);
+                               (void)fprintf(stderr, "Cannot exclude inode %ld\n", iexclude_list[iexclude_num-1]);
                                exit(X_STARTUP);
                        }
                        msg("Added %d to exclude list\n",
@@ -259,6 +263,7 @@ main(int argc, char *argv[])
                        break;
 
                case 's':               /* tape size, feet */
+                       unlimited = 0;
                        tsize = numarg("tape size", 1L, 0L) * 12 * 10;
                        break;
 
@@ -398,26 +403,36 @@ main(int argc, char *argv[])
                (void)strncpy(spcl.c_filesys, dt->fs_file, NAMELEN);
 #ifdef __linux__
        } else {
-               /*
-                * The argument was not found in the fstab
-                * assume that this is a subtree and search for it
-                */
 #ifdef HAVE_REALPATH
                if (realpath(disk, pathname) == NULL)
 #endif
                        strcpy(pathname, disk);
-               dt = fstabsearchdir(pathname, directory);
-               if (dt != NULL) {
-                       char name[MAXPATHLEN];
-                       (void)strncpy(spcl.c_dev, dt->fs_spec, NAMELEN);
-                       (void)snprintf(name, sizeof(name), "%s (dir %s)",
-                                     dt->fs_file, directory);
-                       (void)strncpy(spcl.c_filesys, name, NAMELEN);
+               /*
+                * The argument could be now a mountpoint of
+                * a filesystem specified in fstab. Search for it.
+                */
+               if ((dt = fstabsearch(pathname)) != NULL) {
                        disk = rawname(dt->fs_spec);
+                       (void)strncpy(spcl.c_dev, dt->fs_spec, NAMELEN);
+                       (void)strncpy(spcl.c_filesys, dt->fs_file, NAMELEN);
                } else {
-                       (void)strncpy(spcl.c_dev, disk, NAMELEN);
-                       (void)strncpy(spcl.c_filesys, "an unlisted file system",
-                           NAMELEN);
+                       /*
+                        * The argument was not found in the fstab
+                        * assume that this is a subtree and search for it
+                        */
+                       dt = fstabsearchdir(pathname, directory);
+                       if (dt != NULL) {
+                               char name[MAXPATHLEN];
+                               (void)strncpy(spcl.c_dev, dt->fs_spec, NAMELEN);
+                               (void)snprintf(name, sizeof(name), "%s (dir %s)",
+                                             dt->fs_file, directory);
+                               (void)strncpy(spcl.c_filesys, name, NAMELEN);
+                               disk = rawname(dt->fs_spec);
+                       } else {
+                               (void)strncpy(spcl.c_dev, disk, NAMELEN);
+                               (void)strncpy(spcl.c_filesys, "an unlisted file system",
+                                   NAMELEN);
+                       }
                }
        }
 #else