From bb128070e590234f8b63fb1d67f7621a1b4b3ff3 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Fri, 10 May 2024 14:32:45 +0100 Subject: ash: -X option shouldn't alter environment variables When a shell was started with the -X option, environment variables had forward slashes changed to backslashes. This is unnecessary and counterproductive. Adjust how the state of winxp is handled to avoid this. (GitHub issue #415) --- shell/ash.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shell/ash.c b/shell/ash.c index fd09e7662..b753678c0 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -2944,11 +2944,11 @@ listvars(int on, int off, struct strlist *lp, char ***end) static void setwinxp(int on) { - static smallint is_winxp; + static smallint is_winxp = 1; struct var **vpp; struct var *vp; - if (++on == is_winxp) + if (on == is_winxp) return; is_winxp = on; @@ -2959,7 +2959,7 @@ setwinxp(int on) if (!end || is_prefixed_with(vp->var_text, "COMSPEC=") || is_prefixed_with(vp->var_text, "SYSTEMROOT=")) continue; - if (!winxp) + if (!on) bs_to_slash(end + 1); else slash_to_bs(end + 1); -- cgit v1.2.3-55-g6feb