rrdcollect: Build against the latest version of librrd - there is no need to use...
[openwrt/svn-archive/archive.git] / utils / rrdcollect / patches / 001-scan.patch
1 diff -ruN rrdcollect-0.2.3.orig/src/scan.c rrdcollect-0.2.3/src/scan.c
2 --- rrdcollect-0.2.3.orig/src/scan.c 2005-01-20 18:42:17.000000000 +0100
3 +++ rrdcollect-0.2.3/src/scan.c 2006-01-22 00:51:52.000000000 +0100
4 @@ -74,6 +74,11 @@
5 } while (isdigit(*fmt));
6 }
7
8 + /* skip white spaces like scanf does */
9 + if (strchr("difuoxX", *fmt))
10 + while (isspace(*buf))
11 + buf++;
12 +
13 /* FIXME: we should check afterward:
14 * if (start == buf || start == '-' && buf-start == 1)
15 * die("WTF??? zero-length number???");
16 @@ -150,27 +155,22 @@
17 buf++, length--;
18 }
19
20 - /* ignore if value not found */
21 - if(value == 0)
22 - return 0;
23 -
24 if (!ignore)
25 - counter[i++]->value = valuedup(value);
26 + counter[i++]->value = strndup(start, buf - start);
27 break;
28
29 case 'c':
30 + if (length < 0)
31 + length = 1; // default length is 1
32 +
33 while (*buf && length > 0) {
34 buf++, length--;
35 }
36 if (length > 0)
37 return 2;
38
39 - /* ignore if value not found */
40 - if(value == 0)
41 - return 0;
42 -
43 if (!ignore)
44 - counter[i++]->value = valuedup(value);
45 + counter[i++]->value = strndup(start, buf - start);
46 break;
47
48
49 @@ -192,7 +192,7 @@
50 case '\f':
51 case '\v':
52 /* don't match if not at least one space */
53 - if(!isspace(*(buf)))
54 + if(!isspace(*buf))
55 return 0;
56 else
57 buf++;
58 @@ -208,7 +208,7 @@
59 case '\v':
60 break;
61 default:
62 - while (isspace(*(buf)))
63 + while (isspace(*buf))
64 buf++;
65 }
66 fmt++;