summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2011-04-24 21:32:07 +0000
committernicm <nicm@openbsd.org>2011-04-24 21:32:07 +0000
commit9eb504ef515790c90369fb9a006cd57a9ca9d9a3 (patch)
tree1016eaa23fc5a655e6d99b446940287aa3cea2c9
parentTweak copy behaviour slightly in vi mode to be closer to real vi. From (diff)
downloadwireguard-openbsd-9eb504ef515790c90369fb9a006cd57a9ca9d9a3.tar.xz
wireguard-openbsd-9eb504ef515790c90369fb9a006cd57a9ca9d9a3.zip
Provide #h for short hostname (no domain) from Michal Mazurek.
-rw-r--r--usr.bin/tmux/status.c9
-rw-r--r--usr.bin/tmux/tmux.15
2 files changed, 11 insertions, 3 deletions
diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c
index 92cd897e8c7..81675b897d9 100644
--- a/usr.bin/tmux/status.c
+++ b/usr.bin/tmux/status.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: status.c,v 1.73 2011/04/18 19:49:05 nicm Exp $ */
+/* $OpenBSD: status.c,v 1.74 2011/04/24 21:32:07 nicm Exp $ */
/*
* 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");
ptr = tmp;
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':
xsnprintf(tmp, sizeof tmp, "%d", wl->idx);
ptr = tmp;
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index e2de339f668..b5388e49587 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.223 2011/04/19 21:31:33 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.224 2011/04/24 21:32:07 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" 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
.Os
.Sh NAME
@@ -2005,6 +2005,7 @@ may contain any of the following special character sequences:
.It Li "#(shell-command)" Ta "First line of the command's output"
.It Li "#[attributes]" Ta "Colour or attribute change"
.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 "#I" Ta "Current window index"
.It Li "#P" Ta "Current pane index"