diff options
author | June McEnroe <june@causal.agency> | 2019-11-20 21:46:01 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-11-20 21:46:01 -0500 |
commit | fa44f94313d04afe440f58e233347b8fa4c78605 (patch) | |
tree | 692ee0a3769dba34b365b08415e534eeca3cce4d /bin/1sh/parser.c | |
parent | Remove PSlit (diff) | |
download | src-fa44f94313d04afe440f58e233347b8fa4c78605.tar.gz src-fa44f94313d04afe440f58e233347b8fa4c78605.zip |
Add \? exit status prompt expansion
Diffstat (limited to '')
-rw-r--r-- | bin/1sh/parser.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/1sh/parser.c b/bin/1sh/parser.c index 377ab78f..39b36e67 100644 --- a/bin/1sh/parser.c +++ b/bin/1sh/parser.c @@ -2039,6 +2039,16 @@ expandprompt(const char *fmt) { break; /* + * Exit status if non-zero. + */ + case '?': + if (exitstatus != 0) + snprintf(&ps[i], PROMPTLEN - i, "%d", exitstatus); + else + i--; + break; + + /* * Superuser status. * * '$' for normal users, '#' for root. |