]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/tools/testfind.c
ebl Add program to validate TCDBM lib with accurate mode
[bacula/bacula] / bacula / src / tools / testfind.c
index a14799a9a6c026fc2c6c29dcb1d618403a35c2a9..246b4df8255f34a98e0b790b8690ad23a7cb502a 100644 (file)
@@ -1,13 +1,7 @@
-/*
- * Test program for find files
- *
- *  Kern Sibbald, MM
- *
- */
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
 */
+/*
+ * Test program for find files
+ *
+ *  Kern Sibbald, MM
+ *
+ */
 
 #include "bacula.h"
 #include "dird/dird.h"
 #include "findlib/find.h"
 
-
 #if defined(HAVE_WIN32)
 #define isatty(fd) (fd==0)
 #endif
@@ -44,6 +43,7 @@
 /* Dummy functions */
 int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
 int generate_job_event(JCR *jcr, const char *event) { return 1; }
+void generate_plugin_event(JCR *jcr, bEventType eventType, void *value) { }
 
 /* Global variables */
 static int num_files = 0;
@@ -55,7 +55,7 @@ static int attrs = 0;
 
 static JCR *jcr;
 
-static int print_file(FF_PKT *ff, void *pkt, bool);
+static int print_file(JCR *jcr, FF_PKT *ff, bool);
 static void count_files(FF_PKT *ff);
 static bool copy_fileset(FF_PKT *ff, JCR *jcr);
 static void set_options(findFOPTS *fo, const char *opts);
@@ -66,7 +66,8 @@ static void usage()
 "\n"
 "Usage: testfind [-d debug_level] [-] [pattern1 ...]\n"
 "       -a          print extended attributes (Win32 debug)\n"
-"       -dnn        set debug level to nn\n"
+"       -d <nn>     set debug level to <nn>\n"
+"       -dt         print timestamp in debug output\n"
 "       -c          specify config file containing FileSet resources\n"
 "       -f          specify which FileSet to use\n"
 "       -?          print this message.\n"
@@ -87,8 +88,8 @@ int
 main (int argc, char *const *argv)
 {
    FF_PKT *ff;
-   char *configfile = "bacula-dir.conf";
-   char *fileset_name = "Windows-Full-Set";
+   const char *configfile = "bacula-dir.conf";
+   const char *fileset_name = "Windows-Full-Set";
    int ch, hard_links;
 
    OSDependentInit();
@@ -108,10 +109,14 @@ main (int argc, char *const *argv)
             break;
 
          case 'd':                    /* set debug level */
+         if (*optarg == 't') {
+            dbg_timestamp = true;
+         } else {
             debug_level = atoi(optarg);
             if (debug_level <= 0) {
                debug_level = 1;
             }
+         }
             break;
 
          case 'f':                    /* exclude patterns */
@@ -186,12 +191,6 @@ main (int argc, char *const *argv)
             fo->wildbase.destroy();
             fo->fstype.destroy();
             fo->drivetype.destroy();
-            if (fo->reader) {
-               free(fo->reader);
-            }
-            if (fo->writer) {
-               free(fo->writer);
-            }
          }
          incexe->opts_list.destroy();
          incexe->name_list.destroy();
@@ -239,7 +238,7 @@ main (int argc, char *const *argv)
    exit(0);
 }
 
-static int print_file(FF_PKT *ff, void *pkt, bool top_level) 
+static int print_file(JCR *jcr, FF_PKT *ff, bool top_level) 
 {
 
    switch (ff->type) {
@@ -508,12 +507,6 @@ static bool copy_fileset(FF_PKT *ff, JCR *jcr)
             for (k=0; k<fo->drivetype.size(); k++) {
                current_opts->drivetype.append(bstrdup((const char *)fo->drivetype.get(k)));
             }
-            if (fo->reader) {
-               current_opts->reader = bstrdup(fo->reader);
-            }
-            if (fo->writer) {
-               current_opts->writer = bstrdup(fo->writer);
-            }
          }
 
          for (j=0; j<ie->name_list.size(); j++) {