]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/tools/testfind.c
Change old get_Jobxxx to getJobxxx
[bacula/bacula] / bacula / src / tools / testfind.c
index 2604d394feba4677fa5af09e7d7ce565407194cd..e3cd6c6d077d186776c38034835fb9a1426a06a6 100644 (file)
@@ -20,7 +20,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Bacula® is a registered trademark of John Walker.
+   Bacula® is a registered trademark of Kern Sibbald.
    The licensor of Bacula is the Free Software Foundation Europe
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
@@ -44,6 +44,7 @@
 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) { }
+extern bool parse_dir_config(CONFIG *config, const char *configfile, int exit_code);
 
 /* Global variables */
 static int num_files = 0;
@@ -52,10 +53,11 @@ static int max_path_len = 0;
 static int trunc_fname = 0;
 static int trunc_path = 0;
 static int attrs = 0;
+static CONFIG *config;
 
 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);
@@ -97,6 +99,7 @@ main (int argc, char *const *argv)
    setlocale(LC_ALL, "");
    bindtextdomain("bacula", LOCALEDIR);
    textdomain("bacula");
+   lmgr_init_thread();
 
    while ((ch = getopt(argc, argv, "ac:d:f:?")) != -1) {
       switch (ch) {
@@ -133,7 +136,8 @@ main (int argc, char *const *argv)
    argc -= optind;
    argv += optind;
 
-   parse_config(configfile);
+   config = new_config_parser();
+   parse_dir_config(config, configfile, M_ERROR_TERM);
 
    MSGS *msg;
 
@@ -163,10 +167,15 @@ main (int argc, char *const *argv)
    
    copy_fileset(ff, jcr);
 
-   find_files(jcr, ff, print_file);
+   find_files(jcr, ff, print_file, NULL);
 
    free_jcr(jcr);
-   free_config_resources();
+   if (config) {
+      config->free_resources();
+      free(config);
+      config = NULL;
+   }
+   
    term_last_jobs_list();
 
    /* Clean up fileset */
@@ -234,11 +243,12 @@ main (int argc, char *const *argv)
    term_msg();
 
    close_memory_pool();
+   lmgr_cleanup_main();
    sm_dump(false);
    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) {
@@ -624,6 +634,9 @@ static void set_options(findFOPTS *fo, const char *opts)
          fo->GZIP_level = *++p - '0';
          Dmsg1(200, "Compression level=%d\n", fo->GZIP_level);
          break;
+      case 'X':
+         fo->flags |= FO_XATTR;
+         break;
       default:
          Emsg1(M_ERROR, 0, _("Unknown include/exclude option: %c\n"), *p);
          break;