added --no-header to documentation and fixed implementation
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Fri, 16 May 2008 12:28:37 +0000 (12:28 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Fri, 16 May 2008 12:28:37 +0000 (12:28 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1359 a5681a0c-68f1-0310-ab6d-d61299d08faa

doc/rrddump.pod
src/rrd_dump.c

index 2e4cd4b..a698d84 100644 (file)
@@ -4,11 +4,11 @@ rrddump - dump the contents of an RRD to XML format
 
 =head1 SYNOPSIS
 
 
 =head1 SYNOPSIS
 
-B<rrdtool> B<dump> I<filename.rrd> E<gt> I<filename.xml>
+B<rrdtool> B<dump> S<[B<--no-header>|B<-n>]> I<filename.rrd> E<gt> I<filename.xml>
 
 or 
 
 
 or 
 
-B<rrdtool> B<dump> I<filename.rrd> I<filename.xml>
+B<rrdtool> B<dump> S<[B<--no-header>|B<-n>]> I<filename.rrd> I<filename.xml>
 
 =head1 DESCRIPTION
 
 
 =head1 DESCRIPTION
 
@@ -20,7 +20,6 @@ manipulate the contents of an B<RRD> file in a somewhat more
 convenient manner.
 
 
 convenient manner.
 
 
-
 =over 8
 
 =item I<filename.rrd>
 =over 8
 
 =item I<filename.rrd>
@@ -32,6 +31,13 @@ The name of the B<RRD> you want to dump.
 The (optional) filename that you want to write the XML output to.
 If not specified, the XML will be printed to stdout.
 
 The (optional) filename that you want to write the XML output to.
 If not specified, the XML will be printed to stdout.
 
+=item S<[B<--no-header>|B<-n>]>
+
+In rrdtool 1.3, the dump function started producing correct xml-headers.
+Unfortunately the rrdtool restore function from the 1.2 series can not
+handle these headers. With this option you can supress the creatinon of
+the xml headers.
+
 =back
 
 =head1 EXAMPLES
 =back
 
 =head1 EXAMPLES
index 0f69e4f..0feafd7 100644 (file)
@@ -81,7 +81,7 @@ int rrd_dump_opt_r(
         out_file = stdout;
     }
 
         out_file = stdout;
     }
 
-    if (opt_noheader){
+    if (!opt_noheader){
       fputs("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n", out_file);
       fputs
         ("<!DOCTYPE rrd SYSTEM \"http://oss.oetiker.ch/rrdtool/rrdtool.dtd\">\n",
       fputs("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n", out_file);
       fputs
         ("<!DOCTYPE rrd SYSTEM \"http://oss.oetiker.ch/rrdtool/rrdtool.dtd\">\n",
@@ -473,16 +473,16 @@ int rrd_dump(
         }
     }                   /* while (42) */
 
         }
     }                   /* while (42) */
 
-    if ((argc - optind) < 2) {
+    if ((argc - optind) < 1 || (argc - optind) > 2) {
         rrd_set_error("usage rrdtool %s [--no-header|-n] "
                       "file.rrd [file.xml]", argv[0]);
         return (-1);
     }
 
         rrd_set_error("usage rrdtool %s [--no-header|-n] "
                       "file.rrd [file.xml]", argv[0]);
         return (-1);
     }
 
-    if (argc == 3) {
-        rc = rrd_dump_opt_r(argv[1], argv[2],opt_noheader);
+    if ((argc - optind) == 2) {
+        rc = rrd_dump_opt_r(argv[optind], argv[optind+1],opt_noheader);
     } else {
     } else {
-        rc = rrd_dump_opt_r(argv[1], NULL,opt_noheader);
+        rc = rrd_dump_opt_r(argv[optind], NULL,opt_noheader);
     }
 
     return rc;
     }
 
     return rc;