diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2011-04-06 22:29:26 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2011-04-06 22:29:26 +0000 |
commit | e5f4bf3f3ec206bedf0f4a04b8158cff8c734f11 (patch) | |
tree | bc143973bb375f5176d41a00384d7cab9bbb944d /cmd.c | |
parent | 13c54a04a0ef236dd2df36ca3fa5fd1b89272be6 (diff) | |
download | rtmux-e5f4bf3f3ec206bedf0f4a04b8158cff8c734f11.tar.gz rtmux-e5f4bf3f3ec206bedf0f4a04b8158cff8c734f11.tar.bz2 rtmux-e5f4bf3f3ec206bedf0f4a04b8158cff8c734f11.zip |
|PatchSet 884
|Date: 2011/04/06 22:51:31
|Author: nicm
|Branch: HEAD
|Tag: (none)
|Log:
|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 'cmd.c')
-rw-r--r-- | cmd.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -1,4 +1,4 @@ -/* $Id: cmd.c,v 1.151 2011-04-06 22:24:01 nicm Exp $ */ +/* $Id: cmd.c,v 1.152 2011-04-06 22:29:26 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -724,6 +724,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); @@ -839,7 +845,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) @@ -980,7 +986,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) |