- names[total] = new char[strlen(arg1) + 1];
- values[total] = new char[strlen(arg2) + 1];
- strcpy(names[total], arg1);
- strcpy(values[total], arg2);
+ char *tp = new char[title_len + 1];
+ names[total] = tp;
+ while( --title_len >= 0 ) *tp++ = *title++;
+ *tp = 0;
+ // accumulate value (+ continued lines)
+ char *value = bp;
+ while( bp < ep && !done ) {
+ while( bp < ep && *bp && *bp != '\n' ) ++bp;
+ if( bp >= ep || !*bp ) break;
+ if( (ch=fgetc(fp)) < 0 ) break;
+ if( ch != '+' ) { ungetc(ch, fp); break; }
+ *bp++ = '\n';
+ done = !fgets(bp, ep-bp, fp);
+ }
+ int value_len = bp - value;
+ char *vp = new char[value_len + 1];
+ values[total] = vp;
+ while( --value_len >= 0 ) *vp++ = *value++;
+ *vp = 0;