- puts("<!-- Round Robin Database Dump -->");
- puts("<rrd>");
- printf("\t<version> %s </version>\n",RRD_VERSION);
- printf("\t<step> %lu </step> <!-- Seconds -->\n",rrd.stat_head->pdp_step);
+ out_file = NULL;
+ if (outname)
+ {
+ if (!(out_file = fopen(outname, "w")))
+ {
+ return (-1);
+ }
+ }
+ else
+ {
+ out_file = stdout;
+ }
+
+ fputs("<!-- Round Robin Database Dump -->", out_file);
+ fputs("<rrd>", out_file);
+ fprintf(out_file, "\t<version> %s </version>\n",RRD_VERSION);
+ fprintf(out_file, "\t<step> %lu </step> <!-- Seconds -->\n",rrd.stat_head->pdp_step);