summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-01-28 10:44:30 +0000
committernicm <nicm@openbsd.org>2020-01-28 10:44:30 +0000
commit55bde1469dd533868ffb94045630288832b96a01 (patch)
treeab8fbfff92934e79ef65e6196762202efb9327dd
parentParse '==' without error in filters. (diff)
downloadwireguard-openbsd-55bde1469dd533868ffb94045630288832b96a01.tar.xz
wireguard-openbsd-55bde1469dd533868ffb94045630288832b96a01.zip
Reduce a difference with portable tmux by adding the -V flag and
#{version} format; on OpenBSD these just report the OpenBSD version.
-rw-r--r--usr.bin/tmux/format.c3
-rw-r--r--usr.bin/tmux/proc.c6
-rw-r--r--usr.bin/tmux/tmux.112
-rw-r--r--usr.bin/tmux/tmux.c22
-rw-r--r--usr.bin/tmux/tmux.h3
5 files changed, 36 insertions, 10 deletions
diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c
index 07985f12d4a..2b7fb1d7706 100644
--- a/usr.bin/tmux/format.c
+++ b/usr.bin/tmux/format.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: format.c,v 1.223 2020/01/12 21:07:07 nicm Exp $ */
+/* $OpenBSD: format.c,v 1.224 2020/01/28 10:44:30 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1106,6 +1106,7 @@ format_create(struct client *c, struct cmdq_item *item, int tag, int flags)
ft->flags = flags;
ft->time = time(NULL);
+ format_add(ft, "version", "%s", getversion());
format_add_cb(ft, "host", format_cb_host);
format_add_cb(ft, "host_short", format_cb_host_short);
format_add_cb(ft, "pid", format_cb_pid);
diff --git a/usr.bin/tmux/proc.c b/usr.bin/tmux/proc.c
index 82891d27357..2192f0422a7 100644
--- a/usr.bin/tmux/proc.c
+++ b/usr.bin/tmux/proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.c,v 1.15 2017/07/14 18:49:07 nicm Exp $ */
+/* $OpenBSD: proc.c,v 1.16 2020/01/28 10:44:30 nicm Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -182,8 +182,8 @@ proc_start(const char *name)
if (uname(&u) < 0)
memset(&u, 0, sizeof u);
- log_debug("%s started (%ld): socket %s, protocol %d", name,
- (long)getpid(), socket_path, PROTOCOL_VERSION);
+ log_debug("%s started (%ld): version %s, socket %s, protocol %d", name,
+ (long)getpid(), getversion(), socket_path, PROTOCOL_VERSION);
log_debug("on %s %s %s; libevent %s (%s)", u.sysname, u.release,
u.version, event_get_version(), event_get_method());
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index e05867e3b4b..e523e3b1f7a 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.707 2020/01/27 09:04:47 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.708 2020/01/28 10:44:30 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
@@ -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: January 27 2020 $
+.Dd $Mdocdate: January 28 2020 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -23,7 +23,7 @@
.Sh SYNOPSIS
.Nm tmux
.Bk -words
-.Op Fl 2Cluv
+.Op Fl 2CluvV
.Op Fl c Ar shell-command
.Op Fl f Ar file
.Op Fl L Ar socket-name
@@ -210,6 +210,11 @@ signal may be sent to the
server process to toggle logging between on (as if
.Fl v
was given) and off.
+.It Fl V
+Report the
+.Nm
+version.
+.Pp
.It Ar command Op Ar flags
This specifies one of a set of commands used to control
.Nm ,
@@ -4369,6 +4374,7 @@ The following variables are available, where appropriate:
.It Li "session_windows" Ta "" Ta "Number of windows in session"
.It Li "socket_path" Ta "" Ta "Server socket path"
.It Li "start_time" Ta "" Ta "Server start time"
+.It Li "version" Ta "" Ta "Server version"
.It Li "window_active" Ta "" Ta "1 if window active"
.It Li "window_active_clients" Ta "" Ta "Number of clients viewing this window"
.It Li "window_active_clients_list" Ta "" Ta "List of clients viewing this window"
diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c
index 3351e5a3c93..7351dae5756 100644
--- a/usr.bin/tmux/tmux.c
+++ b/usr.bin/tmux/tmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.c,v 1.190 2019/10/14 08:38:07 nicm Exp $ */
+/* $OpenBSD: tmux.c,v 1.191 2020/01/28 10:44:30 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -18,6 +18,7 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/utsname.h>
#include <err.h>
#include <errno.h>
@@ -212,6 +213,20 @@ find_home(void)
return (home);
}
+const char *
+getversion(void)
+{
+ static char *version;
+ struct utsname u;
+
+ if (version == NULL) {
+ if (uname(&u) < 0)
+ fatalx("uname failed");
+ xasprintf(&version, "openbsd-%s", u.release);
+ }
+ return version;
+}
+
int
main(int argc, char **argv)
{
@@ -238,7 +253,7 @@ main(int argc, char **argv)
flags = 0;
label = path = NULL;
- while ((opt = getopt(argc, argv, "2c:Cdf:lL:qS:uUv")) != -1) {
+ while ((opt = getopt(argc, argv, "2c:Cdf:lL:qS:uUvV")) != -1) {
switch (opt) {
case '2':
flags |= CLIENT_256COLOURS;
@@ -255,6 +270,9 @@ main(int argc, char **argv)
case 'f':
set_cfg_file(optarg);
break;
+ case 'V':
+ printf("%s %s\n", getprogname(), getversion());
+ exit(0);
case 'l':
flags |= CLIENT_LOGIN;
break;
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 49df4829f97..69e86c6dec3 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.950 2020/01/28 08:06:11 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.951 2020/01/28 10:44:30 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1769,6 +1769,7 @@ int areshell(const char *);
void setblocking(int, int);
const char *find_cwd(void);
const char *find_home(void);
+const char *getversion(void);
/* proc.c */
struct imsg;