diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-07-14 06:42:06 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-07-14 06:42:06 +0000 |
commit | d358a352c0d29f66c62f52f1f4426d6f90832abd (patch) | |
tree | 567ffdc2a976e01c2088fa785b1a5fb9982dca86 /cmd-new-window.c | |
parent | e63567d51ce76e45013b4a392eba1443fd5b3493 (diff) | |
download | rtmux-d358a352c0d29f66c62f52f1f4426d6f90832abd.tar.gz rtmux-d358a352c0d29f66c62f52f1f4426d6f90832abd.tar.bz2 rtmux-d358a352c0d29f66c62f52f1f4426d6f90832abd.zip |
Tidy up and improve target (-t) argument parsing:
- move the code back into cmd.c and merge with the existing functions where
possible;
- accept "-tttyp0" as well as "-t/dev/ttyp0" for clients;
- when looking up session names, try an exact match first, and if that fails
look for it as an fnmatch pattern and then as the start of a name - if more
that one session matches an error is given; so if there is one session called
"mysession", -tmysession, -tmysess, -tmysess* are equivalent but if there
is also "mysession2", the last two are errors;
- similarly for windows, if the argument is not a valid index or exact window
name match, try it against the window names as an fnmatch pattern and a
prefix.
Diffstat (limited to 'cmd-new-window.c')
-rw-r--r-- | cmd-new-window.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/cmd-new-window.c b/cmd-new-window.c index ed13fbdc..e4afe014 100644 --- a/cmd-new-window.c +++ b/cmd-new-window.c @@ -1,4 +1,4 @@ -/* $Id: cmd-new-window.c,v 1.33 2009-07-08 18:03:03 nicm Exp $ */ +/* $Id: cmd-new-window.c,v 1.34 2009-07-14 06:42:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -126,18 +126,8 @@ cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx) if (data == NULL) return (0); - if (arg_parse_window(data->target, &s, &idx) != 0) { - ctx->error(ctx, "bad window: %s", data->target); + if ((idx = cmd_find_index(ctx, data->target, &s)) == -2) return (-1); - } - if (s == NULL) - s = ctx->cursession; - if (s == NULL) - s = cmd_current_session(ctx); - if (s == NULL) { - ctx->error(ctx, "session not found: %s", data->target); - return (-1); - } wl = NULL; if (idx != -1) |