diff options
author | 2011-04-06 21:51:31 +0000 | |
---|---|---|
committer | 2011-04-06 21:51:31 +0000 | |
commit | e89327513b5a2cfa6237279d23c84af6d654fd02 (patch) | |
tree | 2f047e397d62055da2a48feea41dfbea09cccce8 /usr.bin/tmux/cmd.c | |
parent | Don't enumerate _DOD for attaching acpivout(4), since: (diff) | |
download | wireguard-openbsd-e89327513b5a2cfa6237279d23c84af6d654fd02.tar.xz wireguard-openbsd-e89327513b5a2cfa6237279d23c84af6d654fd02.zip |
Change so that an empty session name always means the current sessions
even if given with, for example, -t '', and explicitly forbid empty
session names and those containing a : when they are created.
Diffstat (limited to 'usr.bin/tmux/cmd.c')
-rw-r--r-- | usr.bin/tmux/cmd.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c index e07ba43ee46..4080b27182b 100644 --- a/usr.bin/tmux/cmd.c +++ b/usr.bin/tmux/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.52 2011/04/05 19:37:01 nicm Exp $ */ +/* $OpenBSD: cmd.c,v 1.53 2011/04/06 21:51:31 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -725,6 +725,12 @@ cmd_find_session(struct cmd_ctx *ctx, const char *arg, int prefer_unattached) if (arglen != 0 && tmparg[arglen - 1] == ':') tmparg[arglen - 1] = '\0'; + /* An empty session name is the current session. */ + if (*tmparg == '\0') { + xfree (tmparg); + return (cmd_current_session(ctx, prefer_unattached)); + } + /* Find the session, if any. */ s = cmd_lookup_session(tmparg, &ambiguous); @@ -840,7 +846,7 @@ no_colon: lookup_session: if (ambiguous) goto not_found; - if ((s = cmd_lookup_session(arg, &ambiguous)) == NULL) + if (*arg != '\0' && (s = cmd_lookup_session(arg, &ambiguous)) == NULL) goto no_session; if (sp != NULL) @@ -981,7 +987,7 @@ no_colon: lookup_session: if (ambiguous) goto not_found; - if ((s = cmd_lookup_session(arg, &ambiguous)) == NULL) + if (*arg != '\0' && (s = cmd_lookup_session(arg, &ambiguous)) == NULL) goto no_session; if (sp != NULL) |