1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
*** 1.14 1995/04/08 21:29:53
--- faxd/ClassModem.c++ 1995/06/21 14:44:41
***************
*** 910,915 ****
--- 910,919 ----
* the syntax specified in the "standard". Try looking
* at some of the responses given by rev ~4.04 of the
* ZyXEL firmware (for example)!
+ *
+ * NB: We accept alphanumeric items but don't return them
+ * in the parsed range so that modems like the ZyXEL 2864
+ * that indicate they support ``Class Z'' are handled.
*/
fxBool
ClassModem::vparseRange(const char* cp, int nargs ... )
***************
*** 926,935 ****
matchc = CPAREN;
acceptList = TRUE;
cp++;
! } else if (isdigit(cp[0])) { // <item>
matchc = COMMA;
acceptList = (nargs == 0);
! } else {
b = FALSE;
break;
}
--- 930,939 ----
matchc = CPAREN;
acceptList = TRUE;
cp++;
! } else if (isalnum(cp[0])) { // <item>
matchc = COMMA;
acceptList = (nargs == 0);
! } else { // skip to comma
b = FALSE;
break;
}
***************
*** 939,952 ****
cp++;
continue;
}
! if (!isdigit(cp[0])) {
b = FALSE;
goto done;
}
! int v = 0;
! do {
! v = v*10 + (cp[0] - '0');
! } while (isdigit((++cp)[0]));
int r = v;
if (cp[0] == '-') { // <low>-<high>
cp++;
--- 943,963 ----
cp++;
continue;
}
! if (!isalnum(cp[0])) {
b = FALSE;
goto done;
}
! int v;
! if (isdigit(cp[0])) {
! v = 0;
! do {
! v = v*10 + (cp[0] - '0');
! } while (isdigit((++cp)[0]));
! } else {
! v = -1; // XXX skip item below
! while (isalnum((++cp)[0]))
! ;
! }
int r = v;
if (cp[0] == '-') { // <low>-<high>
cp++;
***************
*** 964,972 ****
cp++;
v++, r++; // XXX 2.0 -> 3
}
! // expand range or list
! for (; v <= r; v++)
! mask |= 1<<v;
if (acceptList && cp[0] == COMMA) // (<item>,<item>...)
cp++;
}
--- 975,984 ----
cp++;
v++, r++; // XXX 2.0 -> 3
}
! if (v != -1) { // expand range or list
! for (; v <= r; v++)
! mask |= 1<<v;
! }
if (acceptList && cp[0] == COMMA) // (<item>,<item>...)
cp++;
}
|