]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/bextract.c
Add address and socket for MySQL
[bacula/bacula] / bacula / src / stored / bextract.c
index 4df73cd10214c25eca77b484f59ae5d260ee03ae..69df799ba7415522ac3f977ea944d175cd3c45d7 100644 (file)
@@ -63,6 +63,7 @@ static POOLMEM *compress_buf;
 static int type;
 static int stream;
 static int prog_name_msg = 0;
+static char *VolumeName = NULL;
 
 static char *wbuf;                   /* write buffer address */
 static uint32_t wsize;               /* write size */
@@ -75,13 +76,14 @@ char *configfile;
 static void usage()
 {
    fprintf(stderr,
-"\nVersion: " VERSION " (" DATE ")\n\n"
+"\nVersion: " VERSION " (" BDATE ")\n\n"
 "Usage: bextract [-d debug_level] <bacula-archive> <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"
 "       -e <file>       exclude list\n"
 "       -i <file>       include list\n"
+"       -V              specify Volume names (separated by |)\n"
 "       -?              print this message\n\n");
    exit(1);
 }
@@ -150,6 +152,10 @@ int main (int argc, char *argv[])
            got_inc = TRUE;
            break;
 
+         case 'V':                    /* Volume name */
+           VolumeName = optarg;
+           break;
+
          case '?':
         default:
            usage();
@@ -186,7 +192,7 @@ int main (int argc, char *argv[])
 static void do_extract(char *devname)
 {
 
-   jcr = setup_jcr("bextract", devname, bsr);
+   jcr = setup_jcr("bextract", devname, bsr, VolumeName);
    dev = setup_to_access_device(jcr, 1);    /* acquire for read */
    if (!dev) {
       exit(1);
@@ -234,6 +240,7 @@ static void do_extract(char *devname)
  */
 static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
 {
+   int stat;
 
    if (rec->FileIndex < 0) {
       return;                         /* we don't want labels */
@@ -320,8 +327,9 @@ static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
 
         
       if (file_is_included(ff, fname) && !file_is_excluded(ff, fname)) {
+        uint32_t LinkFI;
 
-        decode_stat(ap, &statp);
+        decode_stat(ap, &statp, &LinkFI);
         /*
          * Prepend the where directory so that the
          * files are put where the user wants.
@@ -361,14 +369,22 @@ static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
 
          /*          Pmsg1(000, "Restoring: %s\n", ofile); */
 
-        extract = create_file(jcr, fname, ofile, lname, type, stream,
-                              &statp, attribsEx, &ofd, REPLACE_ALWAYS);
-        num_files++;
-
-        if (extract) {
-            print_ls_output(ofile, lname, type, &statp);   
-            fileAddr = 0;
-        }
+        extract = FALSE;
+        stat = create_file(jcr, fname, ofile, lname, type, stream,
+                           &statp, attribsEx, &ofd, REPLACE_ALWAYS);
+        switch (stat) {
+        case CF_ERROR:
+        case CF_SKIP:
+           break;
+        case CF_EXTRACT:
+           extract = TRUE;
+           /* Fall-through wanted */
+        case CF_CREATED:
+           print_ls_output(ofile, lname, type, &statp);   
+           num_files++;
+           fileAddr = 0;
+           break;
+        }  
       }
 
    /* Data stream and extracting */
@@ -458,7 +474,8 @@ static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
          Pmsg0(000, "Got Program Name or Data Stream. Ignored.\n");
         prog_name_msg = 1;
       }
-   } else if (rec->Stream != STREAM_MD5_SIGNATURE) {
+   } else if (!(rec->Stream == STREAM_MD5_SIGNATURE ||
+               rec->Stream == STREAM_SHA1_SIGNATURE)) {
       Pmsg2(0, "None of above!!! stream=%d data=%s\n", rec->Stream, rec->data);
    }
 }