summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5b16d46)
raw | patch | inline | side by side (parent: 5b16d46)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 12 Jun 2007 20:36:50 +0000 (20:36 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 12 Jun 2007 20:36:50 +0000 (20:36 +0000) |
- fix nulling the updvals
- cosmetic change to move the option struct out of the loop.
- need to operate on a copy of optarg
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1116 a5681a0c-68f1-0310-ab6d-d61299d08faa
- cosmetic change to move the option struct out of the loop.
- need to operate on a copy of optarg
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1116 a5681a0c-68f1-0310-ab6d-d61299d08faa
src/rrd_update.c | patch | blob | history |
diff --git a/src/rrd_update.c b/src/rrd_update.c
index 78f9a572e02e3bd70bedcdb6022899a61195fcc1..abe9704a2bf1080ba75ee112c47e6d9c04fe571a 100644 (file)
--- a/src/rrd_update.c
+++ b/src/rrd_update.c
int argc,
char **argv)
{
+ struct option long_options[] = {
+ {"template", required_argument, 0, 't'},
+ {0, 0, 0, 0}
+ };
+ int option_index = 0;
+ int opt;
char *tmplt = NULL;
int rc;
opterr = 0; /* initialize getopt */
while (1) {
- static struct option long_options[] = {
- {"template", required_argument, 0, 't'},
- {0, 0, 0, 0}
- };
- int option_index = 0;
- int opt;
-
opt = getopt_long(argc, argv, "t:", long_options, &option_index);
if (opt == EOF)
switch (opt) {
case 't':
- tmplt = optarg;
+ tmplt = strdup(optarg);
break;
case '?':
rc = rrd_update_r(argv[optind], tmplt,
argc - optind - 1, (const char **) (argv + optind + 1));
+ free(tmplt);
return rc;
}
}
/* initialize all ds input to unknown except the first one
which has always got to be set */
- memset(updvals + 1, 'U', rrd.stat_head->ds_cnt);
+ for (ii = 1; ii <= rrd.stat_head->ds_cnt; ii++)
+ updvals[ii] = "U";
updvals[0] = stepper;
/* separate all ds elements; first must be examined separately
due to alternate time syntax */