mirror of
https://github.com/tmux/tmux.git
synced 2025-09-08 04:18:19 +00:00
Reduce a difference with portable tmux by adding the -V flag and
#{version} format; on OpenBSD these just report the OpenBSD version.
This commit is contained in:
1
format.c
1
format.c
@@ -1106,6 +1106,7 @@ format_create(struct client *c, struct cmdq_item *item, int tag, int flags)
|
|||||||
ft->flags = flags;
|
ft->flags = flags;
|
||||||
ft->time = time(NULL);
|
ft->time = time(NULL);
|
||||||
|
|
||||||
|
format_add(ft, "version", "%s", getversion());
|
||||||
format_add_cb(ft, "host", format_cb_host);
|
format_add_cb(ft, "host", format_cb_host);
|
||||||
format_add_cb(ft, "host_short", format_cb_host_short);
|
format_add_cb(ft, "host_short", format_cb_host_short);
|
||||||
format_add_cb(ft, "pid", format_cb_pid);
|
format_add_cb(ft, "pid", format_cb_pid);
|
||||||
|
4
proc.c
4
proc.c
@@ -182,8 +182,8 @@ proc_start(const char *name)
|
|||||||
if (uname(&u) < 0)
|
if (uname(&u) < 0)
|
||||||
memset(&u, 0, sizeof u);
|
memset(&u, 0, sizeof u);
|
||||||
|
|
||||||
log_debug("%s started (%ld): socket %s, protocol %d", name,
|
log_debug("%s started (%ld): version %s, socket %s, protocol %d", name,
|
||||||
(long)getpid(), socket_path, PROTOCOL_VERSION);
|
(long)getpid(), getversion(), socket_path, PROTOCOL_VERSION);
|
||||||
log_debug("on %s %s %s; libevent %s (%s)", u.sysname, u.release,
|
log_debug("on %s %s %s; libevent %s (%s)", u.sysname, u.release,
|
||||||
u.version, event_get_version(), event_get_method());
|
u.version, event_get_version(), event_get_method());
|
||||||
|
|
||||||
|
8
tmux.1
8
tmux.1
@@ -23,7 +23,7 @@
|
|||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm tmux
|
.Nm tmux
|
||||||
.Bk -words
|
.Bk -words
|
||||||
.Op Fl 2Cluv
|
.Op Fl 2CluvV
|
||||||
.Op Fl c Ar shell-command
|
.Op Fl c Ar shell-command
|
||||||
.Op Fl f Ar file
|
.Op Fl f Ar file
|
||||||
.Op Fl L Ar socket-name
|
.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
|
server process to toggle logging between on (as if
|
||||||
.Fl v
|
.Fl v
|
||||||
was given) and off.
|
was given) and off.
|
||||||
|
.It Fl V
|
||||||
|
Report the
|
||||||
|
.Nm
|
||||||
|
version.
|
||||||
|
.Pp
|
||||||
.It Ar command Op Ar flags
|
.It Ar command Op Ar flags
|
||||||
This specifies one of a set of commands used to control
|
This specifies one of a set of commands used to control
|
||||||
.Nm ,
|
.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 "session_windows" Ta "" Ta "Number of windows in session"
|
||||||
.It Li "socket_path" Ta "" Ta "Server socket path"
|
.It Li "socket_path" Ta "" Ta "Server socket path"
|
||||||
.It Li "start_time" Ta "" Ta "Server start time"
|
.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" Ta "" Ta "1 if window active"
|
||||||
.It Li "window_active_clients" Ta "" Ta "Number of clients viewing this window"
|
.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"
|
.It Li "window_active_clients_list" Ta "" Ta "List of clients viewing this window"
|
||||||
|
20
tmux.c
20
tmux.c
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <sys/utsname.h>
|
||||||
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -212,6 +213,20 @@ find_home(void)
|
|||||||
return (home);
|
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
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@@ -238,7 +253,7 @@ main(int argc, char **argv)
|
|||||||
flags = 0;
|
flags = 0;
|
||||||
|
|
||||||
label = path = NULL;
|
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) {
|
switch (opt) {
|
||||||
case '2':
|
case '2':
|
||||||
flags |= CLIENT_256COLOURS;
|
flags |= CLIENT_256COLOURS;
|
||||||
@@ -255,6 +270,9 @@ main(int argc, char **argv)
|
|||||||
case 'f':
|
case 'f':
|
||||||
set_cfg_file(optarg);
|
set_cfg_file(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'V':
|
||||||
|
printf("%s %s\n", getprogname(), getversion());
|
||||||
|
exit(0);
|
||||||
case 'l':
|
case 'l':
|
||||||
flags |= CLIENT_LOGIN;
|
flags |= CLIENT_LOGIN;
|
||||||
break;
|
break;
|
||||||
|
1
tmux.h
1
tmux.h
@@ -1769,6 +1769,7 @@ int areshell(const char *);
|
|||||||
void setblocking(int, int);
|
void setblocking(int, int);
|
||||||
const char *find_cwd(void);
|
const char *find_cwd(void);
|
||||||
const char *find_home(void);
|
const char *find_home(void);
|
||||||
|
const char *getversion(void);
|
||||||
|
|
||||||
/* proc.c */
|
/* proc.c */
|
||||||
struct imsg;
|
struct imsg;
|
||||||
|
Reference in New Issue
Block a user