Imported Upstream version 2.6.0
[debian/amanda] / client-src / sendbackup-dump.c
index c76239415e75fcd583aa7e99708018aef1c1beca..1ec5a7fb2321a0f8977b6739b726639299870eaf 100644 (file)
@@ -41,40 +41,44 @@ static amregex_t re_table[] = {
   /* the various encodings of dump size */
   /* this should also match BSDI pre-3.0's buggy dump program, that
      produced doubled DUMP: DUMP: messages */
-  AM_SIZE_RE("DUMP: [0-9][0-9]* tape blocks", 1024),
-  AM_SIZE_RE("dump: Actual: [0-9][0-9]* tape blocks", 1024),
+  AM_SIZE_RE("DUMP: [0-9][0-9]* tape blocks", 1024, 1),
+  AM_SIZE_RE("dump: Actual: [0-9][0-9]* tape blocks", 1024, 1),
   AM_SIZE_RE("backup: There are [0-9][0-9]* tape blocks on [0-9][0-9]* tapes",
-            1024),
+            1024, 1),
   AM_SIZE_RE("backup: [0-9][0-9]* tape blocks on [0-9][0-9]* tape\\(s\\)",
-            1024),
+            1024, 1),
   AM_SIZE_RE("backup: [0-9][0-9]* 1k blocks on [0-9][0-9]* volume\\(s\\)",
-            1024),
+            1024, 1),
   AM_SIZE_RE("DUMP: [0-9][0-9]* blocks \\([0-9][0-9]*KB\\) on [0-9][0-9]* volume",
-            512),
+            512, 1),
   AM_SIZE_RE("DUMP: [0-9][0-9]* blocks \\([0-9][0-9]*\\.[0-9][0-9]*MB\\) on [0-9][0-9]* volume",
-            512),
-  AM_SIZE_RE("DUMP: [0-9][0-9]* blocks", 512),
-  AM_SIZE_RE("DUMP: [0-9][0-9]* bytes were dumped", 1),
+            512, 1),
+  AM_SIZE_RE("DUMP: [0-9][0-9]* blocks \\([0-9][0-9]*KB\\)",
+            1024, 2),
+  AM_SIZE_RE("DUMP: [0-9][0-9]* blocks \\([0-9][0-9]*\\.[0-9][0-9]*MB\\)",
+            1048576, 2),
+  AM_SIZE_RE("DUMP: [0-9][0-9]* blocks", 512, 1),
+  AM_SIZE_RE("DUMP: [0-9][0-9]* bytes were dumped", 1, 1),
   /* OSF's vdump */
-  AM_SIZE_RE("vdump: Dumped  [0-9][0-9]* of [0-9][0-9]* bytes", 1),
+  AM_SIZE_RE("vdump: Dumped  [0-9][0-9]* of [0-9][0-9]* bytes", 1, 1),
   /* DU 4.0a dump */
-  AM_SIZE_RE("dump: Actual: [0-9][0-9]* blocks output to pipe", 1024),
+  AM_SIZE_RE("dump: Actual: [0-9][0-9]* blocks output to pipe", 1024, 1),
   /* DU 4.0 vdump */
-  AM_SIZE_RE("dump: Dumped  [0-9][0-9]* of [0-9][0-9]* bytes", 1),
+  AM_SIZE_RE("dump: Dumped  [0-9][0-9]* of [0-9][0-9]* bytes", 1, 1),
   /* HPUX dump */
-  AM_SIZE_RE("DUMP: [0-9][0-9]* KB actual output", 1024),
+  AM_SIZE_RE("DUMP: [0-9][0-9]* KB actual output", 1024, 1),
   /* HPUX 10.20 and above vxdump */
-  AM_SIZE_RE("vxdump: [0-9][0-9]* tape blocks", 1024),
+  AM_SIZE_RE("vxdump: [0-9][0-9]* tape blocks", 1024, 1),
   /* UnixWare vxdump */
-  AM_SIZE_RE("vxdump: [0-9][0-9]* blocks", 1024),
+  AM_SIZE_RE("vxdump: [0-9][0-9]* blocks", 1024, 1),
   /* SINIX vxdump */
-  AM_SIZE_RE("   VXDUMP: [0-9][0-9]* blocks", 512),
+  AM_SIZE_RE("   VXDUMP: [0-9][0-9]* blocks", 512, 1),
   /* SINIX ufsdump */
-  AM_SIZE_RE("   UFSDUMP: [0-9][0-9]* blocks", 512),
+  AM_SIZE_RE("   UFSDUMP: [0-9][0-9]* blocks", 512, 1),
   /* Irix 6.2 xfs dump */
-  AM_SIZE_RE("xfsdump: media file size [0-9][0-9]* bytes", 1),
+  AM_SIZE_RE("xfsdump: media file size [0-9][0-9]* bytes", 1, 1),
   /* NetApp dump */
-  AM_SIZE_RE("DUMP: [0-9][0-9]* KB", 1024),
+  AM_SIZE_RE("DUMP: [0-9][0-9]* KB", 1024, 1),
 
   /* strange dump lines */
   AM_STRANGE_RE("should not happen"),
@@ -136,6 +140,7 @@ start_backup(
     char *device = NULL;
     char *fstype = NULL;
     char *cmd = NULL;
+    char *cmdX = NULL;
     char *indexcmd = NULL;
     char level_str[NUM_STR_SIZE];
     char *compopt  = NULL;
@@ -145,13 +150,12 @@ start_backup(
 
     (void)dumpdate;    /* Quiet unused parameter warning */
 
-    snprintf(level_str, SIZEOF(level_str), "%d", level);
+    g_snprintf(level_str, SIZEOF(level_str), "%d", level);
 
     qdisk = quote_string(disk);
-    dbprintf(("%s: start: %s:%s lev %d\n",
-             get_pname(), host, qdisk, level));
+    dbprintf(_("start: %s:%s lev %d\n"), host, qdisk, level);
 
-    fprintf(stderr, "%s: start [%s:%s level %d]\n",
+    g_fprintf(stderr, _("%s: start [%s:%s level %d]\n"),
            get_pname(), host, qdisk, level);
     amfree(qdisk);
 
@@ -160,8 +164,7 @@ start_backup(
         encpid = pipespawn(options->clnt_encrypt, STDIN_PIPE,
                        &compout, &dataf, &mesgf,
                        options->clnt_encrypt, encryptopt, NULL);
-        dbprintf(("%s: pid %ld: %s\n",
-                 debug_prefix_time("-gnutar"), (long)encpid, options->clnt_encrypt));
+        dbprintf(_("gnutar: pid %ld: %s\n"), (long)encpid, options->clnt_encrypt);
     } else {
         compout = dataf;
         encpid = -1;
@@ -169,11 +172,11 @@ start_backup(
     /*  now do the client-side compression */
 
 
-    if(options->compress == COMPR_FAST || options->compress == COMPR_BEST) {
+    if(options->compress == COMP_FAST || options->compress == COMP_BEST) {
        compopt = skip_argument;
 
 #if defined(COMPRESS_BEST_OPT) && defined(COMPRESS_FAST_OPT)
-       if(options->compress == COMPR_BEST) {
+       if(options->compress == COMP_BEST) {
            compopt = COMPRESS_BEST_OPT;
        } else {
            compopt = COMPRESS_FAST_OPT;
@@ -182,23 +185,22 @@ start_backup(
        comppid = pipespawn(COMPRESS_PATH, STDIN_PIPE,
                            &dumpout, &compout, &mesgf,
                            COMPRESS_PATH, compopt, NULL);
-       dbprintf(("%s: pid %ld: %s",
-                 debug_prefix_time("-dump"), (long)comppid, COMPRESS_PATH));
+       dbprintf(_("dump: pid %ld: %s"), (long)comppid, COMPRESS_PATH);
        if(compopt != skip_argument) {
-           dbprintf((" %s", compopt));
+           dbprintf(" %s", compopt);
        }
-       dbprintf(("\n"));
-     } else if (options->compress == COMPR_CUST) {
+       dbprintf("\n");
+     } else if (options->compress == COMP_CUST) {
         compopt = skip_argument;
        comppid = pipespawn(options->clntcompprog, STDIN_PIPE,
                            &dumpout, &compout, &mesgf,
                            options->clntcompprog, compopt, NULL);
-       dbprintf(("%s: pid %ld: %s",
-                 debug_prefix_time("-gnutar-cust"), (long)comppid, options->clntcompprog));
+       dbprintf(_("gnutar-cust: pid %ld: %s"),
+               (long)comppid, options->clntcompprog);
        if(compopt != skip_argument) {
-           dbprintf((" %s", compopt));
+           dbprintf(" %s", compopt);
        }
-       dbprintf(("\n"));
+       dbprintf("\n");
     } else {
        dumpout = compout;
        comppid = -1;
@@ -208,17 +210,18 @@ start_backup(
     device = amname_to_devname(amdevice);
     fstype = amname_to_fstype(amdevice);
 
-    dbprintf(("%s: dumping device '%s' with '%s'\n",
-             debug_prefix_time(NULL), device, fstype));
+    dbprintf(_("dumping device '%s' with '%s'\n"), device, fstype);
 
 #if defined(USE_RUNDUMP) || !defined(DUMP)
-    cmd = vstralloc(libexecdir, "/", "rundump", versionsuffix(), NULL);
+    cmd = vstralloc(amlibexecdir, "/", "rundump", versionsuffix(), NULL);
+    cmdX = cmd;
     if (g_options->config)
        config = g_options->config;
     else
        config = "NOCONFIG";
 #else
     cmd = stralloc(DUMP);
+    cmdX = skip_argument;
     config = skip_argument;
 #endif
 
@@ -231,8 +234,9 @@ start_backup(
     if (1)
 #endif                                                 /* } */
     {
-        char *progname = cmd = newvstralloc(cmd, libexecdir, "/", "rundump",
+        char *progname = cmd = newvstralloc(cmd, amlibexecdir, "/", "rundump",
                                            versionsuffix(), NULL);
+       cmdX = cmd;
        if (g_options->config)
            config = g_options->config;
        else
@@ -256,7 +260,7 @@ start_backup(
        dumpkeys = stralloc(level_str);
        dumppid = pipespawn(progname, STDIN_PIPE,
                            &dumpin, &dumpout, &mesgf,
-                           config, /* JLM */
+                           cmdX, config,
                            "xfsdump",
                            options->no_record ? "-J" : skip_argument,
                            "-F",
@@ -275,14 +279,16 @@ start_backup(
 #endif
     {
 #ifdef USE_RUNDUMP
-        char *progname = cmd = newvstralloc(cmd, libexecdir, "/", "rundump",
+        char *progname = cmd = newvstralloc(cmd, amlibexecdir, "/", "rundump",
                                            versionsuffix(), NULL);
+       cmdX = cmd;
        if (g_options->config)
            config = g_options->config;
        else
            config = "NOCONFIG";
 #else
        char *progname = cmd = newvstralloc(cmd, VXDUMP, NULL);
+       cmdX = skip_argument;
        config = skip_argument;
 #endif
        program->backup_name  = VXDUMP;
@@ -306,7 +312,7 @@ start_backup(
 
        dumppid = pipespawn(progname, STDIN_PIPE,
                            &dumpin, &dumpout, &mesgf, 
-                           progname, config, /* JLM */
+                           cmdX, config,
                            "vxdump",
                            dumpkeys,
                            "1048576",
@@ -324,8 +330,9 @@ start_backup(
     if (1)
 #endif
     {
-        char *progname = cmd = newvstralloc(cmd, libexecdir, "/", "rundump",
+        char *progname = cmd = newvstralloc(cmd, amlibexecdir, "/", "rundump",
                                            versionsuffix(), NULL);
+       cmdX = cmd;
        if (g_options->config)
            config = g_options->config;
        else
@@ -352,7 +359,7 @@ start_backup(
 
        dumppid = pipespawn(cmd, STDIN_PIPE,
                            &dumpin, &dumpout, &mesgf, 
-                           cmd, config,
+                           cmdX, config,
                            "vdump",
                            dumpkeys,
                            "60",
@@ -368,12 +375,15 @@ start_backup(
 #define RESTORE "restore"
 #endif
 
+#ifdef HAVE_HONOR_NODUMP
+#  define PARAM_HONOR_NODUMP "h"
+#else
+#  define PARAM_HONOR_NODUMP ""
+#endif
        dumpkeys = vstralloc(level_str,
                             options->no_record ? "" : "u",
                             "s",
-#ifdef HAVE_HONOR_NODUMP
-                            "h",
-#endif
+                            PARAM_HONOR_NODUMP,
                             "f",
                             NULL);
 
@@ -390,7 +400,7 @@ start_backup(
 
        dumppid = pipespawn(cmd, STDIN_PIPE,
                            &dumpin, &dumpout, &mesgf, 
-                           cmd, config,
+                           cmdX, config,
                            "dump",
                            dumpkeys,
                            "1048576",
@@ -422,7 +432,7 @@ start_backup(
 
     dumppid = pipespawn(cmd, STDIN_PIPE,
                        &dumpin, &dumpout, &mesgf, 
-                       cmd, config,
+                       cmdX, config,
                        "backup",
                        dumpkeys,
                        "-",