Rev 7282 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
7746 | leency | 1 | bool GetNextParam() |
4411 | leency | 2 | { |
7282 | leency | 3 | byte quotes = NULL; |
4 | int i; |
||
5 | |||
6 | if (!tagparam) return false; |
||
7 | |||
8 | if (debug_mode) { |
||
9 | debug("tagparam: "); debugln(#tagparam); |
||
10 | } |
||
11 | |||
12 | i = strlen(#tagparam) - 1; |
||
13 | |||
14 | if (tagparam[i] == '/') i--; |
||
15 | |||
16 | while (i>0) && (__isWhite(tagparam[i])) i--; |
||
17 | |||
18 | if (tagparam[i] == '"') || (tagparam[i] == '\'') |
||
19 | { |
||
20 | //find VAL end |
||
21 | quotes = tagparam[i]; |
||
22 | tagparam[i] = '\0'; i--; |
||
23 | |||
24 | //find VAL start and copy |
||
25 | i = strrchr(#tagparam, quotes); |
||
26 | strlcpy(#val, #tagparam + i, sizeof(val)); |
||
27 | tagparam[i] = '\0'; i--; |
||
28 | |||
29 | //find ATTR end |
||
30 | while (i > 0) && (tagparam[i] != '=') i--; |
||
31 | tagparam[i+1] = '\0'; |
||
32 | } |
||
33 | else |
||
34 | { |
||
35 | //find VAL end |
||
36 | //already have |
||
37 | |||
38 | //find VAL start and copy |
||
39 | while (i > 0) && (tagparam[i] != '=') i--; |
||
40 | i++; |
||
41 | strlcpy(#val, #tagparam + i, sizeof(val)); |
||
42 | tagparam[i] = '\0'; |
||
43 | |||
44 | //find ATTR end |
||
45 | //already have |
||
46 | } |
||
47 | |||
48 | //find ATTR start and copy |
||
49 | while (i>0) && (!__isWhite(tagparam[i])) i--; |
||
50 | strlcpy(#attr, #tagparam + i + 1, sizeof(attr)); |
||
51 | tagparam[i] = '\0'; |
||
52 | |||
53 | strlwr(#attr); |
||
54 | |||
55 | if (debug_mode) { |
||
56 | if (quotes) { |
||
57 | debug("quote: "); debugch(quotes); debugln(" "); |
||
58 | } |
||
59 | else { |
||
60 | debugln("unquoted text"); |
||
61 | } |
||
62 | sprintf(#param, "val: %s\nattr: %s\n\n", #val, #attr); |
||
63 | debug(#param); |
||
64 | } |
||
65 | |||
66 | return true; |
||
67 | } |
||
68 |