comparison common/listutil.c @ 292:57867a523dcf

Do not cut off the last character of the line. (next-cur does not include \n)
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 02 Apr 2014 15:39:50 +0000
parents 881ce5126f07
children f6ce186cebc2
comparison
equal deleted inserted replaced
291:5ab445e6a4da 292:57867a523dcf
250 { 250 {
251 char *next = strchr(cur, '\n'); 251 char *next = strchr(cur, '\n');
252 if (strlen(cur) > 3 && (cur[0] == 'I' || cur[0] == 'R') && 252 if (strlen(cur) > 3 && (cur[0] == 'I' || cur[0] == 'R') &&
253 next - cur > 4) 253 next - cur > 4)
254 { 254 {
255 size_t len = (size_t) (next - cur - 4); 255 size_t len = (size_t) (next - cur - 3);
256 /* Remove I: or R: at the beginning and \r\n at the end */ 256 /* Remove I: or R: at the beginning and \r\n at the end */
257 strv_append(&retval, cur + 2, len); 257 strv_append(&retval, cur + 2, len);
258 } 258 }
259 cur = next ? (next + 1) : NULL; 259 cur = next ? (next + 1) : NULL;
260 } 260 }

http://wald.intevation.org/projects/trustbridge/