- break;
- case 2: /* Waiting for ) */
- if (c == ')' || c == '}') {
- char envname[CONFIG_SYS_ENV_NAMELEN+1], *envval;
- /* Varname # of chars */
- uint_fast8_t envcnt = input - varname_start - 1;
- if (envcnt > CONFIG_SYS_ENV_NAMELEN)
- envcnt = CONFIG_SYS_ENV_NAMELEN;
-
- memcpy(envname, varname_start, envcnt);
- envname[envcnt] = '\0';
-
- /* Get its value */
- envval = getenv(envname);
-
- /* Copy into the line if it exists */
- if (envval != NULL)
- while ((*envval) && outputcnt) {
- *(output++) = *(envval++);
- outputcnt--;
- }
- /* Look for another '$' */
- state = 0;
- }
- break;
- case 3: /* Waiting for ' */
- if ((c == '\'') && (prev != '\\')) {
- state = 0;
- } else {
- *(output++) = c;
- outputcnt--;
- }
- break;