+int
+rrd_parse_shift(char *line, unsigned int *eaten, graph_desc_t *gdp, image_desc_t *im) {
+ char *l = strdup(line + *eaten), *p;
+ int rc = 1;
+
+ p = strchr(l, ':');
+ if (p == NULL) {
+ rrd_set_error("Invalid SHIFT syntax");
+ goto out;
+ }
+ *p++ = '\0';
+
+ if ((gdp->vidx=find_var(im,l))<0) {
+ rrd_set_error("Not a valid vname: %s in line %s",l,line);
+ goto out;
+ }
+
+ /* constant will parse; otherwise, must be VDEF reference */
+ if (sscanf(p, "%ld", &gdp->shval) != 1) {
+ graph_desc_t *vdp;
+
+ if ((gdp->shidx=find_var(im, p))<0) {
+ rrd_set_error("invalid offset vname: %s", p);
+ goto out;
+ }
+
+ vdp = &im->gdes[gdp->shidx];
+ if (vdp->gf != GF_VDEF) {
+ rrd_set_error("offset must specify value or VDEF");
+ goto out;
+ }
+ } else {
+ gdp->shidx = -1;
+ }
+
+ *eaten = strlen(line);
+ rc = 0;
+
+ out:
+ free(l);
+ return rc;
+}
+
+int
+rrd_parse_xport(char *line, unsigned int *eaten, graph_desc_t *gdp, image_desc_t *im) {
+ char *l = strdup(line + *eaten), *p;
+ int rc = 1;
+
+ p = strchr(l, ':');
+ if (p != NULL)
+ *p++ = '\0';
+ else
+ p = "";
+
+ if ((gdp->vidx=find_var(im, l))==-1){
+ rrd_set_error("unknown variable '%s'",l);
+ goto out;
+ }
+
+ if (strlen(p) >= FMT_LEG_LEN)
+ *(p + FMT_LEG_LEN) = '\0';
+
+ strcpy(gdp->legend, p);
+ *eaten = strlen(line);
+ rc = 0;
+
+ out:
+ free(l);
+ return rc;
+}
+