=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/tmux.c,v retrieving revision 1.190 retrieving revision 1.191 diff -u -r1.190 -r1.191 --- src/usr.bin/tmux/tmux.c 2019/10/14 08:38:07 1.190 +++ src/usr.bin/tmux/tmux.c 2020/01/28 10:44:30 1.191 @@ -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 @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -212,6 +213,20 @@ 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 @@ 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 @@ case 'f': set_cfg_file(optarg); break; + case 'V': + printf("%s %s\n", getprogname(), getversion()); + exit(0); case 'l': flags |= CLIENT_LOGIN; break;