Return a pointer to the end of a valid ${VARNAME} string, or NULL. 'str' should point to the '$' character. First letter in VARNAME must be alpha or underscore, rest of letters are alnum or underscore. Any other character is an error. */
| 209 | rest of letters are alnum or underscore. |
| 210 | Any other character is an error. */ |
| 211 | ATTRIBUTE_PURE |
| 212 | static char const * |
| 213 | scan_varname (char const *str) |
| 214 | { |
| 215 | if (str[1] == '{' && (c_isalpha (str[2]) || str[2] == '_')) |
| 216 | { |
| 217 | char const *end = str + 3; |
| 218 | while (c_isalnum (*end) || *end == '_') |
| 219 | ++end; |
| 220 | if (*end == '}') |
| 221 | return end; |
| 222 | } |
| 223 | |
| 224 | return NULL; |
| 225 | } |
| 226 | |
| 227 | /* Return a pointer to a static buffer containing the VARNAME as |
| 228 | extracted from a '${VARNAME}' string. |