relax build deps to benefit kFreeBSD systems
[debian/amanda] / client-src / sendsize.c
index 8eb5c046c56afe7ca5e13589afefbadf3445b137..083ec65e665850744e800a033a0d7d4b82e854bd 100644 (file)
@@ -122,6 +122,7 @@ main(
     disk_estimates_t *est;
     disk_estimates_t *est1;
     disk_estimates_t *est_prev;
+    disk_estimates_t *est_next;
     char *line = NULL;
     char *s, *fp;
     int ch;
@@ -139,6 +140,11 @@ main(
     (void)argc;        /* Quiet unused parameter warning */
     (void)argv;        /* Quiet unused parameter warning */
 
+    if (argc > 1 && argv && argv[1] && g_str_equal(argv[1], "--version")) {
+       printf("sendsize-%s\n", VERSION);
+       return (0);
+    }
+
     /* initialize */
 
     /*
@@ -413,6 +419,20 @@ main(
        amandates_started = FALSE;
     }
 
+    est_prev = NULL;
+    for(est = est_list; est != NULL; est = est_next) {
+       int good = merge_dles_properties(est->dle, 0);
+       est_next = est->next;
+       if (!good) {
+           if (est == est_list) {
+               est_list = est_next;
+           } else {
+               est_prev->next = est_next;
+           }
+       } else {
+           est_prev = est;
+       }
+    }
     for(est = est_list; est != NULL; est = est->next) {
        run_client_scripts(EXECUTE_ON_PRE_HOST_ESTIMATE, g_options, est->dle,
                           stdout);
@@ -992,7 +1012,6 @@ generic_calc_estimates(
     char *file_include = NULL;
     times_t start_time;
     FILE *dumpout = NULL;
-    off_t size = (off_t)1;
     char *line = NULL;
     char *match_expr;
     amwait_t wait_status;
@@ -1082,7 +1101,7 @@ generic_calc_estimates(
     }
     match_expr = vstralloc(" %d SIZE %lld", NULL);
     len = strlen(est->qamname);
-    for(size = (off_t)-1; (line = agets(dumpout)) != NULL; free(line)) {
+    for(; (line = agets(dumpout)) != NULL; free(line)) {
        long long size_ = (long long)0;
        if (line[0] == '\0' || (int)strlen(line) <= len)
            continue;
@@ -1095,7 +1114,6 @@ generic_calc_estimates(
                      level,
                      size_);
        }
-       size = (off_t)size_;
     }
     amfree(match_expr);