From 2e3ab4d5b17d1264c1908026df77242aeefb9b18 Mon Sep 17 00:00:00 2001 From: oetiker Date: Fri, 16 May 2008 12:28:37 +0000 Subject: [PATCH] added --no-header to documentation and fixed implementation git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1359 a5681a0c-68f1-0310-ab6d-d61299d08faa --- doc/rrddump.pod | 12 +++++++++--- src/rrd_dump.c | 10 +++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/doc/rrddump.pod b/doc/rrddump.pod index 2e4cd4b..a698d84 100644 --- a/doc/rrddump.pod +++ b/doc/rrddump.pod @@ -4,11 +4,11 @@ rrddump - dump the contents of an RRD to XML format =head1 SYNOPSIS -B B I E I +B B S<[B<--no-header>|B<-n>]> I E I or -B B I I +B B S<[B<--no-header>|B<-n>]> I I =head1 DESCRIPTION @@ -20,7 +20,6 @@ manipulate the contents of an B file in a somewhat more convenient manner. - =over 8 =item I @@ -32,6 +31,13 @@ The name of the B 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. +=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 diff --git a/src/rrd_dump.c b/src/rrd_dump.c index 0f69e4f..0feafd7 100644 --- a/src/rrd_dump.c +++ b/src/rrd_dump.c @@ -81,7 +81,7 @@ int rrd_dump_opt_r( out_file = stdout; } - if (opt_noheader){ + if (!opt_noheader){ fputs("\n", out_file); fputs ("\n", @@ -473,16 +473,16 @@ int rrd_dump( } } /* 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); } - 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 { - rc = rrd_dump_opt_r(argv[1], NULL,opt_noheader); + rc = rrd_dump_opt_r(argv[optind], NULL,opt_noheader); } return rc; -- 2.11.0