diff options
author | 2009-07-13 17:47:46 +0000 | |
---|---|---|
committer | 2009-07-13 17:47:46 +0000 | |
commit | 3ce750e3d41dc3c7ee19d7d82a48c71cbc8fe205 (patch) | |
tree | 078114060a339bd83e37082ec4ceabb1e3a86270 /usr.bin/tmux/cmd-move-window.c | |
parent | Do the same rdomain checking in sppp as we do in the Ethernet case. (diff) | |
download | wireguard-openbsd-3ce750e3d41dc3c7ee19d7d82a48c71cbc8fe205.tar.xz wireguard-openbsd-3ce750e3d41dc3c7ee19d7d82a48c71cbc8fe205.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 'usr.bin/tmux/cmd-move-window.c')
-rw-r--r-- | usr.bin/tmux/cmd-move-window.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/usr.bin/tmux/cmd-move-window.c b/usr.bin/tmux/cmd-move-window.c index bde3ed61380..b818beaa141 100644 --- a/usr.bin/tmux/cmd-move-window.c +++ b/usr.bin/tmux/cmd-move-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-move-window.c,v 1.1 2009/06/01 22:58:49 nicm Exp $ */ +/* $OpenBSD: cmd-move-window.c,v 1.2 2009/07/13 17:47:46 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -54,19 +54,8 @@ cmd_move_window_exec(struct cmd *self, struct cmd_ctx *ctx) if ((wl_src = cmd_find_window(ctx, data->src, &src)) == NULL) return (-1); - - if (arg_parse_window(data->dst, &dst, &idx) != 0) { - ctx->error(ctx, "bad window: %s", data->dst); - return (-1); - } - if (dst == NULL) - dst = ctx->cursession; - if (dst == NULL) - dst = cmd_current_session(ctx); - if (dst == NULL) { - ctx->error(ctx, "session not found: %s", data->dst); + if ((idx = cmd_find_index(ctx, data->dst, &dst)) == -2) return (-1); - } wl_dst = NULL; if (idx != -1) |