Sync OpenBSD patchset 898:

Provide #h for short hostname (no domain) from Michal Mazurek.
This commit is contained in:
Tiago Cunha 2011-04-25 20:35:22 +00:00
parent 38611d3207
commit 341f67e827
2 changed files with 11 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $Id: status.c,v 1.158 2011-04-18 21:07:58 nicm Exp $ */ /* $Id: status.c,v 1.159 2011-04-25 20:35:22 tcunha Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -410,6 +410,13 @@ status_replace1(struct client *c, struct session *s, struct winlink *wl,
fatal("gethostname failed"); fatal("gethostname failed");
ptr = tmp; ptr = tmp;
goto do_replace; goto do_replace;
case 'h':
if (gethostname(tmp, sizeof tmp) != 0)
fatal("gethostname failed");
if ((ptr = strchr(tmp, '.')) != NULL)
*ptr = '\0';
ptr = tmp;
goto do_replace;
case 'I': case 'I':
xsnprintf(tmp, sizeof tmp, "%d", wl->idx); xsnprintf(tmp, sizeof tmp, "%d", wl->idx);
ptr = tmp; ptr = tmp;

5
tmux.1
View File

@ -1,4 +1,4 @@
.\" $Id: tmux.1,v 1.309 2011-04-25 20:33:42 tcunha Exp $ .\" $Id: tmux.1,v 1.310 2011-04-25 20:35:22 tcunha Exp $
.\" .\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> .\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\" .\"
@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" .\"
.Dd $Mdocdate: April 19 2011 $ .Dd $Mdocdate: April 24 2011 $
.Dt TMUX 1 .Dt TMUX 1
.Os .Os
.Sh NAME .Sh NAME
@ -2009,6 +2009,7 @@ may contain any of the following special character sequences:
.It Li "#(shell-command)" Ta "First line of the command's output" .It Li "#(shell-command)" Ta "First line of the command's output"
.It Li "#[attributes]" Ta "Colour or attribute change" .It Li "#[attributes]" Ta "Colour or attribute change"
.It Li "#H" Ta "Hostname of local host" .It Li "#H" Ta "Hostname of local host"
.It Li "#h" Ta "Hostname of local host without the domain name"
.It Li "#F" Ta "Current window flag" .It Li "#F" Ta "Current window flag"
.It Li "#I" Ta "Current window index" .It Li "#I" Ta "Current window index"
.It Li "#P" Ta "Current pane index" .It Li "#P" Ta "Current pane index"