From 9b076198627c9abbe91ca28724f457ac18caf8e5 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Mon, 2 Dec 2019 01:43:55 -0500 Subject: Fix \? prompt expansion for more than one digit --- bin/1sh/parser.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'bin/1sh') diff --git a/bin/1sh/parser.c b/bin/1sh/parser.c index 39b36e67..a7b86aab 100644 --- a/bin/1sh/parser.c +++ b/bin/1sh/parser.c @@ -2042,10 +2042,12 @@ expandprompt(const char *fmt) { * Exit status if non-zero. */ case '?': - if (exitstatus != 0) + if (exitstatus != 0) { snprintf(&ps[i], PROMPTLEN - i, "%d", exitstatus); - else - i--; + while (ps[i] != '\0') + i++; + } + i--; break; /* -- cgit 1.4.1