[rrd-developers] minor bugs?
David Lee
t.d.lee at durham.ac.uk
Fri Nov 29 17:04:46 MET 2002
While looking at rrd_restore.c, I spotted what I think are two minor bugs:
1. Specification of the "--range-check" argument: This takes no arguments
(man page) but the code had said "required_argument".
2. Presentation of the usage message: man page says:
rrdtool restore filename.xml filename.rrd [--range-check|-r]
but the code had said (twice);
rrd_set_error("usage rrdtool %s [--range-check|-r] file.xml file.rrd",argv[0]);
Although I have frequently programmed the old (short-form only) "getopt()"
routine, have almost no experience in the longer-form "getopt_long()", so
please check and double-check the patch below:
=============== snip ==================
*** src/rrd_restore.c.orig Fri Oct 11 19:39:48 2002
--- src/rrd_restore.c Fri Nov 29 15:53:32 2002
***************
*** 336,349 ****
/* init rrd clean */
rrd_init(&rrd);
if (argc<3) {
! rrd_set_error("usage rrdtool %s [--range-check/-r] file.xml file.rrd",argv[0]);
return -1;
}
while (1) {
static struct option long_options[] =
{
! {"range-check", required_argument, 0, 'r'},
{0,0,0,0}
};
int option_index = 0;
--- 336,349 ----
/* init rrd clean */
rrd_init(&rrd);
if (argc<3) {
! rrd_set_error("usage rrdtool %s file.xml file.rrd [--range-check/-r]",argv[0]);
return -1;
}
while (1) {
static struct option long_options[] =
{
! {"range-check", no_argument, 0, 'r'},
{0,0,0,0}
};
int option_index = 0;
***************
*** 360,366 ****
rc=1;
break;
default:
! rrd_set_error("usage rrdtool %s [--range-check|-r] file.xml file.rrd",argv[0]);
return -1;
break;
}
--- 360,366 ----
rc=1;
break;
default:
! rrd_set_error("usage rrdtool %s file.xml file.rrd [--range-check|-r]",argv[0]);
return -1;
break;
}
=============== snip ==================
--
: David Lee I.T. Service :
: Systems Programmer Computer Centre :
: University of Durham :
: http://www.dur.ac.uk/t.d.lee/ South Road :
: Durham :
: Phone: +44 191 374 2882 U.K. :
--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/rrd-developers
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the rrd-developers
mailing list