{
char *opt_daemon = NULL;
int status;
+ int i;
/* initialize getopt */
optind = 0;
}
} /* while (42) */
- if ((argc - optind) != 1)
+ if ((argc - optind) < 1)
{
- rrd_set_error ("Usage: rrdtool %s [--daemon <addr>] <file>", argv[0]);
+ rrd_set_error ("Usage: rrdtool %s [--daemon <addr>] <file> [<file> ...]", argv[0]);
return (-1);
}
return (-1);
}
- status = rrdc_flush(argv[optind]);
+ status = 0;
+ for (int i = optind; i < argc; i++)
+ {
+ status = rrdc_flush(argv[i]);
+ if (status)
+ {
+ char *error;
+ int remaining;
+
+ error = strdup(rrd_get_error());
+ remaining = argc - optind - 1;
+
+ rrd_set_error("Flushing of file \"%s\" failed: %s. Skipping "
+ "remaining %i file%s.", argv[i],
+ ((! error) || (*error == '\0')) ? "unknown error" : error,
+ remaining, (remaining == 1) ? "" : "s");
+ free(error);
+ break;
+ }
+ }
return ((status == 0) ? 0 : -1);
} /* int rrd_flush */