From 94fb742a93db0c57b0f2cb42c04d55df425d4286 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Mon, 9 Mar 2020 19:27:15 -0400 Subject: Add \? exit status prompt expansion --- bin/1sh/1sh.1 | 2 ++ bin/1sh/parser.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/bin/1sh/1sh.1 b/bin/1sh/1sh.1 index 9bbd881b..d72a87c7 100644 --- a/bin/1sh/1sh.1 +++ b/bin/1sh/1sh.1 @@ -1427,6 +1427,8 @@ This system's hostname. The final component of the current working directory. .It Li \ew The entire path of the current working directory. +.It Li \e? +Exit status if it is non-zero, empty string otherwise. .It Li \e$ Superuser status. .Dq Li "$ " diff --git a/bin/1sh/parser.c b/bin/1sh/parser.c index 3f73220f..1038aa43 100644 --- a/bin/1sh/parser.c +++ b/bin/1sh/parser.c @@ -2038,6 +2038,18 @@ expandprompt(const char *fmt) { --i; break; + /* + * Exit status if non-zero. + */ + case '?': + if (exitstatus != 0) { + snprintf(&ps[i], PROMPTLEN - i, "%d", exitstatus); + while (ps[i] != '\0') + i++; + } + i--; + break; + /* * Superuser status. * -- cgit 1.4.1 p;id=2ef4edee19c3f935dfffc3e0f4a56f5e2f183fa4'>refs log tree commit diff
path: root/cgit.mk (unfollow)
Commit message (Expand)Author
2015-08-13redirect: cleanlinessJason A. Donenfeld
2015-08-13redirect: be more careful for different cgi setupsJason A. Donenfeld
2015-08-12ui-log: fix double countingJohn Keeping
2015-08-12log: allow users to follow a fileJohn Keeping
2015-08-12shared: make cgit_diff_tree_cb publicJohn Keeping
2015-08-12t0110: Chain together using &&Jason A. Donenfeld
2015-08-12about: always ensure page has a trailing slashJason A. Donenfeld
2015-08-12filters: apply HTML escapingLazaros Koromilas
2015-08-12git: update to v2.5.0Christian Hesse
2015-08-12Fix processing of repo.hide and repo.ignoreDaniel Reichelt