]> git.sur5r.net Git - bacula/bacula/commitdiff
Cleanup Python build so that Python is not dragged
authorKern Sibbald <kern@sibbald.com>
Tue, 19 Apr 2005 09:49:20 +0000 (09:49 +0000)
committerKern Sibbald <kern@sibbald.com>
Tue, 19 Apr 2005 09:49:20 +0000 (09:49 +0000)
  into programs that don't use it.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1936 91ce42f0-d328-0410-95d8-f526ca767f89

18 files changed:
bacula/examples/python/EndJob.py
bacula/kernstodo
bacula/src/console/console.c
bacula/src/dird/newvol.c
bacula/src/dird/python.c
bacula/src/lib/protos.h
bacula/src/lib/python.c
bacula/src/stored/Makefile.in
bacula/src/stored/bcopy.c
bacula/src/stored/bls.c
bacula/src/stored/bscan.c
bacula/src/stored/btape.c
bacula/src/tools/bsmtp.c
bacula/src/tools/dbcheck.c
bacula/src/tools/fstype.c
bacula/src/tools/testfind.c
bacula/src/tools/testls.c
bacula/src/version.h

index adcd49729a297d9392e0835f207794f4366efc26..f32df1f2f4657ad5977eae158fc25463e8c57fee 100644 (file)
@@ -1,11 +1,11 @@
 import bacula
 
 def EndJob(jcr):
-    jobid = jcr.get("JobId")
-    client = jcr.get("Client") 
-    jcr.set(JobReport="Python EndJob output: JobId=%d Client=%s.\n" % (jobid, client))
-    if (jobid < 2) :
-       startid = bacula.run("run kernsave")
-       print "Python started new Job: jobid=", startid
+     jobid = jcr.get("JobId")
+     client = jcr.get("Client") 
+     jcr.set(JobReport="Python EndJob output: JobId=%d Client=%s.\n" % (jobid, client))
+     if (jobid < 2) :
+        startid = bacula.run("run kernsave")
+        print "Python started new Job: jobid=", startid
 
-    return 1
+     return 1
index d8ef55de0dc7ec64028e3da9922308969c30af03..31055d0381af61991ad15cdad1d982a92a5efbf5 100644 (file)
@@ -28,6 +28,8 @@ Autochangers:
      all Volumes from other drives.  "update slots all-drives"?
   
 For 1.37:
+- Look at dird_conf.c:1000: warning: `int size' 
+  might be used uninitialized in this function
 - Make a callback when Rerun failed levels is called.
 - Give Python program access to Scheduled jobs.
 - Implement some way to turn off automatic pruning in Jobs.
index 8bf17863fddfe593a5203ede959622668b60f0ab..850bc21a12def9cacc2e8ce962fdf3d02e70a194 100644 (file)
@@ -59,7 +59,8 @@ extern int rl_catch_signals;
 /* Imported functions */
 int authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons);
 
-
+/* Dummy functions */
+int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
 
 /* Forward referenced functions */
 static void terminate_console(int sig);
@@ -79,7 +80,7 @@ static char *configfile = NULL;
 static BSOCK *UA_sock = NULL;
 static DIRRES *dir;
 static FILE *output = stdout;
-static bool tee = false;                 /* output to output and stdout */
+static bool tee = false;                  /* output to output and stdout */
 static bool stop = false;
 static int argc;
 static POOLMEM *args;
@@ -159,7 +160,7 @@ static struct cmdstruct commands[] = {
  { N_("version"),    versioncmd,   _("print Console's version")},
  { N_("exit"),       quitcmd,      _("exit = quit")},
  { N_("zed_keyst"),  zed_keyscmd,  _("zed_keys = use zed keys instead of bash keys")},
-            };
+             };
 #define comsize (sizeof(commands)/sizeof(struct cmdstruct))
 
 static int do_a_command(FILE *input, BSOCK *UA_sock)
@@ -183,11 +184,11 @@ static int do_a_command(FILE *input, BSOCK *UA_sock)
       return 1;
    }
    len = strlen(cmd);
-   for (i=0; i<comsize; i++) {    /* search for command */
+   for (i=0; i<comsize; i++) {     /* search for command */
       if (strncasecmp(cmd,  _(commands[i].key), len) == 0) {
-        stat = (*commands[i].func)(input, UA_sock);   /* go execute command */
-        found = 1;
-        break;
+         stat = (*commands[i].func)(input, UA_sock);   /* go execute command */
+         found = 1;
+         break;
       }
    }
    if (!found) {
@@ -211,82 +212,82 @@ static void read_and_process_input(FILE *input, BSOCK *UA_sock)
          prompt = "";
       } else {
          prompt = "*";
-        at_prompt = true;
+         at_prompt = true;
       }
       if (tty_input) {
-        stat = get_cmd(input, prompt, UA_sock, 30);
-        if (usrbrk() == 1) {
-           clrbrk();
-        }
-        if (usrbrk()) {
-           break;
-        }
+         stat = get_cmd(input, prompt, UA_sock, 30);
+         if (usrbrk() == 1) {
+            clrbrk();
+         }
+         if (usrbrk()) {
+            break;
+         }
       } else {
-        /* Reading input from a file */
-        int len = sizeof_pool_memory(UA_sock->msg) - 1;
-        if (usrbrk()) {
-           break;
-        }
-        if (fgets(UA_sock->msg, len, input) == NULL) {
-           stat = -1;
-        } else {
-           sendit(UA_sock->msg);  /* echo to terminal */
-           strip_trailing_junk(UA_sock->msg);
-           UA_sock->msglen = strlen(UA_sock->msg);
-           stat = 1;
-        }
+         /* Reading input from a file */
+         int len = sizeof_pool_memory(UA_sock->msg) - 1;
+         if (usrbrk()) {
+            break;
+         }
+         if (fgets(UA_sock->msg, len, input) == NULL) {
+            stat = -1;
+         } else {
+            sendit(UA_sock->msg);  /* echo to terminal */
+            strip_trailing_junk(UA_sock->msg);
+            UA_sock->msglen = strlen(UA_sock->msg);
+            stat = 1;
+         }
       }
       if (stat < 0) {
-        break;                       /* error or interrupt */
-      } else if (stat == 0) {        /* timeout */
+         break;                       /* error or interrupt */
+      } else if (stat == 0) {         /* timeout */
          if (strcmp(prompt, "*") == 0) {
             bnet_fsend(UA_sock, ".messages");
-        } else {
-           continue;
-        }
+         } else {
+            continue;
+         }
       } else {
-        at_prompt = FALSE;
-        /* @ => internal command for us */
+         at_prompt = FALSE;
+         /* @ => internal command for us */
          if (UA_sock->msg[0] == '@') {
-           parse_args(UA_sock->msg, &args, &argc, argk, argv, MAX_CMD_ARGS);
-           if (!do_a_command(input, UA_sock)) {
-              break;
-           }
-           continue;
-        }
-        if (!bnet_send(UA_sock)) {   /* send command */
-           break;                    /* error */
-        }
+            parse_args(UA_sock->msg, &args, &argc, argk, argv, MAX_CMD_ARGS);
+            if (!do_a_command(input, UA_sock)) {
+               break;
+            }
+            continue;
+         }
+         if (!bnet_send(UA_sock)) {   /* send command */
+            break;                    /* error */
+         }
       }
       if (strcmp(UA_sock->msg, ".quit") == 0 || strcmp(UA_sock->msg, ".exit") == 0) {
-        break;
+         break;
       }
       while ((stat = bnet_recv(UA_sock)) >= 0) {
-        if (at_prompt) {
-           if (!stop) {
+         if (at_prompt) {
+            if (!stop) {
                sendit("\n");
-           }
-           at_prompt = false;
-        }
-        /* Suppress output if running in background or user hit ctl-c */
-        if (!stop && !usrbrk()) {
-           sendit(UA_sock->msg);
-        }
+            }
+            at_prompt = false;
+         }
+         /* Suppress output if running in background or user hit ctl-c */
+         if (!stop && !usrbrk()) {
+            sendit(UA_sock->msg);
+         }
       }
       if (usrbrk() > 1) {
-        break;
+         break;
       } else {
-        clrbrk();
+         clrbrk();
       }
       if (!stop) {
-        fflush(stdout);
+         fflush(stdout);
       }
       if (is_bnet_stop(UA_sock)) {
-        break;                       /* error or term */
+         break;                       /* error or term */
       } else if (stat == BNET_SIGNAL) {
-        if (UA_sock->msglen == BNET_PROMPT) {
-           at_prompt = true;
-        }
+         if (UA_sock->msglen == BNET_PROMPT) {
+            at_prompt = true;
+         }
          Dmsg1(100, "Got poll %s\n", bnet_sig_to_ascii(UA_sock));
       }
    }
@@ -295,7 +296,7 @@ static void read_and_process_input(FILE *input, BSOCK *UA_sock)
 
 /*********************************************************************
  *
- *        Main Bacula Console -- User Interface Program
+ *         Main Bacula Console -- User Interface Program
  *
  */
 int main(int argc, char *argv[])
@@ -316,32 +317,32 @@ int main(int argc, char *argv[])
    while ((ch = getopt(argc, argv, "bc:d:r:st?")) != -1) {
       switch (ch) {
       case 'c':                    /* configuration file */
-        if (configfile != NULL) {
-           free(configfile);
-        }
-        configfile = bstrdup(optarg);
-        break;
+         if (configfile != NULL) {
+            free(configfile);
+         }
+         configfile = bstrdup(optarg);
+         break;
 
       case 'd':
-        debug_level = atoi(optarg);
-        if (debug_level <= 0) {
-           debug_level = 1;
-        }
-        break;
+         debug_level = atoi(optarg);
+         if (debug_level <= 0) {
+            debug_level = 1;
+         }
+         break;
 
       case 's':                    /* turn off signals */
-        no_signals = true;
-        break;
+         no_signals = true;
+         break;
 
       case 't':
-        test_config = true;
-        break;
+         test_config = true;
+         break;
 
       case '?':
       default:
-        usage();
-        con_term();
-        exit(1);
+         usage();
+         con_term();
+         exit(1);
       }
    }
    argc -= optind;
@@ -393,7 +394,7 @@ int main(int argc, char *argv[])
 
    memset(&jcr, 0, sizeof(jcr));
 
-   (void)WSA_Init();                       /* Initialize Windows sockets */
+   (void)WSA_Init();                        /* Initialize Windows sockets */
 
    if (ndir > 1) {
       struct sockaddr client_addr;
@@ -405,22 +406,22 @@ try_again:
       ndir = 0;
       foreach_res(dir, R_DIRECTOR) {
          senditf( _("%d  %s at %s:%d\n"), 1+ndir++, dir->hdr.name, dir->address,
-           dir->DIRport);
+            dir->DIRport);
       }
       UnlockRes();
       if (get_cmd(stdin, _("Select Director: "), UA_sock, 600) < 0) {
-        (void)WSACleanup();               /* Cleanup Windows sockets */
-        return 1;
+         (void)WSACleanup();               /* Cleanup Windows sockets */
+         return 1;
       }
       item = atoi(UA_sock->msg);
       if (item < 0 || item > ndir) {
          senditf(_("You must enter a number between 1 and %d\n"), ndir);
-        goto try_again;
+         goto try_again;
       }
       LockRes();
       dir = NULL;
       for (i=0; i<item; i++) {
-        dir = (DIRRES *)GetNextRes(R_DIRECTOR, (RES *)dir);
+         dir = (DIRRES *)GetNextRes(R_DIRECTOR, (RES *)dir);
       }
       UnlockRes();
       term_bsock(UA_sock);
@@ -432,7 +433,7 @@ try_again:
 
    senditf(_("Connecting to Director %s:%d\n"), dir->address,dir->DIRport);
    UA_sock = bnet_connect(NULL, 5, 15, "Director daemon", dir->address,
-                         NULL, dir->DIRport, 0);
+                          NULL, dir->DIRport, 0);
    if (UA_sock == NULL) {
       terminate_console(0);
       return 1;
@@ -461,8 +462,8 @@ try_again:
       pm_strcat(&UA_sock->msg, "/.bconsolerc");
       fd = fopen(UA_sock->msg, "r");
       if (fd) {
-        read_and_process_input(fd, UA_sock);
-        fclose(fd);
+         read_and_process_input(fd, UA_sock);
+         fclose(fd);
       }
    }
 
@@ -484,13 +485,13 @@ static void terminate_console(int sig)
 
    static bool already_here = false;
 
-   if (already_here) {               /* avoid recursive temination problems */
+   if (already_here) {                /* avoid recursive temination problems */
       exit(1);
    }
    already_here = true;
    free_pool_memory(args);
    con_term();
-   (void)WSACleanup();              /* Cleanup Windows sockets */
+   (void)WSACleanup();               /* Cleanup Windows sockets */
    if (sig != 0) {
       exit(1);
    }
@@ -509,7 +510,7 @@ get_cmd(FILE *input, const char *prompt, BSOCK *sock, int sec)
 {
    char *line;
 
-   rl_catch_signals = 0;             /* do it ourselves */
+   rl_catch_signals = 0;              /* do it ourselves */
    line = readline((char *)prompt);   /* cast needed for old readlines */
 
    if (!line) {
@@ -528,8 +529,8 @@ get_cmd(FILE *input, const char *prompt, BSOCK *sock, int sec)
 
 /*
  *   Returns: 1 if data available
- *           0 if timeout
- *          -1 if error
+ *            0 if timeout
+ *           -1 if error
  */
 static int
 wait_for_data(int fd, int sec)
@@ -546,15 +547,15 @@ wait_for_data(int fd, int sec)
       FD_ZERO(&fdset);
       FD_SET((unsigned)fd, &fdset);
       switch(select(fd + 1, &fdset, NULL, NULL, &tv)) {
-      case 0:                        /* timeout */
-        return 0;
+      case 0:                         /* timeout */
+         return 0;
       case -1:
-        if (errno == EINTR || errno == EAGAIN) {
-           continue;
-        }
-        return -1;                  /* error return */
+         if (errno == EINTR || errno == EAGAIN) {
+            continue;
+         }
+         return -1;                  /* error return */
       default:
-        return 1;
+         return 1;
       }
    }
 }
@@ -563,8 +564,8 @@ wait_for_data(int fd, int sec)
  * Get next input command from terminal.
  *
  *   Returns: 1 if got input
- *           0 if timeout
- *          -1 if EOF or error
+ *            0 if timeout
+ *           -1 if EOF or error
  */
 int
 get_cmd(FILE *input, const char *prompt, BSOCK *sock, int sec)
@@ -572,29 +573,29 @@ get_cmd(FILE *input, const char *prompt, BSOCK *sock, int sec)
    int len;
    if (!stop) {
       if (output == stdout || tee) {
-        sendit(prompt);
+         sendit(prompt);
       }
    }
 again:
    switch (wait_for_data(fileno(input), sec)) {
    case 0:
-      return 0;                   /* timeout */
+      return 0;                    /* timeout */
    case -1:
-      return -1;                  /* error */
+      return -1;                   /* error */
    default:
       len = sizeof_pool_memory(sock->msg) - 1;
       if (stop) {
-        sleep(1);
-        goto again;
+         sleep(1);
+         goto again;
       }
 #ifdef HAVE_CONIO
       if (isatty(fileno(input))) {
-        input_line(sock->msg, len);
-        break;
+         input_line(sock->msg, len);
+         break;
       }
 #endif
       if (fgets(sock->msg, len, input) == NULL) {
-        return -1;
+         return -1;
       }
       break;
    }
@@ -630,7 +631,7 @@ static int inputcmd(FILE *input, BSOCK *UA_sock)
    fd = fopen(argk[1], "r");
    if (!fd) {
       senditf(_("Cannot open file %s for input. ERR=%s\n"),
-        argk[1], strerror(errno));
+         argk[1], strerror(errno));
       return 1;
    }
    read_and_process_input(fd, UA_sock);
@@ -664,9 +665,9 @@ static int do_outputcmd(FILE *input, BSOCK *UA_sock)
    }
    if (argc == 1) {
       if (output != stdout) {
-        fclose(output);
-        output = stdout;
-        tee = false;
+         fclose(output);
+         output = stdout;
+         tee = false;
       }
       return 1;
    }
@@ -676,7 +677,7 @@ static int do_outputcmd(FILE *input, BSOCK *UA_sock)
    fd = fopen(argk[1], mode);
    if (!fd) {
       senditf(_("Cannot open file %s for output. ERR=%s\n"),
-        argk[1], strerror(errno));
+         argk[1], strerror(errno));
       return 1;
    }
    output = fd;
@@ -729,18 +730,18 @@ void sendit(const char *buf)
        char *p, *q;
        /*
         * Here, we convert every \n into \r\n because the
-       *  terminal is in raw mode when we are using
-       *  conio.
-       */
+        *  terminal is in raw mode when we are using
+        *  conio.
+        */
        for (p=q=buf; (p=strchr(q, '\n')); ) {
-         if (p-q > 0) {
-            t_sendl(q, p-q);
-         }
+          if (p-q > 0) {
+             t_sendl(q, p-q);
+          }
           t_sendl("\r\n", 2);
           q = ++p;                    /* point after \n */
        }
        if (*q) {
-         t_send(q);
+          t_send(q);
        }
     }
     if (output != stdout) {
index 1d8d04b97922b01c7da05b56ae1cce2e4ed379bf..e82d2ebdf28626e671bc46dc60c91b2beb786d77 100644 (file)
@@ -84,6 +84,8 @@ bool newVolume(JCR *jcr, MEDIA_DBR *mr)
                goto bail_out;
             }
          }
+      } else {                                       
+         goto bail_out;
       }
       pr.NumVols++;
       if (db_create_media_record(jcr, jcr->db, mr) &&
index 926c877e42036d821b1a71b93d7bce2a38bb96df..e717b1271e8eee2d6ef629f8380ec8a263599553 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 /*
-   Copyright (C) 2000-2005 Kern Sibbald
+   Copyright (C) 2004-2005 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -42,8 +42,7 @@ static PyObject *jcr_get(PyObject *self, PyObject *args);
 static PyObject *jcr_write(PyObject *self, PyObject *args);
 static PyObject *jcr_set(PyObject *self, PyObject *args, PyObject *keyw);
 static PyObject *set_jcr_events(PyObject *self, PyObject *args);
-
-PyObject *bacula_run(PyObject *self, PyObject *args);
+static PyObject *jcr_run(PyObject *self, PyObject *args);
 
 /* Define Job entry points */
 PyMethodDef JobMethods[] = {
@@ -52,7 +51,7 @@ PyMethodDef JobMethods[] = {
         "Set Job variables."},
     {"set_events", set_jcr_events, METH_VARARGS, "Define Job events."},
     {"write", jcr_write, METH_VARARGS, "Write output."},
-//  {"run", (PyCFunction)bacula_run, METH_VARARGS, "Run a Bacula command."},
+    {"run", (PyCFunction)jcr_run, METH_VARARGS, "Run a Bacula command."},
     {NULL, NULL, 0, NULL}             /* last item */
 };
 
@@ -60,7 +59,6 @@ PyMethodDef JobMethods[] = {
 static PyObject *open_method = NULL;
 static PyObject *read_method = NULL;
 static PyObject *close_method = NULL;
-static PyObject *volname_method = NULL;
 
 struct s_vars {
    const char *name;
@@ -178,7 +176,6 @@ static PyObject *set_jcr_events(PyObject *self, PyObject *args)
    open_method = find_method(eObject, open_method, "open");
    read_method = find_method(eObject, read_method, "read");
    close_method = find_method(eObject, close_method, "close");
-   volname_method = find_method(eObject, volname_method, "VolumeName");
    Py_INCREF(Py_None);
    return Py_None;
 }
@@ -199,11 +196,36 @@ static PyObject *jcr_write(PyObject *self, PyObject *args)
    return Py_None;
 }
 
+/* Run a Bacula command */
+static PyObject *jcr_run(PyObject *self, PyObject *args)
+{
+   JCR *jcr;
+   char *item;
+   int stat;
+
+   if (!PyArg_ParseTuple(args, "s:get", &item)) {
+      return NULL;
+   }
+   jcr = get_jcr_from_PyObject(self);
+   UAContext *ua = new_ua_context(jcr);
+   ua->batch = true;
+   pm_strcpy(ua->cmd, item);          /* copy command */
+   parse_ua_args(ua);                 /* parse command */
+   stat = run_cmd(ua, ua->cmd);
+   free_ua_context(ua);
+   return Py_BuildValue("i", stat);
+}
+
+
 int generate_job_event(JCR *jcr, const char *event)
 {
+#ifdef xxx
+   PyObject *eObject, *method;
    PyEval_AcquireLock();
 
-   PyObject *result = PyObject_CallFunction(open_method, "s", "m.py");
+   method = find_method(eObject, method, event);
+
+   PyObject *result = PyObject_CallFunction(method, "s", "m.py");
    if (result == NULL) {
       PyErr_Print();
       PyErr_Clear();
@@ -211,36 +233,14 @@ int generate_job_event(JCR *jcr, const char *event)
    Py_XDECREF(result);
 
    PyEval_ReleaseLock();
+#endif
    return 1;
 }
 
 #else
 
 /* Dummy if Python not configured */
-int generate_job_event(JCR *jcr, const char *event)
-{ return 1; }
+int generate_job_event(JCR *jcr, const char *event) { return 1; }
    
 
 #endif /* HAVE_PYTHON */
-
-#ifdef xxx
-/* Run a Bacula command */
-PyObject *bacula_run(PyObject *self, PyObject *args)
-{
-   JCR *jcr;
-   char *item;
-   int stat;
-
-   if (!PyArg_ParseTuple(args, "s:get", &item)) {
-      return NULL;
-   }
-   jcr = get_jcr_from_PyObject(self);
-   UAContext *ua = new_ua_context(jcr);
-   ua->batch = true;
-   pm_strcpy(ua->cmd, item);          /* copy command */
-   parse_ua_args(ua);                 /* parse command */
-   stat = run_cmd(ua, ua->cmd);
-   free_ua_context(ua);
-   return Py_BuildValue("i", stat);
-}
-#endif
index 81a9a3e26dc62d5e4be6408c1350dfb7c9d52bb6..36c7f53c0963a46e391e01bd985bffa62baa49b4 100644 (file)
@@ -179,7 +179,8 @@ typedef int (EVENT_HANDLER)(JCR *jcr, const char *event);
 void init_python_interpreter(const char *progname, const char *scripts,
                              const char *module);
 void term_python_interpreter();
-extern EVENT_HANDLER *generate_daemon_event;
+//extern EVENT_HANDLER *generate_daemon_event;
+int generate_daemon_event(JCR *jcr, const char *event);
 
 /* signal.c */
 void             init_signals             (void terminate(int sig));
index fd7f23725fae967708827ead6cf55d827c0e7b70..cfc3ebde90f25af4ade28e66e3dd43a632339a30 100644 (file)
@@ -31,8 +31,6 @@
 #include "bacula.h"
 #include "jcr.h"
 
-EVENT_HANDLER *generate_daemon_event;
-
 #ifdef HAVE_PYTHON
 
 #undef _POSIX_C_SOURCE
@@ -49,7 +47,6 @@ static PyObject *Exit_method = NULL;
 
 static PyObject *set_bacula_events(PyObject *self, PyObject *args);
 static PyObject *bacula_write(PyObject *self, PyObject *args);
-int _generate_daemon_event(JCR *jcr, const char *event);
 
 PyObject *find_method(PyObject *eventsObject, PyObject *method, char *name);
 
@@ -61,10 +58,6 @@ static PyMethodDef BaculaMethods[] = {
 };
 
 
-/* Pull in Bacula entry points */
-extern PyMethodDef JobMethods[];
-
-
 /*
  * This is a Bacula Job type as defined in Python. We store a pointer
  *   to the jcr. That is all we need, but the user's script may keep
@@ -153,11 +146,9 @@ void init_python_interpreter(const char *progname, const char *scripts,
       PyErr_Clear();
    }
    PyEval_ReleaseLock();
-   generate_daemon_event = _generate_daemon_event;
 }
 
 
-
 void term_python_interpreter()
 {
    Py_XDECREF(StartUp_module);
@@ -222,7 +213,7 @@ PyObject *find_method(PyObject *eventsObject, PyObject *method, char *name)
  *          -1 on Python error
  *           1 OK
  */
-int _generate_daemon_event(JCR *jcr, const char *event)
+int generate_daemon_event(JCR *jcr, const char *event)
 {
    PyObject *pJCR;
    int stat = -1;
@@ -357,16 +348,10 @@ bail_out:
  *  No Python configured -- create external entry points and
  *    dummy routines so that library code can call this without
  *    problems even if it is not configured.
-
  */
-
-int _generate_daemon_event(JCR *jcr, const char *event) { return 0; }
+int generate_daemon_event(JCR *jcr, const char *event) { return 0; }
 void init_python_interpreter(const char *progname, const char *scripts,
-         const char *module) 
-{
-   generate_daemon_event = _generate_daemon_event;   
-}
+         const char *module) { }
 void term_python_interpreter() { }
 
-
 #endif /* HAVE_PYTHON */
index b3bb074517dfa3738cb83cbc68c3bbe3c68fa0e9..6b87fe59c12f1e58059b0cde717ec8a02cfdbd5d 100644 (file)
@@ -108,7 +108,7 @@ btape.o: btape.c
 
 btape: $(TAPEOBJS) ../lib/libbac.a ../cats/libsql.a
        $(CXX) $(TTOOL_LDFLAGS) $(LDFLAGS) -L../lib -L../cats  -o $@ $(TAPEOBJS) \
- -lsql $(DLIB) -lbac -lm $(PYTHON_LIBS) $(LIBS) 
+ -lsql $(DLIB) -lbac -lm $(LIBS) 
 
 bls.o: bls.c
        $(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) $(PYTHON_INC) -I$(srcdir) \
@@ -116,7 +116,7 @@ bls.o:      bls.c
 
 bls:   ../findlib/libfind.a $(BLSOBJS) ../lib/libbac.a
        $(CXX) $(TTOOL_LDFLAGS) $(LDFLAGS) -L../lib -L../findlib -o $@ $(BLSOBJS) $(DLIB) -lfind \
- -lbac -lm $(PYTHON_LIBS) $(LIBS) 
+ -lbac -lm $(LIBS) 
 
 bextract.o: bextract.c
        $(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) $(PYTHON_INC) -I$(srcdir) \
@@ -132,15 +132,15 @@ bscan.o: bscan.c
 
 bscan: ../findlib/libfind.a $(SCNOBJS) ../cats/libsql.a
        $(CXX) $(TTOOL_LDFLAGS) $(LDFLAGS) -L../lib -L../cats -L../findlib -o $@ $(SCNOBJS) \
- -lsql $(DB_LIBS) $(FDLIBS) -lfind -lbac -lm $(PYTHON_LIBS) $(LIBS) 
+ -lsql $(DB_LIBS) $(FDLIBS) -lfind -lbac -lm $(LIBS) 
 
 bcopy.o: bcopy.c
-       $(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) $(PYTHON_INC) -I$(srcdir) \
+       $(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) \
  -I$(basedir) $(DINCLUDE) $(CFLAGS) $<
 
 bcopy: $(COPYOBJS) ../findlib/libfind.a ../lib/libbac.a
        $(CXX) $(TTOOL_LDFLAGS) $(LDFLAGS) -L../lib -L../findlib -o $@ $(COPYOBJS) \
- $(DB_LIBS) $(FDLIBS) -lfind -lbac -lm $(PYTHON_LIBS) $(LIBS) 
+ $(DB_LIBS) $(FDLIBS) -lfind -lbac -lm $(LIBS) 
 
 
 Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
index 74ef4b640c75cec253b289ef5b14d0a8ed33ca3f..3ceafca90b70b38499269d2a71351be6332832d9 100644 (file)
@@ -30,6 +30,9 @@
 #include "bacula.h"
 #include "stored.h"
 
+/* Dummy functions */
+int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
+
 /* Forward referenced functions */
 static bool record_cb(DCR *dcr, DEV_RECORD *rec);
 
@@ -37,8 +40,8 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec);
 /* Global variables */
 static DEVICE *in_dev = NULL;
 static DEVICE *out_dev = NULL;
-static JCR *in_jcr;                   /* input jcr */
-static JCR *out_jcr;                  /* output jcr */
+static JCR *in_jcr;                    /* input jcr */
+static JCR *out_jcr;                   /* output jcr */
 static BSR *bsr = NULL;
 static const char *wd = "/tmp";
 static int list_records = 0;
@@ -48,8 +51,8 @@ static DEV_BLOCK *out_block;
 
 #define CONFIG_FILE "bacula-sd.conf"
 char *configfile;
-STORES *me = NULL;                   /* our Global resource */
-bool forge_on = false;               /* proceed inspite of I/O errors */
+STORES *me = NULL;                    /* our Global resource */
+bool forge_on = false;                /* proceed inspite of I/O errors */
 pthread_mutex_t device_release_mutex = PTHREAD_MUTEX_INITIALIZER;
 pthread_cond_t wait_device_release = PTHREAD_COND_INITIALIZER;
 
@@ -85,46 +88,46 @@ int main (int argc, char *argv[])
    while ((ch = getopt(argc, argv, "b:c:d:i:o:pvw:?")) != -1) {
       switch (ch) {
       case 'b':
-        bsr = parse_bsr(NULL, optarg);
-        break;
+         bsr = parse_bsr(NULL, optarg);
+         break;
 
       case 'c':                    /* specify config file */
-        if (configfile != NULL) {
-           free(configfile);
-        }
-        configfile = bstrdup(optarg);
-        break;
+         if (configfile != NULL) {
+            free(configfile);
+         }
+         configfile = bstrdup(optarg);
+         break;
 
       case 'd':                    /* debug level */
-        debug_level = atoi(optarg);
-        if (debug_level <= 0)
-           debug_level = 1;
-        break;
+         debug_level = atoi(optarg);
+         if (debug_level <= 0)
+            debug_level = 1;
+         break;
 
       case 'i':                    /* input Volume name */
-        iVolumeName = optarg;
-        break;
+         iVolumeName = optarg;
+         break;
 
       case 'o':                    /* output Volume name */
-        oVolumeName = optarg;
-        break;
+         oVolumeName = optarg;
+         break;
 
       case 'p':
-        ignore_label_errors = true;
-        forge_on = true;
-        break;
+         ignore_label_errors = true;
+         forge_on = true;
+         break;
 
       case 'v':
-        verbose++;
-        break;
+         verbose++;
+         break;
 
       case 'w':
-        wd = optarg;
-        break;
+         wd = optarg;
+         break;
 
       case '?':
       default:
-        usage();
+         usage();
 
       }
    }
@@ -201,8 +204,8 @@ static bool record_cb(DCR *in_dcr, DEV_RECORD *rec)
 {
    if (list_records) {
       Pmsg5(000, _("Record: SessId=%u SessTim=%u FileIndex=%d Stream=%d len=%u\n"),
-           rec->VolSessionId, rec->VolSessionTime, rec->FileIndex,
-           rec->Stream, rec->data_len);
+            rec->VolSessionId, rec->VolSessionTime, rec->FileIndex,
+            rec->Stream, rec->data_len);
    }
    /*
     * Check for Start or End of Session Record
@@ -211,44 +214,44 @@ static bool record_cb(DCR *in_dcr, DEV_RECORD *rec)
    if (rec->FileIndex < 0) {
 
       if (verbose > 1) {
-        dump_label_record(in_dcr->dev, rec, 1);
+         dump_label_record(in_dcr->dev, rec, 1);
       }
       switch (rec->FileIndex) {
       case PRE_LABEL:
          Pmsg0(000, "Volume is prelabeled. This volume cannot be copied.\n");
-        return false;
+         return false;
       case VOL_LABEL:
          Pmsg0(000, "Volume label not copied.\n");
-        return true;
+         return true;
       case SOS_LABEL:
-        jobs++;
-        break;
+         jobs++;
+         break;
       case EOS_LABEL:
-        while (!write_record_to_block(out_block, rec)) {
+         while (!write_record_to_block(out_block, rec)) {
             Dmsg2(150, "!write_record_to_block data_len=%d rem=%d\n", rec->data_len,
-                      rec->remainder);
-           if (!write_block_to_device(out_jcr->dcr)) {
+                       rec->remainder);
+            if (!write_block_to_device(out_jcr->dcr)) {
                Dmsg2(90, "Got write_block_to_dev error on device %s: ERR=%s\n",
-                 out_dev->print_name(), strerror_dev(out_dev));
+                  out_dev->print_name(), strerror_dev(out_dev));
                Jmsg(out_jcr, M_FATAL, 0, _("Cannot fixup device error. %s\n"),
-                    strerror_dev(out_dev));
-           }
-        }
-        if (!write_block_to_device(out_jcr->dcr)) {
+                     strerror_dev(out_dev));
+            }
+         }
+         if (!write_block_to_device(out_jcr->dcr)) {
             Dmsg2(90, "Got write_block_to_dev error on device %s: ERR=%s\n",
-              out_dev->print_name(), strerror_dev(out_dev));
+               out_dev->print_name(), strerror_dev(out_dev));
             Jmsg(out_jcr, M_FATAL, 0, _("Cannot fixup device error. %s\n"),
-                 strerror_dev(out_dev));
-        }
-        break;
+                  strerror_dev(out_dev));
+         }
+         break;
       case EOM_LABEL:
          Pmsg0(000, "EOM label not copied.\n");
-        return true;
-      case EOT_LABEL:             /* end of all tapes */
+         return true;
+      case EOT_LABEL:              /* end of all tapes */
          Pmsg0(000, "EOT label not copied.\n");
-        return true;
+         return true;
       default:
-        break;
+         break;
       }
    }
 
@@ -256,13 +259,13 @@ static bool record_cb(DCR *in_dcr, DEV_RECORD *rec)
    records++;
    while (!write_record_to_block(out_block, rec)) {
       Dmsg2(150, "!write_record_to_block data_len=%d rem=%d\n", rec->data_len,
-                rec->remainder);
+                 rec->remainder);
       if (!write_block_to_device(out_jcr->dcr)) {
          Dmsg2(90, "Got write_block_to_dev error on device %s: ERR=%s\n",
-           out_dev->print_name(), strerror_dev(out_dev));
+            out_dev->print_name(), strerror_dev(out_dev));
          Jmsg(out_jcr, M_FATAL, 0, _("Cannot fixup device error. %s\n"),
-              strerror_dev(out_dev));
-        break;
+               strerror_dev(out_dev));
+         break;
       }
    }
    return true;
@@ -270,13 +273,13 @@ static bool record_cb(DCR *in_dcr, DEV_RECORD *rec)
 
 
 /* Dummies to replace askdir.c */
-bool   dir_get_volume_info(DCR *dcr, enum get_vol_info_rw  writing) { return 1;}
-bool   dir_find_next_appendable_volume(DCR *dcr) { return 1;}
-bool   dir_update_volume_info(DCR *dcr, bool relabel) { return 1; }
-bool   dir_create_jobmedia_record(DCR *dcr) { return 1; }
-bool   dir_ask_sysop_to_create_appendable_volume(DCR *dcr) { return 1; }
-bool   dir_update_file_attributes(DCR *dcr, DEV_RECORD *rec) { return 1;}
-bool   dir_send_job_status(JCR *jcr) {return 1;}
+bool    dir_get_volume_info(DCR *dcr, enum get_vol_info_rw  writing) { return 1;}
+bool    dir_find_next_appendable_volume(DCR *dcr) { return 1;}
+bool    dir_update_volume_info(DCR *dcr, bool relabel) { return 1; }
+bool    dir_create_jobmedia_record(DCR *dcr) { return 1; }
+bool    dir_ask_sysop_to_create_appendable_volume(DCR *dcr) { return 1; }
+bool    dir_update_file_attributes(DCR *dcr, DEV_RECORD *rec) { return 1;}
+bool    dir_send_job_status(JCR *jcr) {return 1;}
 
 
 bool dir_ask_sysop_to_mount_volume(DCR *dcr)
index 70b2e5701b892da89e0842a1e34b9c813e32ff81..85c6e780a81025d9edf5aa6eb314ba6c86ebf2c7 100644 (file)
@@ -34,6 +34,9 @@ int win32_client = 1;
 int win32_client = 0;
 #endif
 
+/* Dummy functions */
+int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
+
 static void do_blocks(char *infname);
 static void do_jobs(char *infname);
 static void do_ls(char *fname);
index 8abda6a5e2b5efdd91dc5db4a423547778ce6a43..c8d442b13b0060649c88e4e7c7bbd946d9065913 100644 (file)
@@ -33,6 +33,9 @@
 #include "stored.h"
 #include "findlib/find.h"
 #include "cats/cats.h"
+/* Dummy functions */
+int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
 
 /* Forward referenced functions */
 static void do_scan(void);
index ee09cb4929a9d13075c3fad948785f86a73d5031..60ea8d3c5eced9fc8f6eec66f9fe73f3fac02f59 100644 (file)
@@ -36,6 +36,8 @@
 #include "bacula.h"
 #include "stored.h"
 
+/* Dummy functions */
+int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
 
 /* External subroutines */
 extern void free_config_resources();
index 929bed296890c23ed9084aa4a7409b550c924eb8..f9135266a799826612bb97ad4e234ac03c6794ff 100644 (file)
@@ -51,6 +51,9 @@ UPSINFO *core_ups = &myUPS;
 
 #endif
 
+/* Dummy functions */
+int generate_daemon_event(JCR *jcr, const char *event) 
+   { return 1; }
 
 #ifndef MAXSTRING
 #define MAXSTRING 254
@@ -79,18 +82,18 @@ static void get_response(void)
     Dmsg0(50, "Calling fgets on read socket rfp.\n");
     buf[3] = 0;
     while (fgets(buf, sizeof(buf), rfp)) {
-       int len = strlen(buf);
-       if (len > 0) {
-          buf[len-1] = 0;
-       }
-       Dmsg2(10, "%s --> %s\n", mailhost, buf);
-       if (!isdigit((int)buf[0]) || buf[0] > '3') {
-           Pmsg2(0, "Fatal malformed reply from %s: %s\n", mailhost, buf);
-           exit(1);
-       }
-       if (buf[3] != '-') {
-           break;
-       }
+        int len = strlen(buf);
+        if (len > 0) {
+           buf[len-1] = 0;
+        }
+        Dmsg2(10, "%s --> %s\n", mailhost, buf);
+        if (!isdigit((int)buf[0]) || buf[0] > '3') {
+            Pmsg2(0, "Fatal malformed reply from %s: %s\n", mailhost, buf);
+            exit(1);
+        }
+        if (buf[3] != '-') {
+            break;
+        }
     }
     return;
 }
@@ -155,44 +158,44 @@ int main (int argc, char *argv[])
    while ((ch = getopt(argc, argv, "c:d:f:h:r:s:?")) != -1) {
       switch (ch) {
       case 'c':
-        Dmsg1(20, "cc=%s\n", optarg);
-        cc_addr = optarg;
-        break;
+         Dmsg1(20, "cc=%s\n", optarg);
+         cc_addr = optarg;
+         break;
 
       case 'd':                    /* set debug level */
-        debug_level = atoi(optarg);
-        if (debug_level <= 0) {
-           debug_level = 1;
-        }
-        Dmsg1(20, "Debug level = %d\n", debug_level);
-        break;
+         debug_level = atoi(optarg);
+         if (debug_level <= 0) {
+            debug_level = 1;
+         }
+         Dmsg1(20, "Debug level = %d\n", debug_level);
+         break;
 
       case 'f':                    /* from */
-        from_addr = optarg;
-        break;
+         from_addr = optarg;
+         break;
 
       case 'h':                    /* smtp host */
-        Dmsg1(20, "host=%s\n", optarg);
-        p = strchr(optarg, ':');
-        if (p) {
-           *p++ = 0;
-           mailport = atoi(p);
-        }
-        mailhost = optarg;
-        break;
+         Dmsg1(20, "host=%s\n", optarg);
+         p = strchr(optarg, ':');
+         if (p) {
+            *p++ = 0;
+            mailport = atoi(p);
+         }
+         mailhost = optarg;
+         break;
 
       case 's':                    /* subject */
-        Dmsg1(20, "subject=%s\n", optarg);
-        subject = optarg;
-        break;
+         Dmsg1(20, "subject=%s\n", optarg);
+         subject = optarg;
+         break;
 
       case 'r':                    /* reply address */
-        reply_addr = optarg;
-        break;
+         reply_addr = optarg;
+         break;
 
       case '?':
       default:
-        usage();
+         usage();
 
       }
    }
@@ -210,9 +213,9 @@ int main (int argc, char *argv[])
     */
    if (mailhost == NULL) {
       if ((cp = getenv("SMTPSERVER")) != NULL) {
-        mailhost = cp;
+         mailhost = cp;
       } else {
-        mailhost = "localhost";
+         mailhost = "localhost";
       }
    }
 
@@ -226,7 +229,7 @@ int main (int argc, char *argv[])
    }
    if ((hp = gethostbyname(my_hostname)) == NULL) {
       Pmsg2(0, "Fatal gethostbyname for myself failed \"%s\": ERR=%s\n", my_hostname,
-        strerror(errno));
+         strerror(errno));
       exit(1);
    }
    strcpy(my_hostname, hp->h_name);
@@ -237,9 +240,9 @@ int main (int argc, char *argv[])
     */
    if (from_addr == NULL) {
       if ((pwd = getpwuid(getuid())) == 0) {
-        sprintf(buf, "userid-%d@%s", (int)getuid(), my_hostname);
+         sprintf(buf, "userid-%d@%s", (int)getuid(), my_hostname);
       } else {
-        sprintf(buf, "%s@%s", pwd->pw_name, my_hostname);
+         sprintf(buf, "%s@%s", pwd->pw_name, my_hostname);
       }
       from_addr = bstrdup(buf);
    }
@@ -251,11 +254,11 @@ int main (int argc, char *argv[])
 hp:
    if ((hp = gethostbyname(mailhost)) == NULL) {
       Pmsg2(0, "Error unknown mail host \"%s\": ERR=%s\n", mailhost,
-        strerror(errno));
+         strerror(errno));
       if (strcasecmp(mailhost, "localhost") != 0) {
-        Pmsg0(0, "Retrying connection using \"localhost\".\n");
-        mailhost = "localhost";
-        goto hp;
+         Pmsg0(0, "Retrying connection using \"localhost\".\n");
+         mailhost = "localhost";
+         goto hp;
       }
       exit(1);
    }
@@ -350,9 +353,9 @@ hp:
    while (fgets(buf, sizeof(buf), stdin)) {
       buf[strlen(buf)-1] = 0;
       if (strcmp(buf, ".") == 0) { /* quote lone dots */
-        fprintf(sfp, "..\r\n");
-      } else {                    /* pass body through unchanged */
-        fprintf(sfp, "%s\r\n", buf);
+         fprintf(sfp, "..\r\n");
+      } else {                     /* pass body through unchanged */
+         fprintf(sfp, "%s\r\n", buf);
       }
    }
 
index b6a74617f67b60852866c03194362d3cc0e6b89b..9411818f387c77736df3c15ab11fb796fc5c6564 100644 (file)
 #include "cats/cats.h"
 #include "dird/dird_conf.h"
 
+/* Dummy functions */
+int generate_daemon_event(JCR *jcr, const char *event) 
+   { return 1; }
+
 typedef struct s_id_ctx {
-   uint32_t *Id;                     /* ids to be modified */
-   int num_ids;                      /* ids stored */
-   int max_ids;                      /* size of array */
-   int num_del;                      /* number deleted */
-   int tot_ids;                      /* total to process */
+   uint32_t *Id;                      /* ids to be modified */
+   int num_ids;                       /* ids stored */
+   int max_ids;                       /* size of array */
+   int num_del;                       /* number deleted */
+   int tot_ids;                       /* total to process */
 } ID_LIST;
 
 typedef struct s_name_ctx {
-   char **name;                      /* list of names */
-   int num_ids;                      /* ids stored */
-   int max_ids;                      /* size of array */
-   int num_del;                      /* number deleted */
-   int tot_ids;                      /* total to process */
+   char **name;                       /* list of names */
+   int num_ids;                       /* ids stored */
+   int max_ids;                       /* size of array */
+   int num_del;                       /* number deleted */
+   int tot_ids;                       /* total to process */
 } NAME_LIST;
 
 
@@ -106,7 +110,7 @@ int main (int argc, char *argv[])
    char *catalogname = NULL;
 
    my_name_is(argc, argv, "dbcheck");
-   init_msg(NULL, NULL);             /* setup message handler */
+   init_msg(NULL, NULL);              /* setup message handler */
 
    memset(&id_list, 0, sizeof(id_list));
    memset(&name_list, 0, sizeof(name_list));
@@ -115,34 +119,34 @@ int main (int argc, char *argv[])
    while ((ch = getopt(argc, argv, "bc:C:d:fv?")) != -1) {
       switch (ch) {
       case 'b':                    /* batch */
-        batch = true;
-        break;
+         batch = true;
+         break;
 
       case 'C':                    /* CatalogName */
-         catalogname = optarg;
-        break;
+          catalogname = optarg;
+         break;
 
       case 'c':                    /* configfile */
-         configfile = optarg;
-        break;
+          configfile = optarg;
+         break;
 
       case 'd':                    /* debug level */
-        debug_level = atoi(optarg);
-        if (debug_level <= 0)
-           debug_level = 1;
-        break;
+         debug_level = atoi(optarg);
+         if (debug_level <= 0)
+            debug_level = 1;
+         break;
 
       case 'f':                    /* fix inconsistencies */
-        fix = true;
-        break;
+         fix = true;
+         break;
 
       case 'v':
-        verbose++;
-        break;
+         verbose++;
+         break;
 
       case '?':
       default:
-        usage();
+         usage();
       }
    }
    argc -= optind;
@@ -152,54 +156,54 @@ int main (int argc, char *argv[])
       CAT *catalog = NULL;
       int found = 0;
       if (argc > 0) {
-        Pmsg0(0, _("Warning skipping the additional parameters for working directory/dbname/user/password/host.\n"));
+         Pmsg0(0, _("Warning skipping the additional parameters for working directory/dbname/user/password/host.\n"));
       }
       parse_config(configfile);
       LockRes();
       foreach_res(catalog, R_CATALOG) {
-        if (catalogname && !strcmp(catalog->hdr.name, catalogname)) {
-           ++found;
-           break;
-        } else if (!catalogname) { // stop on first if no catalogname is given
-          ++found;
-          break;
-        }
+         if (catalogname && !strcmp(catalog->hdr.name, catalogname)) {
+            ++found;
+            break;
+         } else if (!catalogname) { // stop on first if no catalogname is given
+           ++found;
+           break;
+         }
       }
       UnlockRes();
       if (!found) {
-        if (catalogname) {
-           Pmsg2(0, "Error can not find the Catalog name[%s] in the given config file [%s]\n", catalogname, configfile);
-        } else {
-           Pmsg1(0, "Error there is no Catalog section in the given config file [%s]\n", configfile);
-        }
-        exit(1);
+         if (catalogname) {
+            Pmsg2(0, "Error can not find the Catalog name[%s] in the given config file [%s]\n", catalogname, configfile);
+         } else {
+            Pmsg1(0, "Error there is no Catalog section in the given config file [%s]\n", configfile);
+         }
+         exit(1);
       } else {
-        DIRRES *director;
-        LockRes();
-        director = (DIRRES *)GetNextRes(R_DIRECTOR, NULL);
-        UnlockRes();
-        if (!director) {
-           Pmsg0(0, "Error no Director resource defined.\n");
-           exit(1);
-        }
-        set_working_directory(director->working_directory);
-        db_name = catalog->db_name;
-        user = catalog->db_user;
-        password = catalog->db_password;
-        dbhost = catalog->db_address;
-        if (dbhost && dbhost[0] == 0) {
-           dbhost = NULL;
-        }
+         DIRRES *director;
+         LockRes();
+         director = (DIRRES *)GetNextRes(R_DIRECTOR, NULL);
+         UnlockRes();
+         if (!director) {
+            Pmsg0(0, "Error no Director resource defined.\n");
+            exit(1);
+         }
+         set_working_directory(director->working_directory);
+         db_name = catalog->db_name;
+         user = catalog->db_user;
+         password = catalog->db_password;
+         dbhost = catalog->db_address;
+         if (dbhost && dbhost[0] == 0) {
+            dbhost = NULL;
+         }
       }
    } else {
       if (argc > 5) {
-        Pmsg0(0, _("Wrong number of arguments.\n"));
-        usage();
+         Pmsg0(0, _("Wrong number of arguments.\n"));
+         usage();
       }
 
       if (argc < 1) {
-        Pmsg0(0, _("Working directory not supplied.\n"));
-        usage();
+         Pmsg0(0, _("Working directory not supplied.\n"));
+         usage();
       }
 
       /* This is needed by SQLite to find the db */
@@ -210,20 +214,20 @@ int main (int argc, char *argv[])
       dbhost = NULL;
 
       if (argc == 2) {
-        db_name = argv[1];
-        user = db_name;
+         db_name = argv[1];
+         user = db_name;
       } else if (argc == 3) {
-        db_name = argv[1];
-        user = argv[2];
+         db_name = argv[1];
+         user = argv[2];
       } else if (argc == 4) {
-        db_name = argv[1];
-        user = argv[2];
-        password = argv[3];
+         db_name = argv[1];
+         user = argv[2];
+         password = argv[3];
       } else if (argc == 5) {
-        db_name = argv[1];
-        user = argv[2];
-        password = argv[3];
-        dbhost = argv[4];
+         db_name = argv[1];
+         user = argv[2];
+         password = argv[3];
+         dbhost = argv[4];
       }
    }
 
@@ -231,7 +235,7 @@ int main (int argc, char *argv[])
    db = db_init_database(NULL, db_name, user, password, dbhost, 0, NULL, 0);
    if (!db_open_database(NULL, db)) {
       Emsg1(M_FATAL, 0, "%s", db_strerror(db));
-         return 1;
+          return 1;
    }
 
    if (batch) {
@@ -266,11 +270,11 @@ static void do_interactive_mode()
    printf("Hello, this is the database check/correct program.\n"
 "Modify database is %s. Verbose is %s.\n"
 "Please select the fuction you want to perform.\n",
-         fix?"On":"Off", verbose?"On":"Off");
+          fix?"On":"Off", verbose?"On":"Off");
 
    while (!quit) {
       if (fix) {
-        printf(_("\n"
+         printf(_("\n"
 "     1) Toggle modify database flag\n"
 "     2) Toggle verbose flag\n"
 "     3) Repair bad Filename records\n"
@@ -289,7 +293,7 @@ static void do_interactive_mode()
 "    16) All (3-15)\n"
 "    17) Quit\n"));
        } else {
-        printf(_("\n"
+         printf(_("\n"
 "     1) Toggle modify database flag\n"
 "     2) Toggle verbose flag\n"
 "     3) Check for bad Filename records\n"
@@ -311,74 +315,74 @@ static void do_interactive_mode()
 
       cmd = get_cmd(_("Select function number: "));
       if (cmd) {
-        int item = atoi(cmd);
-        switch (item) {
-        case 1:
-           fix = !fix;
-           printf(_("Database will %sbe modified.\n"), fix?"":_("NOT "));
-           break;
-        case 2:
-           verbose = verbose?0:1;
-           printf(_("Verbose is %s\n"), verbose?_("On"):_("Off"));
-           break;
-        case 3:
-           repair_bad_filenames();
-           break;
-        case 4:
-           repair_bad_paths();
-           break;
-        case 5:
-           eliminate_duplicate_filenames();
-           break;
-        case 6:
-           eliminate_duplicate_paths();
-           break;
-        case 7:
-           eliminate_orphaned_jobmedia_records();
-           break;
-        case 8:
-           eliminate_orphaned_file_records();
-           break;
-        case 9:
-           eliminate_orphaned_path_records();
-           break;
-        case 10:
-           eliminate_orphaned_filename_records();
-           break;
-        case 11:
-           eliminate_orphaned_fileset_records();
-           break;
-        case 12:
-           eliminate_orphaned_client_records();
-           break;
-        case 13:
-           eliminate_orphaned_job_records();
-           break;
-        case 14:
-           eliminate_admin_records();
-           break;
-        case 15:
-           eliminate_restore_records();
-           break;
-        case 16:
-           repair_bad_filenames();
-           repair_bad_paths();
-           eliminate_duplicate_filenames();
-           eliminate_duplicate_paths();
-           eliminate_orphaned_jobmedia_records();
-           eliminate_orphaned_file_records();
-           eliminate_orphaned_path_records();
-           eliminate_orphaned_filename_records();
-           eliminate_orphaned_fileset_records();
-           eliminate_orphaned_client_records();
-           eliminate_orphaned_job_records();
-           eliminate_admin_records();
-           eliminate_restore_records();
-           break;
-        case 17:
-           quit = true;
-           break;
-        }
+         int item = atoi(cmd);
+         switch (item) {
+         case 1:
+            fix = !fix;
+            printf(_("Database will %sbe modified.\n"), fix?"":_("NOT "));
+            break;
+         case 2:
+            verbose = verbose?0:1;
+            printf(_("Verbose is %s\n"), verbose?_("On"):_("Off"));
+            break;
+         case 3:
+            repair_bad_filenames();
+            break;
+         case 4:
+            repair_bad_paths();
+            break;
+         case 5:
+            eliminate_duplicate_filenames();
+            break;
+         case 6:
+            eliminate_duplicate_paths();
+            break;
+         case 7:
+            eliminate_orphaned_jobmedia_records();
+            break;
+         case 8:
+            eliminate_orphaned_file_records();
+            break;
+         case 9:
+            eliminate_orphaned_path_records();
+            break;
+         case 10:
+            eliminate_orphaned_filename_records();
+            break;
+         case 11:
+            eliminate_orphaned_fileset_records();
+            break;
+         case 12:
+            eliminate_orphaned_client_records();
+            break;
+         case 13:
+            eliminate_orphaned_job_records();
+            break;
+         case 14:
+            eliminate_admin_records();
+            break;
+         case 15:
+            eliminate_restore_records();
+            break;
+         case 16:
+            repair_bad_filenames();
+            repair_bad_paths();
+            eliminate_duplicate_filenames();
+            eliminate_duplicate_paths();
+            eliminate_orphaned_jobmedia_records();
+            eliminate_orphaned_file_records();
+            eliminate_orphaned_path_records();
+            eliminate_orphaned_filename_records();
+            eliminate_orphaned_fileset_records();
+            eliminate_orphaned_client_records();
+            eliminate_orphaned_job_records();
+            eliminate_admin_records();
+            eliminate_restore_records();
+            break;
+         case 17:
+            quit = true;
+            break;
+         }
       }
    }
 }
@@ -403,7 +407,7 @@ static int get_name_handler(void *ctx, int num_fields, char **row)
 static int print_job_handler(void *ctx, int num_fields, char **row)
 {
    printf(_("JobId=%s Name=\"%s\" StartTime=%s\n"),
-             NPRT(row[0]), NPRT(row[1]), NPRT(row[2]));
+              NPRT(row[0]), NPRT(row[1]), NPRT(row[2]));
    return 0;
 }
 
@@ -411,28 +415,28 @@ static int print_job_handler(void *ctx, int num_fields, char **row)
 static int print_jobmedia_handler(void *ctx, int num_fields, char **row)
 {
    printf(_("Orphaned JobMediaId=%s JobId=%s Volume=\"%s\"\n"),
-             NPRT(row[0]), NPRT(row[1]), NPRT(row[2]));
+              NPRT(row[0]), NPRT(row[1]), NPRT(row[2]));
    return 0;
 }
 
 static int print_file_handler(void *ctx, int num_fields, char **row)
 {
    printf(_("Orphaned FileId=%s JobId=%s Volume=\"%s\"\n"),
-             NPRT(row[0]), NPRT(row[1]), NPRT(row[2]));
+              NPRT(row[0]), NPRT(row[1]), NPRT(row[2]));
    return 0;
 }
 
 static int print_fileset_handler(void *ctx, int num_fields, char **row)
 {
    printf(_("Orphaned FileSetId=%s FileSet=\"%s\" MD5=%s\n"),
-             NPRT(row[0]), NPRT(row[1]), NPRT(row[2]));
+              NPRT(row[0]), NPRT(row[1]), NPRT(row[2]));
    return 0;
 }
 
 static int print_client_handler(void *ctx, int num_fields, char **row)
 {
    printf(_("Orphaned ClientId=%s Name=\"%s\"\n"),
-             NPRT(row[0]), NPRT(row[1]));
+              NPRT(row[0]), NPRT(row[1]));
    return 0;
 }
 
@@ -449,11 +453,11 @@ static int id_list_handler(void *ctx, int num_fields, char **row)
    }
    if (lst->num_ids == lst->max_ids) {
       if (lst->max_ids == 0) {
-        lst->max_ids = 1000;
-        lst->Id = (uint32_t *)bmalloc(sizeof(uint32_t) * lst->max_ids);
+         lst->max_ids = 1000;
+         lst->Id = (uint32_t *)bmalloc(sizeof(uint32_t) * lst->max_ids);
       } else {
-        lst->max_ids = (lst->max_ids * 3) / 2;
-        lst->Id = (uint32_t *)brealloc(lst->Id, sizeof(uint32_t) * lst->max_ids);
+         lst->max_ids = (lst->max_ids * 3) / 2;
+         lst->Id = (uint32_t *)brealloc(lst->Id, sizeof(uint32_t) * lst->max_ids);
       }
    }
    lst->Id[lst->num_ids++] = (uint32_t)strtod(row[0], NULL);
@@ -484,7 +488,7 @@ static int delete_id_list(const char *query, ID_LIST *id_list)
    for (int i=0; i < id_list->num_ids; i++) {
       bsnprintf(buf, sizeof(buf), query, id_list->Id[i]);
       if (verbose) {
-        printf("Deleting: %s\n", buf);
+         printf("Deleting: %s\n", buf);
       }
       db_sql_query(db, buf, NULL, NULL);
    }
@@ -503,11 +507,11 @@ static int name_list_handler(void *ctx, int num_fields, char **row)
    }
    if (name->num_ids == name->max_ids) {
       if (name->max_ids == 0) {
-        name->max_ids = 1000;
-        name->name = (char **)bmalloc(sizeof(char *) * name->max_ids);
+         name->max_ids = 1000;
+         name->name = (char **)bmalloc(sizeof(char *) * name->max_ids);
       } else {
-        name->max_ids = (name->max_ids * 3) / 2;
-        name->name = (char **)brealloc(name->name, sizeof(char *) * name->max_ids);
+         name->max_ids = (name->max_ids * 3) / 2;
+         name->name = (char **)brealloc(name->name, sizeof(char *) * name->max_ids);
       }
    }
    name->name[name->num_ids++] = bstrdup(row[0]);
@@ -562,7 +566,7 @@ static void eliminate_duplicate_filenames()
 
    /* Make list of duplicated names */
    query = "SELECT Name, count(Name) as Count FROM Filename GROUP BY  Name "
-          "HAVING count(Name) > 1";
+           "HAVING count(Name) > 1";
 
    if (!make_name_list(query, &name_list)) {
       exit(1);
@@ -574,33 +578,33 @@ static void eliminate_duplicate_filenames()
    if (fix) {
       /* Loop through list of duplicate names */
       for (int i=0; i<name_list.num_ids; i++) {
-        /* Get all the Ids of each name */
-        db_escape_string(esc_name, name_list.name[i], strlen(name_list.name[i]));
-        bsnprintf(buf, sizeof(buf), "SELECT FilenameId FROM Filename WHERE Name='%s'", esc_name);
-        if (verbose > 1) {
-           printf("%s\n", buf);
-        }
-        if (!make_id_list(buf, &id_list)) {
-           exit(1);
-        }
-        if (verbose) {
-           printf("Found %d for: %s\n", id_list.num_ids, name_list.name[i]);
-        }
-        /* Force all records to use the first id then delete the other ids */
-        for (int j=1; j<id_list.num_ids; j++) {
-           bsnprintf(buf, sizeof(buf), "UPDATE File SET FilenameId=%u WHERE FilenameId=%u",
-              id_list.Id[0], id_list.Id[j]);
-           if (verbose > 1) {
-              printf("%s\n", buf);
-           }
-           db_sql_query(db, buf, NULL, NULL);
-           bsnprintf(buf, sizeof(buf), "DELETE FROM Filename WHERE FilenameId=%u",
-              id_list.Id[j]);
-           if (verbose > 2) {
-              printf("%s\n", buf);
-           }
-           db_sql_query(db, buf, NULL, NULL);
-        }
+         /* Get all the Ids of each name */
+         db_escape_string(esc_name, name_list.name[i], strlen(name_list.name[i]));
+         bsnprintf(buf, sizeof(buf), "SELECT FilenameId FROM Filename WHERE Name='%s'", esc_name);
+         if (verbose > 1) {
+            printf("%s\n", buf);
+         }
+         if (!make_id_list(buf, &id_list)) {
+            exit(1);
+         }
+         if (verbose) {
+            printf("Found %d for: %s\n", id_list.num_ids, name_list.name[i]);
+         }
+         /* Force all records to use the first id then delete the other ids */
+         for (int j=1; j<id_list.num_ids; j++) {
+            bsnprintf(buf, sizeof(buf), "UPDATE File SET FilenameId=%u WHERE FilenameId=%u",
+               id_list.Id[0], id_list.Id[j]);
+            if (verbose > 1) {
+               printf("%s\n", buf);
+            }
+            db_sql_query(db, buf, NULL, NULL);
+            bsnprintf(buf, sizeof(buf), "DELETE FROM Filename WHERE FilenameId=%u",
+               id_list.Id[j]);
+            if (verbose > 2) {
+               printf("%s\n", buf);
+            }
+            db_sql_query(db, buf, NULL, NULL);
+         }
       }
    }
    free_name_list(&name_list);
@@ -616,7 +620,7 @@ static void eliminate_duplicate_paths()
    /* Make list of duplicated names */
 
    query = "SELECT Path, count(Path) as Count FROM Path "
-          "GROUP BY Path HAVING count(Path) > 1";
+           "GROUP BY Path HAVING count(Path) > 1";
 
    if (!make_name_list(query, &name_list)) {
       exit(1);
@@ -628,33 +632,33 @@ static void eliminate_duplicate_paths()
    if (fix) {
       /* Loop through list of duplicate names */
       for (int i=0; i<name_list.num_ids; i++) {
-        /* Get all the Ids of each name */
-        db_escape_string(esc_name, name_list.name[i], strlen(name_list.name[i]));
-        bsnprintf(buf, sizeof(buf), "SELECT PathId FROM Path WHERE Path='%s'", esc_name);
-        if (verbose > 1) {
-           printf("%s\n", buf);
-        }
-        if (!make_id_list(buf, &id_list)) {
-           exit(1);
-        }
-        if (verbose) {
-           printf("Found %d for: %s\n", id_list.num_ids, name_list.name[i]);
-        }
-        /* Force all records to use the first id then delete the other ids */
-        for (int j=1; j<id_list.num_ids; j++) {
-           bsnprintf(buf, sizeof(buf), "UPDATE File SET PathId=%u WHERE PathId=%u",
-              id_list.Id[0], id_list.Id[j]);
-           if (verbose > 1) {
-              printf("%s\n", buf);
-           }
-           db_sql_query(db, buf, NULL, NULL);
-           bsnprintf(buf, sizeof(buf), "DELETE FROM Path WHERE PathId=%u",
-              id_list.Id[j]);
-           if (verbose > 2) {
-              printf("%s\n", buf);
-           }
-           db_sql_query(db, buf, NULL, NULL);
-        }
+         /* Get all the Ids of each name */
+         db_escape_string(esc_name, name_list.name[i], strlen(name_list.name[i]));
+         bsnprintf(buf, sizeof(buf), "SELECT PathId FROM Path WHERE Path='%s'", esc_name);
+         if (verbose > 1) {
+            printf("%s\n", buf);
+         }
+         if (!make_id_list(buf, &id_list)) {
+            exit(1);
+         }
+         if (verbose) {
+            printf("Found %d for: %s\n", id_list.num_ids, name_list.name[i]);
+         }
+         /* Force all records to use the first id then delete the other ids */
+         for (int j=1; j<id_list.num_ids; j++) {
+            bsnprintf(buf, sizeof(buf), "UPDATE File SET PathId=%u WHERE PathId=%u",
+               id_list.Id[0], id_list.Id[j]);
+            if (verbose > 1) {
+               printf("%s\n", buf);
+            }
+            db_sql_query(db, buf, NULL, NULL);
+            bsnprintf(buf, sizeof(buf), "DELETE FROM Path WHERE PathId=%u",
+               id_list.Id[j]);
+            if (verbose > 2) {
+               printf("%s\n", buf);
+            }
+            db_sql_query(db, buf, NULL, NULL);
+         }
       }
    }
    free_name_list(&name_list);
@@ -666,20 +670,20 @@ static void eliminate_orphaned_jobmedia_records()
 
    printf("Checking for orphaned JobMedia entries.\n");
    query = "SELECT JobMedia.JobMediaId,Job.JobId FROM JobMedia "
-          "LEFT OUTER JOIN Job ON (JobMedia.JobId=Job.JobId) "
-          "WHERE Job.JobId IS NULL";
+           "LEFT OUTER JOIN Job ON (JobMedia.JobId=Job.JobId) "
+           "WHERE Job.JobId IS NULL";
    if (!make_id_list(query, &id_list)) {
       exit(1);
    }
    printf("Found %d orphaned JobMedia records.\n", id_list.num_ids);
    if (id_list.num_ids && verbose && yes_no("Print them? (yes/no): ")) {
       for (int i=0; i < id_list.num_ids; i++) {
-        bsnprintf(buf, sizeof(buf),
+         bsnprintf(buf, sizeof(buf),
 "SELECT JobMedia.JobMediaId,JobMedia.JobId,Media.VolumeName FROM JobMedia,Media "
 "WHERE JobMedia.JobMediaId=%u AND Media.MediaId=JobMedia.MediaId", id_list.Id[i]);
-        if (!db_sql_query(db, buf, print_jobmedia_handler, NULL)) {
-           printf("%s\n", db_strerror(db));
-        }
+         if (!db_sql_query(db, buf, print_jobmedia_handler, NULL)) {
+            printf("%s\n", db_strerror(db));
+         }
       }
    }
 
@@ -695,8 +699,8 @@ static void eliminate_orphaned_file_records()
 
    printf("Checking for orphaned File entries. This may take some time!\n");
    query = "SELECT File.FileId,Job.JobId FROM File "
-          "LEFT OUTER JOIN Job ON (File.JobId=Job.JobId) "
-          "WHERE Job.JobId IS NULL";
+           "LEFT OUTER JOIN Job ON (File.JobId=Job.JobId) "
+           "WHERE Job.JobId IS NULL";
    if (verbose > 1) {
       printf("%s\n", query);
    }
@@ -706,12 +710,12 @@ static void eliminate_orphaned_file_records()
    printf("Found %d orphaned File records.\n", id_list.num_ids);
    if (name_list.num_ids && verbose && yes_no("Print them? (yes/no): ")) {
       for (int i=0; i < id_list.num_ids; i++) {
-        bsnprintf(buf, sizeof(buf),
+         bsnprintf(buf, sizeof(buf),
 "SELECT File.FileId,File.JobId,Filename.Name FROM File,Filename "
 "WHERE File.FileId=%u AND File.FilenameId=Filename.FilenameId", id_list.Id[i]);
-        if (!db_sql_query(db, buf, print_file_handler, NULL)) {
-           printf("%s\n", db_strerror(db));
-        }
+         if (!db_sql_query(db, buf, print_file_handler, NULL)) {
+            printf("%s\n", db_strerror(db));
+         }
       }
    }
 
@@ -727,8 +731,8 @@ static void eliminate_orphaned_path_records()
 
    printf("Checking for orphaned Path entries. This may take some time!\n");
    query = "SELECT DISTINCT Path.PathId,File.PathId FROM Path "
-          "LEFT OUTER JOIN File ON (Path.PathId=File.PathId) "
-          "WHERE File.PathId IS NULL";
+           "LEFT OUTER JOIN File ON (Path.PathId=File.PathId) "
+           "WHERE File.PathId IS NULL";
    if (verbose > 1) {
       printf("%s\n", query);
    }
@@ -738,8 +742,8 @@ static void eliminate_orphaned_path_records()
    printf("Found %d orphaned Path records.\n", id_list.num_ids);
    if (id_list.num_ids && verbose && yes_no("Print them? (yes/no): ")) {
       for (int i=0; i < id_list.num_ids; i++) {
-        bsnprintf(buf, sizeof(buf), "SELECT Path FROM Path WHERE PathId=%u", id_list.Id[i]);
-        db_sql_query(db, buf, print_name_handler, NULL);
+         bsnprintf(buf, sizeof(buf), "SELECT Path FROM Path WHERE PathId=%u", id_list.Id[i]);
+         db_sql_query(db, buf, print_name_handler, NULL);
       }
    }
 
@@ -755,8 +759,8 @@ static void eliminate_orphaned_filename_records()
 
    printf("Checking for orphaned Filename entries. This may take some time!\n");
    query = "SELECT Filename.FilenameId,File.FilenameId FROM Filename "
-          "LEFT OUTER JOIN File ON (Filename.FilenameId=File.FilenameId) "
-          "WHERE File.FilenameId IS NULL";
+           "LEFT OUTER JOIN File ON (Filename.FilenameId=File.FilenameId) "
+           "WHERE File.FilenameId IS NULL";
    if (verbose > 1) {
       printf("%s\n", query);
    }
@@ -766,8 +770,8 @@ static void eliminate_orphaned_filename_records()
    printf("Found %d orphaned Filename records.\n", id_list.num_ids);
    if (id_list.num_ids && verbose && yes_no("Print them? (yes/no): ")) {
       for (int i=0; i < id_list.num_ids; i++) {
-        bsnprintf(buf, sizeof(buf), "SELECT Name FROM Filename WHERE FilenameId=%u", id_list.Id[i]);
-        db_sql_query(db, buf, print_name_handler, NULL);
+         bsnprintf(buf, sizeof(buf), "SELECT Name FROM Filename WHERE FilenameId=%u", id_list.Id[i]);
+         db_sql_query(db, buf, print_name_handler, NULL);
       }
    }
 
@@ -783,8 +787,8 @@ static void eliminate_orphaned_fileset_records()
 
    printf("Checking for orphaned FileSet entries. This takes some time!\n");
    query = "SELECT FileSet.FileSetId,Job.FileSetId FROM FileSet "
-          "LEFT OUTER JOIN Job ON (FileSet.FileSetId=Job.FileSetId) "
-          "WHERE Job.FileSetId IS NULL";
+           "LEFT OUTER JOIN Job ON (FileSet.FileSetId=Job.FileSetId) "
+           "WHERE Job.FileSetId IS NULL";
    if (verbose > 1) {
       printf("%s\n", query);
    }
@@ -794,11 +798,11 @@ static void eliminate_orphaned_fileset_records()
    printf("Found %d orphaned FileSet records.\n", id_list.num_ids);
    if (id_list.num_ids && verbose && yes_no("Print them? (yes/no): ")) {
       for (int i=0; i < id_list.num_ids; i++) {
-        bsnprintf(buf, sizeof(buf), "SELECT FileSetId,FileSet,MD5 FROM FileSet "
-                     "WHERE FileSetId=%u", id_list.Id[i]);
-        if (!db_sql_query(db, buf, print_fileset_handler, NULL)) {
-           printf("%s\n", db_strerror(db));
-        }
+         bsnprintf(buf, sizeof(buf), "SELECT FileSetId,FileSet,MD5 FROM FileSet "
+                      "WHERE FileSetId=%u", id_list.Id[i]);
+         if (!db_sql_query(db, buf, print_fileset_handler, NULL)) {
+            printf("%s\n", db_strerror(db));
+         }
       }
    }
 
@@ -814,15 +818,15 @@ static void eliminate_orphaned_client_records()
 
    printf("Checking for orphaned Client entries.\n");
    /* In English:
-    *  Wiffle through Client for every Client
-    *  joining with the Job table including every Client even if
-    *  there is not a match in Job (left outer join), then
-    *  filter out only those where no Job points to a Client
-    *  i.e. Job.Client is NULL
+    *   Wiffle through Client for every Client
+    *   joining with the Job table including every Client even if
+    *   there is not a match in Job (left outer join), then
+    *   filter out only those where no Job points to a Client
+    *   i.e. Job.Client is NULL
     */
    query = "SELECT Client.ClientId,Client.Name FROM Client "
-          "LEFT OUTER JOIN Job ON (Client.ClientId=Job.ClientId) "
-          "WHERE Job.ClientId IS NULL";
+           "LEFT OUTER JOIN Job ON (Client.ClientId=Job.ClientId) "
+           "WHERE Job.ClientId IS NULL";
    if (verbose > 1) {
       printf("%s\n", query);
    }
@@ -832,11 +836,11 @@ static void eliminate_orphaned_client_records()
    printf("Found %d orphaned Client records.\n", id_list.num_ids);
    if (id_list.num_ids && verbose && yes_no("Print them? (yes/no): ")) {
       for (int i=0; i < id_list.num_ids; i++) {
-        bsnprintf(buf, sizeof(buf), "SELECT ClientId,Name FROM Client "
-                     "WHERE ClientId=%u", id_list.Id[i]);
-        if (!db_sql_query(db, buf, print_client_handler, NULL)) {
-           printf("%s\n", db_strerror(db));
-        }
+         bsnprintf(buf, sizeof(buf), "SELECT ClientId,Name FROM Client "
+                      "WHERE ClientId=%u", id_list.Id[i]);
+         if (!db_sql_query(db, buf, print_client_handler, NULL)) {
+            printf("%s\n", db_strerror(db));
+         }
       }
    }
 
@@ -852,15 +856,15 @@ static void eliminate_orphaned_job_records()
 
    printf("Checking for orphaned Job entries.\n");
    /* In English:
-    *  Wiffle through Job for every Job
-    *  joining with the Client table including every Job even if
-    *  there is not a match in Client (left outer join), then
-    *  filter out only those where no Client exists
-    *  i.e. Client.Name is NULL
+    *   Wiffle through Job for every Job
+    *   joining with the Client table including every Job even if
+    *   there is not a match in Client (left outer join), then
+    *   filter out only those where no Client exists
+    *   i.e. Client.Name is NULL
     */
    query = "SELECT Job.JobId,Job.Name FROM Job "
-          "LEFT OUTER JOIN Client ON (Job.ClientId=Client.ClientId) "
-          "WHERE Client.Name IS NULL";
+           "LEFT OUTER JOIN Client ON (Job.ClientId=Client.ClientId) "
+           "WHERE Client.Name IS NULL";
    if (verbose > 1) {
       printf("%s\n", query);
    }
@@ -870,11 +874,11 @@ static void eliminate_orphaned_job_records()
    printf("Found %d orphaned Job records.\n", id_list.num_ids);
    if (id_list.num_ids && verbose && yes_no("Print them? (yes/no): ")) {
       for (int i=0; i < id_list.num_ids; i++) {
-        bsnprintf(buf, sizeof(buf), "SELECT JobId,Name,StartTime FROM Job "
-                     "WHERE JobId=%u", id_list.Id[i]);
-        if (!db_sql_query(db, buf, print_job_handler, NULL)) {
-           printf("%s\n", db_strerror(db));
-        }
+         bsnprintf(buf, sizeof(buf), "SELECT JobId,Name,StartTime FROM Job "
+                      "WHERE JobId=%u", id_list.Id[i]);
+         if (!db_sql_query(db, buf, print_job_handler, NULL)) {
+            printf("%s\n", db_strerror(db));
+         }
       }
    }
 
@@ -891,7 +895,7 @@ static void eliminate_admin_records()
 
    printf("Checking for Admin Job entries.\n");
    query = "SELECT Job.JobId FROM Job "
-          "WHERE Job.Type='D'";
+           "WHERE Job.Type='D'";
    if (verbose > 1) {
       printf("%s\n", query);
    }
@@ -901,11 +905,11 @@ static void eliminate_admin_records()
    printf("Found %d Admin Job records.\n", id_list.num_ids);
    if (id_list.num_ids && verbose && yes_no("Print them? (yes/no): ")) {
       for (int i=0; i < id_list.num_ids; i++) {
-        bsnprintf(buf, sizeof(buf), "SELECT JobId,Name,StartTime FROM Job "
-                     "WHERE JobId=%u", id_list.Id[i]);
-        if (!db_sql_query(db, buf, print_job_handler, NULL)) {
-           printf("%s\n", db_strerror(db));
-        }
+         bsnprintf(buf, sizeof(buf), "SELECT JobId,Name,StartTime FROM Job "
+                      "WHERE JobId=%u", id_list.Id[i]);
+         if (!db_sql_query(db, buf, print_job_handler, NULL)) {
+            printf("%s\n", db_strerror(db));
+         }
       }
    }
 
@@ -921,7 +925,7 @@ static void eliminate_restore_records()
 
    printf("Checking for Restore Job entries.\n");
    query = "SELECT Job.JobId FROM Job "
-          "WHERE Job.Type='R'";
+           "WHERE Job.Type='R'";
    if (verbose > 1) {
       printf("%s\n", query);
    }
@@ -931,11 +935,11 @@ static void eliminate_restore_records()
    printf("Found %d Restore Job records.\n", id_list.num_ids);
    if (id_list.num_ids && verbose && yes_no("Print them? (yes/no): ")) {
       for (int i=0; i < id_list.num_ids; i++) {
-        bsnprintf(buf, sizeof(buf), "SELECT JobId,Name,StartTime FROM Job "
-                     "WHERE JobId=%u", id_list.Id[i]);
-        if (!db_sql_query(db, buf, print_job_handler, NULL)) {
-           printf("%s\n", db_strerror(db));
-        }
+         bsnprintf(buf, sizeof(buf), "SELECT JobId,Name,StartTime FROM Job "
+                      "WHERE JobId=%u", id_list.Id[i]);
+         if (!db_sql_query(db, buf, print_job_handler, NULL)) {
+            printf("%s\n", db_strerror(db));
+         }
       }
    }
 
@@ -955,7 +959,7 @@ static void repair_bad_filenames()
 
    printf("Checking for Filenames with a trailing slash\n");
    query = "SELECT FilenameId,Name from Filename "
-          "WHERE Name LIKE '%/'";
+           "WHERE Name LIKE '%/'";
    if (verbose > 1) {
       printf("%s\n", query);
    }
@@ -965,11 +969,11 @@ static void repair_bad_filenames()
    printf("Found %d bad Filename records.\n", id_list.num_ids);
    if (id_list.num_ids && verbose && yes_no("Print them? (yes/no): ")) {
       for (i=0; i < id_list.num_ids; i++) {
-        bsnprintf(buf, sizeof(buf),
-           "SELECT Name FROM Filename WHERE FilenameId=%u", id_list.Id[i]);
-        if (!db_sql_query(db, buf, print_name_handler, NULL)) {
-           printf("%s\n", db_strerror(db));
-        }
+         bsnprintf(buf, sizeof(buf),
+            "SELECT Name FROM Filename WHERE FilenameId=%u", id_list.Id[i]);
+         if (!db_sql_query(db, buf, print_name_handler, NULL)) {
+            printf("%s\n", db_strerror(db));
+         }
       }
    }
 
@@ -978,30 +982,30 @@ static void repair_bad_filenames()
       char esc_name[5000];
       printf("Reparing %d bad Filename records.\n", id_list.num_ids);
       for (i=0; i < id_list.num_ids; i++) {
-        int len;
-        bsnprintf(buf, sizeof(buf),
-           "SELECT Name FROM Filename WHERE FilenameId=%u", id_list.Id[i]);
-        if (!db_sql_query(db, buf, get_name_handler, name)) {
-           printf("%s\n", db_strerror(db));
-        }
-        /* Strip trailing slash(es) */
-        for (len=strlen(name); len > 0 && name[len-1]=='/'; len--)
-           {  }
-        if (len == 0) {
-           len = 1;
-           esc_name[0] = ' ';
-           esc_name[1] = 0;
-        } else {
-           name[len-1] = 0;
-           db_escape_string(esc_name, name, len);
-        }
-        bsnprintf(buf, sizeof(buf),
-           "UPDATE Filename SET Name='%s' WHERE FilenameId=%u",
-           esc_name, id_list.Id[i]);
-        if (verbose > 1) {
-           printf("%s\n", buf);
-        }
-        db_sql_query(db, buf, NULL, NULL);
+         int len;
+         bsnprintf(buf, sizeof(buf),
+            "SELECT Name FROM Filename WHERE FilenameId=%u", id_list.Id[i]);
+         if (!db_sql_query(db, buf, get_name_handler, name)) {
+            printf("%s\n", db_strerror(db));
+         }
+         /* Strip trailing slash(es) */
+         for (len=strlen(name); len > 0 && name[len-1]=='/'; len--)
+            {  }
+         if (len == 0) {
+            len = 1;
+            esc_name[0] = ' ';
+            esc_name[1] = 0;
+         } else {
+            name[len-1] = 0;
+            db_escape_string(esc_name, name, len);
+         }
+         bsnprintf(buf, sizeof(buf),
+            "UPDATE Filename SET Name='%s' WHERE FilenameId=%u",
+            esc_name, id_list.Id[i]);
+         if (verbose > 1) {
+            printf("%s\n", buf);
+         }
+         db_sql_query(db, buf, NULL, NULL);
       }
    }
 }
@@ -1013,7 +1017,7 @@ static void repair_bad_paths()
 
    printf("Checking for Paths without a trailing slash\n");
    query = "SELECT PathId,Path from Path "
-          "WHERE Path NOT LIKE '%/'";
+           "WHERE Path NOT LIKE '%/'";
    if (verbose > 1) {
       printf("%s\n", query);
    }
@@ -1023,11 +1027,11 @@ static void repair_bad_paths()
    printf("Found %d bad Path records.\n", id_list.num_ids);
    if (id_list.num_ids && verbose && yes_no("Print them? (yes/no): ")) {
       for (i=0; i < id_list.num_ids; i++) {
-        bsnprintf(buf, sizeof(buf),
-           "SELECT Path FROM Path WHERE PathId=%u", id_list.Id[i]);
-        if (!db_sql_query(db, buf, print_name_handler, NULL)) {
-           printf("%s\n", db_strerror(db));
-        }
+         bsnprintf(buf, sizeof(buf),
+            "SELECT Path FROM Path WHERE PathId=%u", id_list.Id[i]);
+         if (!db_sql_query(db, buf, print_name_handler, NULL)) {
+            printf("%s\n", db_strerror(db));
+         }
       }
    }
 
@@ -1036,25 +1040,25 @@ static void repair_bad_paths()
       char esc_name[5000];
       printf("Reparing %d bad Filename records.\n", id_list.num_ids);
       for (i=0; i < id_list.num_ids; i++) {
-        int len;
-        bsnprintf(buf, sizeof(buf),
-           "SELECT Path FROM Path WHERE PathId=%u", id_list.Id[i]);
-        if (!db_sql_query(db, buf, get_name_handler, name)) {
-           printf("%s\n", db_strerror(db));
-        }
-        /* Strip trailing blanks */
-        for (len=strlen(name); len > 0 && name[len-1]==' '; len--) {
-           name[len-1] = 0;
-        }
-        /* Add trailing slash */
-        len = pm_strcat(&name, "/");
-        db_escape_string(esc_name, name, len);
-        bsnprintf(buf, sizeof(buf), "UPDATE Path SET Path='%s' WHERE PathId=%u",
-           esc_name, id_list.Id[i]);
-        if (verbose > 1) {
-           printf("%s\n", buf);
-        }
-        db_sql_query(db, buf, NULL, NULL);
+         int len;
+         bsnprintf(buf, sizeof(buf),
+            "SELECT Path FROM Path WHERE PathId=%u", id_list.Id[i]);
+         if (!db_sql_query(db, buf, get_name_handler, name)) {
+            printf("%s\n", db_strerror(db));
+         }
+         /* Strip trailing blanks */
+         for (len=strlen(name); len > 0 && name[len-1]==' '; len--) {
+            name[len-1] = 0;
+         }
+         /* Add trailing slash */
+         len = pm_strcat(&name, "/");
+         db_escape_string(esc_name, name, len);
+         bsnprintf(buf, sizeof(buf), "UPDATE Path SET Path='%s' WHERE PathId=%u",
+            esc_name, id_list.Id[i]);
+         if (verbose > 1) {
+            printf("%s\n", buf);
+         }
+         db_sql_query(db, buf, NULL, NULL);
       }
    }
 }
index 4003d62f8befea37b30bdebb4d9c73fe63eda3fe..c164292453929334c7212f4025fa770d3db36aee 100644 (file)
 #include "bacula.h"
 #include "findlib/find.h"
 
+/* Dummy functions */
+int generate_daemon_event(JCR *jcr, const char *event) 
+   { return 1; }
+
 static void usage()
 {
    fprintf(stderr, _(
@@ -58,11 +62,11 @@ main (int argc, char *const *argv)
    while ((ch = getopt(argc, argv, "v?")) != -1) {
       switch (ch) {
          case 'v':
-           verbose = 1;
-           break;
+            verbose = 1;
+            break;
          case '?':
-        default:
-           usage();
+         default:
+            usage();
 
       }
    }
@@ -75,14 +79,14 @@ main (int argc, char *const *argv)
 
    for (i = 0; i < argc; --argc, ++argv) {
       if (fstype(*argv, fs, sizeof(fs))) {
-        if (verbose) {
+         if (verbose) {
             printf("%s: %s\n", *argv, fs);
-        } else {
-           puts(fs);
-        }
+         } else {
+            puts(fs);
+         }
       } else {
          fprintf(stderr, "%s: unknown\n", *argv);
-        status = 1;
+         status = 1;
       }
    }
 
index 44bfde3f26a0ca2a35b7da6721cc89fbd6917445..23af56784d348174e329cdd52990dc4fb6a485a8 100644 (file)
@@ -32,6 +32,9 @@ int win32_client = 1;
 int win32_client = 0;
 #endif
 
+/* Dummy functions */
+int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
+int generate_job_event(JCR *jcr, const char *event) { return 1; }
 
 /* Global variables */
 static int num_files = 0;
index 087a8be9a01ec20c7490c57590aba052d9382a95..da1a4db1313b0ddc8735df7a2582e9618620aae6 100755 (executable)
@@ -31,6 +31,10 @@ int win32_client = 1;
 int win32_client = 0;
 #endif
 
+/* Dummy functions */
+int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
+int generate_job_event(JCR *jcr, const char *event) { return 1; }
+
 
 /* Global variables */
 int attrs = 0;
index 4df9f780a4625e82bd53a879a70f89820c3a090e..f6bdf3001f9ce2bcb768e99ee18260733adba83c 100644 (file)
@@ -1,8 +1,8 @@
 /* */
 #undef  VERSION
-#define VERSION "1.37.12"
-#define BDATE   "18 April 2005"
-#define LSMDATE "18Apr05"
+#define VERSION "1.37.13"
+#define BDATE   "19 April 2005"
+#define LSMDATE "19Apr05"
 
 /* Debug flags */
 #undef  DEBUG