From: Tobias Oetiker Date: Tue, 4 Jul 2006 21:04:12 +0000 (+0000) Subject: let rrdtool understand headers in rrdtool restore input X-Git-Tag: 1.2.14~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=140f1d948b58daf02f9bfd106c7e9df7d40f8246;p=thirdparty%2Frrdtool-1.x.git let rrdtool understand headers in rrdtool restore input git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@849 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_restore.c b/src/rrd_restore.c index 29a97b3b..6097fa4c 100644 --- a/src/rrd_restore.c +++ b/src/rrd_restore.c @@ -18,6 +18,7 @@ void xml_lc(char*); int skip(char **); +int skipxml(char **); int eat_tag(char **, char *); int read_tag(char **, char *, char *, void *); int xml2rrd(char*, rrd_t*, char); @@ -44,6 +45,24 @@ void xml_lc(char* buf){ } } +int skipxml(char **buf){ + char *ptr; + ptr=(*buf); + do { + (*buf)=ptr; + while((*(ptr+1)) && ((*ptr)==' ' || (*ptr)=='\r' || (*ptr)=='\n' || (*ptr)=='\t')) ptr++; + if (strncmp(ptr,""); + if (ptr) ptr+=2; else { + rrd_set_error("Dangling XML header"); + (*buf) = NULL; + return -1; + } + } + } while ((*buf)!=ptr); + return 1; +} + int skip(char **buf){ char *ptr; ptr=(*buf); @@ -118,6 +137,8 @@ int xml2rrd(char* buf, rrd_t* rrd, char rc){ ptr2=buf; ptr3=buf; /* start with an RRD tag */ + + skipxml(&ptr); eat_tag(&ptr,"rrd"); /* allocate static header */