]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/findlib/match.c
Fix directory times, modes on restore
[bacula/bacula] / bacula / src / findlib / match.c
index 2dd9700d6f910e5dfe7887cd59f760fc32dc9674..8ca68db1a40bfd28c4fb94a7ea4ebde10bf7ed75 100644 (file)
@@ -6,7 +6,7 @@
  *
  */
 /*
-   Copyright (C) 2001, 2002 Kern Sibbald and John Walker
+   Copyright (C) 2001-2003 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -93,8 +93,7 @@ void add_fname_to_include_list(FF_PKT *ff, int prefixed, char *fname)
 
    len = strlen(fname);
 
-   inc =(struct s_included_file *) bmalloc(sizeof(struct s_included_file) + len + 1);
-   inc->next = ff->included_files_list;
+   inc =(struct s_included_file *)bmalloc(sizeof(struct s_included_file) + len + 1);
    inc->options = 0;
    inc->VerifyOpts[0] = 'V'; 
    inc->VerifyOpts[1] = ':';
@@ -104,18 +103,29 @@ void add_fname_to_include_list(FF_PKT *ff, int prefixed, char *fname)
    if (prefixed) {
       for (p=fname; *p && *p != ' '; p++) {
         switch (*p) {
-            case '0':                  /* no option */
+            case 'a':                 /* alway replace */
+            case '0':                 /* no option */
               break;
-            case 'M':                  /* MD5 */
+            case 'f':
+              inc->options |= OPT_multifs;
+              break;
+            case 'h':                 /* no recursion */
+              inc->options |= OPT_no_recursion;
+              break;
+            case 'M':                 /* MD5 */
               inc->options |= OPT_compute_MD5;
               break;
-            case 'Z':                  /* gzip compression */
-              inc->options |= OPT_GZIP_compression;
-               inc->level = *++p - '0';
-               Dmsg1(200, "Compression level=%d\n", inc->level);
+            case 'S':
+              inc->options |= OPT_compute_SHA1;
               break;
-            case 'h':                  /* no recursion */
-              inc->options |= OPT_no_recursion;
+            case 'n':
+              inc->options |= OPT_never_replace;
+              break;
+            case 'r':                 /* read fifo */
+              inc->options |= OPT_read_fifo;
+              break;
+            case 's':
+              inc->options |= OPT_sparse;
               break;
             case 'V':                  /* verify options */
               /* Copy Verify Options */
@@ -127,6 +137,14 @@ void add_fname_to_include_list(FF_PKT *ff, int prefixed, char *fname)
               }
               inc->VerifyOpts[j] = 0;
               break;
+            case 'w':
+              inc->options |= OPT_replace_if_newer;
+              break;
+            case 'Z':                 /* gzip compression */
+              inc->options |= OPT_GZIP_compression;
+               inc->level = *++p - '0';
+               Dmsg1(200, "Compression level=%d\n", inc->level);
+              break;
            default:
                Emsg1(M_ERROR, 0, "Unknown include/exclude option: %c\n", *p);
               break;
@@ -140,6 +158,7 @@ void add_fname_to_include_list(FF_PKT *ff, int prefixed, char *fname)
    }
 
    strcpy(inc->fname, p);                
+   p = inc->fname;
    len = strlen(p);
    /* Zap trailing slashes.  */
    p += len - 1;
@@ -156,7 +175,26 @@ void add_fname_to_include_list(FF_PKT *ff, int prefixed, char *fname)
         break;
       }
    }
-   ff->included_files_list = inc;
+#ifdef HAVE_CYGWIN
+   /* Convert any \'s into /'s */
+   for (p=inc->fname; *p; p++) {
+      if (*p == '\\') {
+         *p = '/';
+      }
+   }
+#endif
+   inc->next = NULL;
+   /* Chain this one on the end of the list */
+   if (!ff->included_files_list) {
+      /* First one, so set head */
+      ff->included_files_list = inc;
+   } else {
+      struct s_included_file *next;
+      /* Walk to end of list */
+      for (next=ff->included_files_list; next->next; next=next->next)
+        { }
+      next->next = inc;
+   }  
    Dmsg1(50, "add_fname_to_include fname=%s\n", inc->fname);
 }
 
@@ -169,6 +207,14 @@ void add_fname_to_exclude_list(FF_PKT *ff, char *fname)
    int len;
    struct s_excluded_file *exc, **list;
 
+#ifdef HAVE_CYGWIN
+   /* Convert any \'s into /'s */
+   for (char *p=fname; *p; p++) {
+      if (*p == '\\') {
+         *p = '/';
+      }
+   }
+#endif
    Dmsg1(20, "Add name to exclude: %s\n", fname);
 
    if (strchr(fname, '/')) {
@@ -199,23 +245,12 @@ struct s_included_file *get_next_included_file(FF_PKT *ff, struct s_included_fil
    } else {
       inc = ainc->next;
    }
+   /*
+    * copy inc_options for this file into the ff packet
+    */
    if (inc) {
-      if (inc->options & OPT_compute_MD5) {
-        ff->compute_MD5 = 1;
-      } else {
-        ff->compute_MD5 = 0;
-      }
-      if (inc->options & OPT_GZIP_compression) {
-        ff->GZIP_compression = 1;
-        ff->GZIP_level = inc->level;
-      } else {
-        ff->GZIP_compression = 0;
-      }
-      if (inc->options & OPT_no_recursion) {
-        ff->no_recursion = 1;
-      } else {
-        ff->no_recursion = 0;
-      }
+      ff->flags = inc->options;
+      ff->GZIP_level = inc->level;
    }
    return inc;
 }