Imported Upstream version 3.3.0
[debian/amanda] / server-src / amadmin.c
index 96e117b41195a1ca5e49288e1174b201c1639831..216f46ad43f22aa45a343bac8b47205e2b89f887 100644 (file)
@@ -246,7 +246,7 @@ usage(void)
 {
     int i;
 
-    g_fprintf(stderr, _("\nUsage: %s <conf> <command> {<args>} [-o configoption]* ...\n"),
+    g_fprintf(stderr, _("\nUsage: %s [-o configoption]* <conf> <command> {<args>} ...\n"),
            get_pname());
     g_fprintf(stderr, _("    Valid <command>s are:\n"));
     for (i = 0; i < NCMDS; i++)
@@ -1164,15 +1164,29 @@ find(
 
     output_find = find_dump(&diskq); /* Add deleted dump to diskq */
     if(argc-(start_argc-1) > 0) {
+       find_result_t *afind = NULL;
+       find_result_t *afind_next = NULL;
+       find_result_t *new_output_find = NULL;
+       disk_t *dp;
+
        amfree(errstr);
-       free_find_result(&output_find);
        errstr = match_disklist(&diskq, argc-(start_argc-1),
                                        argv+(start_argc-1));
        if (errstr) {
            g_printf("%s", errstr);
            amfree(errstr);
        }
-       output_find = find_dump(NULL);
+       for (afind = output_find; afind; afind = afind_next) {
+           afind_next = afind->next;
+           dp = lookup_disk(afind->hostname, afind->diskname);
+           if (dp->todo) {
+               afind->next = new_output_find;
+               new_output_find = afind;
+           } else {
+               amfree(afind);
+           }
+       }
+       output_find = new_output_find;
     } else if (errstr) {
        g_printf("%s", errstr);
        amfree(errstr);
@@ -1492,7 +1506,7 @@ holding(
                 amfree(dumpstr);
                dumpfile_free_data(&file);
             }
-            g_slist_free_full(file_list);
+            slist_free_full(file_list, g_free);
             break;
 
         case HOLDING_DELETE:
@@ -1510,7 +1524,7 @@ holding(
                     error(_("Could not delete '%s'"), (char *)li->data);
                 }
             }
-            g_slist_free_full(file_list);
+            slist_free_full(file_list, g_free);
             break;
     }
 }
@@ -1622,13 +1636,16 @@ export_one(
 {
     info_t info;
     int i,l;
+    char *qhost, *qdisk;
 
     if(get_info(dp->host->hostname, dp->name, &info)) {
        g_fprintf(stderr, _("Warning: no curinfo record for %s:%s\n"),
                dp->host->hostname, dp->name);
        return;
     }
-    g_printf(_("host: %s\ndisk: %s\n"), dp->host->hostname, dp->name);
+    qhost = quote_string(dp->host->hostname);
+    qdisk = quote_string(dp->name);
+    g_printf(_("host: %s\ndisk: %s\n"), qhost, qdisk);
     g_printf(_("command: %u\n"), info.command);
     g_printf(_("last_level: %d\n"),info.last_level);
     g_printf(_("consecutive_runs: %d\n"),info.consecutive_runs);
@@ -1660,6 +1677,8 @@ export_one(
               (intmax_t)info.history[l].date);
     }
     g_printf("//\n");
+    amfree(qhost);
+    amfree(qdisk);
 }
 
 /* ----------------------------------------------- */
@@ -1806,9 +1825,9 @@ import_one(void)
     skip_whitespace(s, ch);
     if(ch == '\0') goto parse_err;
     fp = s-1;
-    skip_non_whitespace(s, ch);
+    skip_quoted_string(s, ch);
     s[-1] = '\0';
-    hostname = stralloc(fp);
+    hostname = unquote_string(fp);
     s[-1] = (char)ch;
 
     skip_whitespace(s, ch);
@@ -1823,9 +1842,9 @@ import_one(void)
     skip_whitespace(s, ch);
     if(ch == '\0') goto parse_err;
     fp = s-1;
-    skip_non_whitespace(s, ch);
+    skip_quoted_string(s, ch);
     s[-1] = '\0';
-    diskname = stralloc(fp);
+    diskname = unquote_string(fp);
     s[-1] = (char)ch;
 
     amfree(line);
@@ -2069,6 +2088,7 @@ disklist_one(
     sle_t *excl;
     identlist_t pp_scriptlist;
     estimatelist_t  estimates;
+    dumptype_t *dtype = lookup_dumptype(dp->dtype_name);
 
     hp = dp->host;
     ip = hp->netif;
@@ -2264,6 +2284,24 @@ disklist_one(
     g_printf("        skip-incr %s\n", (dp->skip_incr? "YES" : "NO"));
     g_printf("        skip-full %s\n", (dp->skip_full? "YES" : "NO"));
     g_printf("        allow-split %s\n", (dp->allow_split ? "YES" : "NO"));
+    if (dumptype_seen(dtype, DUMPTYPE_RECOVERY_LIMIT)) {
+       char **rl, **r1;
+       rl = val_t_display_strs(dumptype_getconf((dtype),
+                               DUMPTYPE_RECOVERY_LIMIT), 1);
+       for(r1 = rl; *r1 != NULL; r1++) {
+           g_printf("        recovery-limit %s\n", *r1);
+       free(*r1);
+       }
+    }
+    if (dumptype_seen(dtype, DUMPTYPE_DUMP_LIMIT)) {
+       char **rl, **r1;
+       rl = val_t_display_strs(dumptype_getconf((dtype),
+                               DUMPTYPE_DUMP_LIMIT), 1);
+       for(r1 = rl; *r1 != NULL; r1++) {
+           g_printf("        dump-limit %s\n", *r1);
+       free(*r1);
+       }
+    }
     g_printf("        spindle %d\n", dp->spindle);
     pp_scriptlist = dp->pp_scriptlist;
     while (pp_scriptlist != NULL) {
@@ -2272,10 +2310,8 @@ disklist_one(
     }
 
     {
-       dumptype_t *dtype;
        char **prop, **p1;;
 
-       dtype = lookup_dumptype(dp->dtype_name);
        prop = val_t_display_strs(dumptype_getconf((dtype), DUMPTYPE_PROPERTY),
                                  0);
        for(p1 = prop; *p1 != NULL; p1++) {