summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2021-01-17 16:17:42 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2021-01-17 16:17:42 +0000
commit478b033c5d8589ae0130378cc620e9344c9d59af (patch)
treebbb71dc0d4a18a081bb39effd1c122b94b1c2e6d /usr.bin
parentf88988a59b357d87a83a21be7bad123a853668ff (diff)
Add -N flag to never start server even if command would normally do so,
GitHub issue 2523.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/client.c4
-rw-r--r--usr.bin/tmux/tmux.19
-rw-r--r--usr.bin/tmux/tmux.c9
-rw-r--r--usr.bin/tmux/tmux.h4
4 files changed, 18 insertions, 8 deletions
diff --git a/usr.bin/tmux/client.c b/usr.bin/tmux/client.c
index 0bf1e4e85ab..defce19af20 100644
--- a/usr.bin/tmux/client.c
+++ b/usr.bin/tmux/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.150 2020/10/30 18:54:23 nicm Exp $ */
+/* $OpenBSD: client.c,v 1.151 2021/01/17 16:17:41 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -127,6 +127,8 @@ retry:
log_debug("connect failed: %s", strerror(errno));
if (errno != ECONNREFUSED && errno != ENOENT)
goto failed;
+ if (flags & CLIENT_NOSTARTSERVER)
+ goto failed;
if (~flags & CLIENT_STARTSERVER)
goto failed;
close(fd);
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index 859717d090b..e4033d66984 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.810 2021/01/04 08:43:16 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.811 2021/01/17 16:17:41 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 4 2021 $
+.Dd $Mdocdate: January 17 2021 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -191,6 +191,11 @@ directories are missing).
Behave as a login shell.
This flag currently has no effect and is for compatibility with other shells
when using tmux as a login shell.
+.It Fl N
+Do not start the server even if the command would normally do so (for example
+.Ic new-session
+or
+.Ic start-server ) .
.It Fl S Ar socket-path
Specify a full alternative path to the server socket.
If
diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c
index f9ead52c55c..518d784c1d5 100644
--- a/usr.bin/tmux/tmux.c
+++ b/usr.bin/tmux/tmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.c,v 1.203 2020/09/22 05:23:34 nicm Exp $ */
+/* $OpenBSD: tmux.c,v 1.204 2021/01/17 16:17:41 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -57,7 +57,7 @@ static __dead void
usage(void)
{
fprintf(stderr,
- "usage: %s [-2CDluvV] [-c shell-command] [-f file] [-L socket-name]\n"
+ "usage: %s [-2CDlNuvV] [-c shell-command] [-f file] [-L socket-name]\n"
" [-S socket-path] [-T features] [command [flags]]\n",
getprogname());
exit(1);
@@ -350,7 +350,7 @@ main(int argc, char **argv)
if (**argv == '-')
flags = CLIENT_LOGIN;
- while ((opt = getopt(argc, argv, "2c:CDdf:lL:qS:T:uUvV")) != -1) {
+ while ((opt = getopt(argc, argv, "2c:CDdf:lL:NqS:T:uUvV")) != -1) {
switch (opt) {
case '2':
tty_add_features(&feat, "256", ":,");
@@ -380,6 +380,9 @@ main(int argc, char **argv)
free(label);
label = xstrdup(optarg);
break;
+ case 'N':
+ flags |= CLIENT_NOSTARTSERVER;
+ break;
case 'q':
break;
case 'S':
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 0d220a5ebc9..f5290a5e785 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.1083 2021/01/08 10:09:44 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.1084 2021/01/17 16:17:41 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1635,7 +1635,7 @@ struct client {
#define CLIENT_DEAD 0x200
#define CLIENT_REDRAWBORDERS 0x400
#define CLIENT_READONLY 0x800
-/* 0x1000 unused */
+#define CLIENT_NOSTARTSERVER 0x1000
#define CLIENT_CONTROL 0x2000
#define CLIENT_CONTROLCONTROL 0x4000
#define CLIENT_FOCUSED 0x8000