]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/bextract.c
This commit was manufactured by cvs2svn to create tag
[bacula/bacula] / bacula / src / stored / bextract.c
index c602eb4bfad0d880620e80cf3ed6b270ab6b5bcb..1ac47c0700736eaea88c63f7ab05577f7f723e1f 100644 (file)
@@ -39,7 +39,7 @@ int win32_client = 0;
 
 
 static void do_extract(char *fname);
-static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec);
+static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec);
 
 static DEVICE *dev = NULL;
 static BFILE bfd;
@@ -71,13 +71,13 @@ static void usage()
 {
    fprintf(stderr,
 "\nVersion: " VERSION " (" BDATE ")\n\n"
-"Usage: bextract [-d debug_level] <bacula-archive> <directory-to-store-files>\n"
+"Usage: bextract <options> <bacula-archive-device-name> <directory-to-store-files>\n"
 "       -b <file>       specify a bootstrap file\n"
 "       -c <file>       specify a configuration file\n"
-"       -dnn            set debug level to nn\n"
+"       -d <nn>         set debug level to nn\n"
 "       -e <file>       exclude list\n"
 "       -i <file>       include list\n"
-"       -V              specify Volume names (separated by |)\n"
+"       -V <volumes>    specify Volume names (separated by |)\n"
 "       -?              print this message\n\n");
    exit(1);
 }
@@ -98,11 +98,11 @@ int main (int argc, char *argv[])
    init_include_exclude_files(ff);
    binit(&bfd);
 
-   while ((ch = getopt(argc, argv, "b:c:d:e:i:?")) != -1) {
+   while ((ch = getopt(argc, argv, "b:c:d:e:i:V:?")) != -1) {
       switch (ch) {
       case 'b':                    /* bootstrap file */
         bsr = parse_bsr(NULL, optarg);
-//      dump_bsr(bsr);
+//      dump_bsr(bsr, true);
         break;
 
       case 'c':                    /* specify config file */
@@ -235,12 +235,12 @@ static void do_extract(char *devname)
 /*
  * Called here for each record from read_records()
  */
-static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
+static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
 {
    int stat;
 
    if (rec->FileIndex < 0) {
-      return;                         /* we don't want labels */
+      return 1;                       /* we don't want labels */
    }
 
    /* File Attributes stream */
@@ -278,7 +278,7 @@ static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
                  stream_to_ascii(attr->data_stream));
            }
            extract = FALSE;
-           return;
+           return 1;
         }
 
 
@@ -363,7 +363,7 @@ static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
                   Emsg3(M_ERROR, 0, _("Seek to %s error on %s: ERR=%s\n"), 
                     edit_uint64(fileAddr, ec1), attr->ofname, berror(&bfd));
                  extract = FALSE;
-                 return;
+                 return 1;
               }
            }
         } else {
@@ -375,7 +375,7 @@ static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
               (const Bytef *)wbuf, (uLong)wsize) != Z_OK)) {
             Emsg1(M_ERROR, 0, _("Uncompression error. ERR=%d\n"), stat);
            extract = FALSE;
-           return;
+           return 1;
         }
 
          Dmsg2(100, "Write uncompressed %d bytes, total before write=%d\n", compress_len, total);
@@ -384,7 +384,7 @@ static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
             Emsg2(M_ERROR, 0, _("Write error on %s: %s\n"), 
               attr->ofname, strerror(errno));
            extract = FALSE;
-           return;
+           return 1;
         }
         total += compress_len;
         fileAddr += compress_len;
@@ -395,7 +395,7 @@ static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
       if (extract) {
          Emsg0(M_ERROR, 0, "GZIP data stream found, but GZIP not configured!\n");
         extract = FALSE;
-        return;
+        return 1;
       }
 #endif
       break;
@@ -426,6 +426,7 @@ static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
       break;
       
    } /* end switch */
+   return 1;
 }
 
 
@@ -434,7 +435,7 @@ static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
 /* Dummies to replace askdir.c */
 int    dir_get_volume_info(JCR *jcr, enum get_vol_info_rw  writing) { return 1;}
 int    dir_find_next_appendable_volume(JCR *jcr) { return 1;}
-int    dir_update_volume_info(JCR *jcr, VOLUME_CAT_INFO *vol, int relabel) { return 1; }
+int    dir_update_volume_info(JCR *jcr, DEVICE *dev, int relabel) { return 1; }
 int    dir_create_jobmedia_record(JCR *jcr) { return 1; }
 int    dir_ask_sysop_to_mount_next_volume(JCR *jcr, DEVICE *dev) { return 1; }
 int    dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec) { return 1;}