summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5519861)
raw | patch | inline | side by side (parent: 5519861)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 25 Aug 2005 20:43:04 +0000 (20:43 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 25 Aug 2005 20:43:04 +0000 (20:43 +0000) |
program/src/rrd_resize.c | patch | blob | history |
index 4613a878d1d9e70c6f20cc08c5ea294f99f41c0d..11d1ca88847b77b75601994e8e907cd5552307c5 100644 (file)
--- a/program/src/rrd_resize.c
+++ b/program/src/rrd_resize.c
int
rrd_resize(int argc, char **argv)
{
- char *infilename,outfilename[11]="resize.rrd";
- FILE *infile,*outfile;
- rrd_t rrdold,rrdnew;
- rrd_value_t buffer;
- unsigned long l,rra;
- long modify;
- unsigned long target_rra;
- int grow=0,shrink=0;
- char *endptr;
+ char *infilename,outfilename[11]="resize.rrd";
+ FILE *infile,*outfile;
+ rrd_t rrdold,rrdnew;
+ rrd_value_t buffer;
+ int version;
+ unsigned long l,rra;
+ long modify;
+ unsigned long target_rra;
+ int grow=0,shrink=0;
+ char *endptr;
infilename=argv[1];
if (!strcmp(infilename,"resize.rrd")) {
rrdnew.cdp_prep = rrdold.cdp_prep;
rrdnew.rra_ptr = rrdold.rra_ptr;
+ version = atoi(rrdold.stat_head->version);
+ switch (version) {
+ case 3: break;
+ case 1: rrdold.stat_head->version[3]='3';
+ break;
+ default: {
+ rrd_set_error("Do not know how to handle RRD version %s",rrdold.stat_head->version);
+ rrd_free(&rrdold);
+ fclose(infile);
+ return(-1);
+ }
+ }
+
if ((outfile=fopen(outfilename,"wb"))==NULL) {
rrd_set_error("Can't create '%s'",outfilename);
return(-1);