summaryrefslogtreecommitdiffstats
path: root/tmux.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2020-01-28 11:17:08 +0000
committerThomas Adam <thomas@xteddy.org>2020-01-28 11:17:08 +0000
commitee3d3db364b6c2469c1acaa88bb64341090d3af1 (patch)
treed3dcea5e527c32fa9948be6c74aa8bcbd8779970 /tmux.c
parent7cdf5ee9bc2fa114a7d830b73e2088d1a2dc5174 (diff)
parentf165221dc4641837ee9f589bb666d310a495904c (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'tmux.c')
-rw-r--r--tmux.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/tmux.c b/tmux.c
index c8a5a44e..b5cdfbf9 100644
--- a/tmux.c
+++ b/tmux.c
@@ -18,6 +18,7 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/utsname.h>
#include <errno.h>
#include <event.h>
@@ -209,6 +210,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)
{
@@ -235,7 +250,7 @@ main(int argc, char **argv)
flags = 0;
label = path = NULL;
- while ((opt = getopt(argc, argv, "2c:Cdf:lL:qS:uUVv")) != -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;