]> git.wh0rd.org - dump.git/blobdiff - restore/main.c
Added '-F script' option to dump.
[dump.git] / restore / main.c
index f979560c0a3a5853cd13d1a227d125ffbd81d14b..292d0cc11d35aab429d2d3501f2194f49c1aae0f 100644 (file)
@@ -2,8 +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
  */
 
 /*
  */
 
 #ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1983, 1993\n\
-       The Regents of the University of California.  All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)main.c     8.6 (Berkeley) 5/4/95";
-#endif
 static const char rcsid[] =
-       "$Id: main.c,v 1.3 1999/10/11 12:59:20 stelian Exp $";
+       "$Id: main.c,v 1.9 2000/03/02 11:34:51 stelian Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -97,7 +87,7 @@ time_t        dumpdate;
 FILE   *terminal;
 char   *tmpdir;
 int    compare_ignore_not_found;
-char   *filesys = NULL;
+char   filesys[NAMELEN];
 
 #ifdef __linux__
 char   *__progname;
@@ -117,7 +107,7 @@ main(int argc, char *argv[])
 
        /* Temp files should *not* be readable.  We set permissions later. */
        (void) umask(077);
-
+       filesys[0] = '\0';
 #ifdef __linux__
        __progname = argv[0];
 #endif
@@ -135,9 +125,9 @@ main(int argc, char *argv[])
                ;                                                               
        obsolete(&argc, &argv);
 #ifdef KERBEROS
-#define        optlist "b:CcdD:f:hikmNRrs:tT:uvxy"
+#define        optlist "b:CcdD:f:hikmMNRrs:tT:uvxy"
 #else
-#define        optlist "b:CcdD:f:himNRrs:tT:uvxy"
+#define        optlist "b:CcdD:f:himMNRrs:tT:uvxy"
 #endif
        while ((ch = getopt(argc, argv, optlist)) != -1)
                switch(ch) {
@@ -154,7 +144,8 @@ main(int argc, char *argv[])
                        cvtflag = 1;
                        break;
                case 'D':
-                       filesys = optarg;
+                       strncpy(filesys, optarg, NAMELEN);
+                       filesys[NAMELEN - 1] = '\0';
                        break;
                case 'T':
                        tmpdir = optarg;
@@ -188,6 +179,9 @@ main(int argc, char *argv[])
                case 'm':
                        mflag = 0;
                        break;
+               case 'M':
+                       Mflag = 1;
+                       break;
                case 'N':
                        Nflag = 1;
                        break;
@@ -361,12 +355,20 @@ main(int argc, char *argv[])
 static void
 usage(void)
 {
-       (void)fprintf(stderr, "usage:\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n",
-         "restore -i [-chkmuvy] [-b blocksize] [-f file] [-s fileno]",
-         "restore -r [-ckuvy] [-b blocksize] [-f file] [-s fileno]",
-         "restore -R [-ckuvy] [-b blocksize] [-f file] [-s fileno]",
-         "restore -x [-chkmuvy] [-b blocksize] [-f file] [-s fileno] [file ...]",
-         "restore -t [-chkuvy] [-b blocksize] [-f file] [-s fileno] [file ...]");
+#ifdef KERBEROS
+#define kerbflag "k"
+#else
+#define kerbflag
+#endif
+       (void)fprintf(stderr, 
+         "%s %s\n", __progname, _DUMP_VERSION);
+       (void)fprintf(stderr,
+         "usage:\t%s%s\n\t%s%s\n\t%s%s\n\t%s%s\n\t%s%s\n",
+         __progname, " -i [-ch" kerbflag "mMuvy] [-b blocksize] [-f file] [-s fileno]",
+         __progname, " -r [-c" kerbflag "Muvy] [-b blocksize] [-f file] [-s fileno]",
+         __progname, " -R [-c" kerbflag "Muvy] [-b blocksize] [-f file] [-s fileno]",
+         __progname, " -x [-ch" kerbflag "mMuvy] [-b blocksize] [-f file] [-s fileno] [file ...]",
+         __progname, " -t [-ch" kerbflag "Muvy] [-b blocksize] [-f file] [-s fileno] [file ...]");
        exit(1);
 }
 
@@ -401,8 +403,10 @@ obsolete(int *argcp, char **argvp[])
        for (flags = 0; *ap; ++ap) {
                switch (*ap) {
                case 'b':
+               case 'D':
                case 'f':
                case 's':
+               case 'T':
                        if (*argv == NULL) {
                                warnx("option requires an argument -- %c", *ap);
                                usage();