'\W' in PS1 returned an empty string for the root directory. bash displays '/' in similar circumstances.
Avoid returning an empty string for the directory. function old new delta parse_and_put_prompt 870 880 +10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 10/0) Total: 10 bytes Signed-off-by: Ron Yorston <[email protected]> --- libbb/lineedit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 10cc0433b..1ca21e924 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -2079,7 +2079,7 @@ static void parse_and_put_prompt(const char *prmt_ptr) if (c == 'w') break; cp = strrchr(pbuf, '/'); - if (cp) + if (cp && cp[1]) pbuf = (char*)cp + 1; break; // bb_process_escape_sequence does this now: -- 2.50.1 _______________________________________________ busybox mailing list [email protected] https://lists.busybox.net/mailman/listinfo/busybox
