+ char *template = NULL;
+ int rc;
+ optind = 0; opterr = 0; /* initialize getopt */
+
+ while (1) {
+ static struct option long_options[] =
+ {
+ {"template", required_argument, 0, 't'},
+ {0,0,0,0}
+ };
+ int option_index = 0;
+ int opt;
+ opt = getopt_long(argc, argv, "t:",
+ long_options, &option_index);
+
+ if (opt == EOF)
+ break;
+
+ switch(opt) {
+ case 't':
+ template = optarg;
+ break;
+
+ case '?':
+ rrd_set_error("unknown option '%s'",argv[optind-1]);
+ return(-1);
+ }
+ }
+
+ /* need at least 2 arguments: filename, data. */
+ if (argc-optind < 2) {
+ rrd_set_error("Not enough arguments");
+
+ return -1;
+ }
+
+ rc = rrd_update_r(argv[optind], template,
+ argc - optind - 1, argv + optind + 1);
+ return rc;
+}
+
+int
+rrd_update_r(char *filename, char *template, int argc, char **argv)
+{
+ return _rrd_update(filename, template, argc, argv, NULL);
+}
+
+int
+_rrd_update(char *filename, char *template, int argc, char **argv,
+ info_t *pcdp_summary)
+{