]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/tools/bbatch.c
ebl fix segfault with debug mode
[bacula/bacula] / bacula / src / tools / bbatch.c
index 17259dcf59e247be515c8cc687574825cf390325..286b908596c3879ab1e8918e53ca4839414ebcd7 100644 (file)
@@ -29,7 +29,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.
@@ -149,9 +149,9 @@ int main (int argc, char *argv[])
          break;
 
       case 'f':
-        if (nb < 10 ) {
-           files[nb++] = optarg;
-        }
+         if (nb < 10 ) {
+            files[nb++] = optarg;
+         }
          break;
 
       case '?':
@@ -183,8 +183,8 @@ int main (int argc, char *argv[])
       bjcr->NumReadVolumes = 0;
       bjcr->NumWriteVolumes = 0;
       bjcr->JobId = getpid();
-      bjcr->JobType = JT_CONSOLE;
-      bjcr->JobLevel = L_FULL;
+      bjcr->set_JobType(JT_CONSOLE);
+      bjcr->set_JobLevel(L_FULL);
       bjcr->JobStatus = JS_Running;
       bjcr->where = bstrdup(files[i]);
       bjcr->job_name = get_pool_memory(PM_FNAME);
@@ -198,15 +198,15 @@ int main (int argc, char *argv[])
       pm_strcpy(bjcr->fileset_md5, "Dummy.fileset.md5");
       
       if ((db=db_init_database(NULL, db_name, db_user, db_password,
-                              db_host, 0, NULL, 0)) == NULL) {
-        Emsg0(M_ERROR_TERM, 0, _("Could not init Bacula database\n"));
+                               db_host, 0, NULL, 0)) == NULL) {
+         Emsg0(M_ERROR_TERM, 0, _("Could not init Bacula database\n"));
       }
       if (!db_open_database(NULL, db)) {
-        Emsg0(M_ERROR_TERM, 0, db_strerror(db));
+         Emsg0(M_ERROR_TERM, 0, db_strerror(db));
       }
       Dmsg0(200, "Database opened\n");
       if (verbose) {
-        Pmsg2(000, _("Using Database: %s, User: %s\n"), db_name, db_user);
+         Pmsg2(000, _("Using Database: %s, User: %s\n"), db_name, db_user);
       }
       
       bjcr->db = db;
@@ -231,23 +231,23 @@ static void fill_attr(ATTR_DBR *ar, char *data)
 
    for(p = b = data; *p; p++) {
       if (*p == ';') {
-        *p = '\0';
-        switch (index) {
-        case 0:
-           ar->FileIndex = str_to_int64(b);
-           break;
-        case 1:
-           ar->fname = b;
-           break;
-        case 2:
-           ar->attr = b;
-           break;
-        case 3:
-           ar->Digest = b;
-           break;
-        }
-        index++;
-        b = ++p;
+         *p = '\0';
+         switch (index) {
+         case 0:
+            ar->FileIndex = str_to_int64(b);
+            break;
+         case 1:
+            ar->fname = b;
+            break;
+         case 2:
+            ar->attr = b;
+            break;
+         case 3:
+            ar->Digest = b;
+            break;
+         }
+         index++;
+         b = ++p;
       }
    }
 }
@@ -270,11 +270,11 @@ static void *do_batch(void *jcr)
       strip_trailing_newline(data);
       lineno++;
       if (verbose && ((lineno % 5000) == 1)) {
-        printf("\r%i", lineno);
+         printf("\r%i", lineno);
       }
       fill_attr(&ar, data);
       if (!db_create_file_attributes_record(bjcr, bjcr->db, &ar)) {
-        Emsg0(M_ERROR_TERM, 0, _("Error while inserting file\n"));
+         Emsg0(M_ERROR_TERM, 0, _("Error while inserting file\n"));
       }
    }
    fclose(fd);
@@ -286,7 +286,7 @@ static void *do_batch(void *jcr)
    printf("\rbegin = %s, end = %s\n", edit_int64(begin, ed1),edit_int64(end, ed2));
    printf("Insert time = %sms\n", edit_int64((end - begin) / 10000, ed1));
    printf("Create %u files at %.2f/s\n", lineno, 
-         (lineno / ((float)((end - begin) / 1000000))));
+          (lineno / ((float)((end - begin) / 1000000))));
    nb--;
    V(mutex);
    pthread_exit(NULL);