continue;
if (strpbrk(name, " \t"))
continue;
-#if 0 /* XXX untested, and needs rewrite with fewer goto's :-) */
-/*
- (state, char_type) -> (state, action)
-
- state: unquoted, single_quoted, double_quoted, escaped, double_quoted_escaped
- char_type: normal, white, backslash, single, double
- action: remove_curr, remove_curr_skip_next, remove_prev, finish XXX
-*/
- no_quote:
- if (*cp == '\\') {
- /* remove the backslash */
- remove_char (cp);
- /* skip over the next character */
- if (*cp)
- cp++;
- goto no_quote;
- } else if (*cp == '\'') {
- /* remove the quote */
- remove_char (cp);
- /* now within single quotes */
- goto s_quote;
- } else if (*cp == '"') {
- /* remove the quote */
- remove_char (cp);
- /* now within double quotes */
- goto d_quote;
- } else if (*cp == '\0') {
- /* end of string */
- goto finished;
- } else if (isspace (*cp)) {
- /* unescaped whitespace - end of string */
- stpcpy(cp, "");
- goto finished;
- } else {
- cp++;
- goto no_quote;
- }
- s_quote:
- if (*cp == '\'') {
- /* remove the quote */
- remove_char (cp);
- /* unquoted again */
- goto no_quote;
- } else if (*cp == '\0') {
- /* end of string */
- goto finished;
- } else {
- /* preserve everything within single quotes */
- cp++;
- goto s_quote;
- }
- d_quote:
- if (*cp == '\"') {
- /* remove the quote */
- remove_char (cp);
- /* unquoted again */
- goto no_quote;
- } else if (*cp == '\\') {
- cp++;
- /* if backslash followed by double quote, remove backslash
- else skip over the backslash and following char */
- if (*cp == '"')
- remove_char (cp - 1);
- else if (*cp)
- cp++;
- goto d_quote;
- }
- else if (*cp == '\0') {
- /* end of string */
- goto finished;
- } else {
- /* preserve everything within double quotes */
- goto d_quote;
- }
- finished:
-#endif /* 0 */
/*
* XXX - should handle quotes, backslash escapes, etc.
* like the shell does.