From fa44f94313d04afe440f58e233347b8fa4c78605 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Wed, 20 Nov 2019 21:46:01 -0500 Subject: Add \? exit status prompt expansion --- bin/1sh/parser.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'bin/1sh/parser.c') 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 @@ -2038,6 +2038,16 @@ expandprompt(const char *fmt) { --i; break; + /* + * Exit status if non-zero. + */ + case '?': + if (exitstatus != 0) + snprintf(&ps[i], PROMPTLEN - i, "%d", exitstatus); + else + i--; + break; + /* * Superuser status. * -- cgit 1.4.1 ptgroup label='branches'> dontfiles
summary refs log tree commit diff
path: root/home/.mkshrc (unfollow)
Commit message (Collapse)Author
2018-09-07Add In for a World of HurtJune McEnroe
2018-09-05Use tabs in READMEJune McEnroe
2018-09-05Remove disown from READMEJune McEnroe
2018-09-05Factor out pixelBits, pixelSize in glitchJune McEnroe
2018-09-05Factor out pixelBits, pixelSize in pngoJune McEnroe
2018-09-05Zero after mirrorJune McEnroe
2018-09-05Simplify glitch -x -y to just zeroJune McEnroe
2018-09-05Add glitch -x and -yJune McEnroe
2018-09-04Add glitch -i to READMEJune McEnroe
2018-09-04Add -i invert option to glitchJune McEnroe
2018-09-02malloc IDAT chunks in pngo and glitchJune McEnroe
2018-09-02Use PascalCase for constants in gfxJune McEnroe
2018-09-02Use PascalCase for constantsJune McEnroe
Get outta here, underscores.
2018-09-02Remove colorcolumn at 100June McEnroe
2018-09-02Install bc(1) on ArchJune McEnroe
2018-09-02SendEnv LANGJune McEnroe
2018-08-27Add New Order — TemptationJune McEnroe
2018-08-26Add NetBSD to install.shJune McEnroe
2018-08-24Show hostname in title over SSHJune McEnroe
2018-08-23Alias bc='bc -l'June McEnroe
2018-08-20Update usage of scheme in READMEJune McEnroe
2018-08-20Use scheme.h in fbatt and fbclockJune McEnroe
2018-08-20Generate scheme.hJune McEnroe
2018-08-20Add dependencies on gfx.hJune McEnroe
2018-08-18Add Blondie — Heart of GlassJune McEnroe
Why didn't I know about this song? I love it.
2018-08-18Set FCEDIT=$EDITORJune McEnroe
2018-08-18Only post commits with bodies to MastodonJune McEnroe
2018-08-18Run tf/cfg link script with /bin/shJune McEnroe
2018-08-18Run {,s,t}up with /bin/shJune McEnroe
2018-08-18Use whence instead of typeJune McEnroe
type is an alias for whence -v and is more for human consumption.
2018-08-18Cut off path components until right prompt fitsJune McEnroe
Keeps paths valid (from somehwere) rather than abrupt truncation.
2018-08-17Add "private" alias to source encrypted fileJune McEnroe
Why is there no easy way to *edit* an encrypted file?
2018-08-17Add vim mapping to add a #includeJune McEnroe