From 791e11a084882f69e1e7373c80024d3f78b10baa Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Fri, 22 Jun 2001 09:44:06 +0000 Subject: 15021: new %y character; %l semantic back --- ChangeLog | 3 +++ Doc/Zsh/prompt.yo | 7 ++++++- Src/prompt.c | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3ffd99172..4db9eebac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2001-06-22 Andrej Borsenkow + * 15021: Src/prompt.c, Doc/Zsh/prompt.yo: revert to old %l + semantic; add new %y character instead as suggested by Wayne + * 15038: Test/A01grammar.ztst: test case for 15023. (unposted) fix a couple of typos in test decriptions diff --git a/Doc/Zsh/prompt.yo b/Doc/Zsh/prompt.yo index e486b29c4..80fd736c3 100644 --- a/Doc/Zsh/prompt.yo +++ b/Doc/Zsh/prompt.yo @@ -120,7 +120,12 @@ tt(%K)/tt(%L) correspond to tt(%k)/tt(%l) for the hour of the day (24/12 hour clock) in the same way. ) item(tt(%l))( -The line (tty) the user is logged in on. +The line (tty) the user is logged in on without tt(/dev/) prefix. +If name starts with tt(/dev/tty) this is stripped. +) +item(tt(%y))( +The line (tty) the user is logged in on without tt(/dev/) prefix. +It does not treat tt(/dev/tty*) specially. ) item(tt(%?))( The return code of the last command executed just before the prompt. diff --git a/Src/prompt.c b/Src/prompt.c index 47c8af797..d5df9d1ce 100644 --- a/Src/prompt.c +++ b/Src/prompt.c @@ -514,6 +514,14 @@ putpromptchar(int doprint, int endchar) stradd(get_username()); break; case 'l': + if (*ttystrname) { + ss = (strncmp(ttystrname, "/dev/tty", 8) ? + ttystrname + 5 : ttystrname + 8); + stradd(ss); + } else + stradd("()"); + break; + case 'y': if (*ttystrname) { ss = (strncmp(ttystrname, "/dev/", 5) ? ttystrname : ttystrname + 5); -- cgit 1.4.1