X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=src%2Frrd_dump.c;h=0feafd72b87e7eca6613ecd0bac30b7d0c4364c7;hp=0f69e4f93731efd0e96148311d445cd240537eb7;hb=2e3ab4d5b17d1264c1908026df77242aeefb9b18;hpb=6396ef12edf2fb8fc5364ae5a8b782e6ef77d64b 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;