From: Trent Huber Date: Fri, 28 Nov 2025 06:28:59 +0000 (-0500) Subject: Fix bug in verbose quoting X-Git-Url: https://trenthuber.com/code?a=commitdiff_plain;h=620440426c2f4df7fa4f821e43d701bfd6c08c07;p=thus.git Fix bug in verbose quoting --- diff --git a/src/utils.c b/src/utils.c index a59c0b7..6665eaa 100644 --- a/src/utils.c +++ b/src/utils.c @@ -109,6 +109,7 @@ char *quoted(char *token) { DOUBLE, SINGLE, ESCAPEDOUBLE, + ANY, } degree; static char buffer[MAXCHARS + 1]; @@ -128,17 +129,18 @@ char *quoted(char *token) { case '|': case ';': case ' ': - if (degree < DOUBLE) degree = DOUBLE; + degree |= ANY; break; case '$': case '~': case '"': - if (degree < SINGLE) degree = SINGLE; + degree |= SINGLE; break; case '\'': - if (degree == NONE || degree == SINGLE) ++degree; + degree |= DOUBLE; } if (degree == NONE) return token; + degree = degree == ANY ? DOUBLE : degree & ~ANY; quote = degree == SINGLE ? '\'' : '"'; p = buffer;