looks in table for strings of format << "key" = "value"; >> or << "key"; >>
| 147 | // looks in table for strings of format << "key" = "value"; >> |
| 148 | // or << "key"; >> |
| 149 | BOOL getValueForStringTableKey(char *table, char *key, char **val, INTN *size) |
| 150 | { |
| 151 | INTN keyLength; |
| 152 | char *tableKey; |
| 153 | |
| 154 | do |
| 155 | { |
| 156 | eatThru('\"',&table); |
| 157 | tableKey = table; |
| 158 | keyLength = strlen(key); |
| 159 | if (keyLength && |
| 160 | (stringLength(table,1) == keyLength) && |
| 161 | (keyncmp(key, table, keyLength) == 0)) |
| 162 | { |
| 163 | INTN c; |
| 164 | |
| 165 | /* found the key; now look for either |
| 166 | * '=' or ';' |
| 167 | */ |
| 168 | while (c = *table) { |
| 169 | ++table; |
| 170 | if (c == '\\') { |
| 171 | ++table; |
| 172 | continue; |
| 173 | } else if (c == '=' || c == ';') { |
| 174 | break; |
| 175 | } |
| 176 | } |
| 177 | if (c == ';') { |
| 178 | table = tableKey; |
| 179 | } else { |
| 180 | eatThru('\"',&table); |
| 181 | } |
| 182 | *val = table; |
| 183 | *size = stringLength(table,0); |
| 184 | return YES; |
| 185 | } |
| 186 | |
| 187 | eatThru(';',&table); |
| 188 | |
| 189 | } while (*table); |
| 190 | |
| 191 | return NO; |
| 192 | } |
| 193 | |
| 194 | |
| 195 | /* |
no test coverage detected