]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/setupenv.c: Remove code wrapped in '#if 0'
authorAlejandro Colomar <alx@kernel.org>
Sat, 3 Jan 2026 23:21:04 +0000 (00:21 +0100)
committerSerge Hallyn <serge@hallyn.com>
Fri, 20 Feb 2026 00:53:42 +0000 (18:53 -0600)
This has not been tested in a long time --if ever--.

If we ever want to implement something, we should start from scratch.
But if we've survived for so long without it, I suspect we don't want
it at all.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/setupenv.c

index 263221636d2b53d09767f1db7564999d83502359..43acae2a6f94478a90b306f7eb7ecbe46a8e0b8c 100644 (file)
@@ -76,82 +76,6 @@ static void read_env_file (const char *filename)
                        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.