diff --git a/Makefile.am b/Makefile.am index 5e7f644b..a790ea02 100644 --- a/Makefile.am +++ b/Makefile.am @@ -116,12 +116,10 @@ dist_tmux_SOURCES = \ cmd-select-pane.c \ cmd-select-window.c \ cmd-send-keys.c \ - cmd-send-prefix.c \ cmd-server-info.c \ cmd-set-buffer.c \ cmd-set-environment.c \ cmd-set-option.c \ - cmd-show-buffer.c \ cmd-show-environment.c \ cmd-show-messages.c \ cmd-show-options.c \ @@ -135,6 +133,7 @@ dist_tmux_SOURCES = \ cmd-switch-client.c \ cmd-unbind-key.c \ cmd-unlink-window.c \ + cmd-wait-for.c \ cmd.c \ colour.c \ control.c \ diff --git a/cmd-save-buffer.c b/cmd-save-buffer.c index f1d2808b..20102a44 100644 --- a/cmd-save-buffer.c +++ b/cmd-save-buffer.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include "compat/vis.h" #include "tmux.h" diff --git a/cmd-send-prefix.c b/cmd-send-prefix.c deleted file mode 100644 index 5dded955..00000000 --- a/cmd-send-prefix.c +++ /dev/null @@ -1,57 +0,0 @@ -/* $Id$ */ - -/* - * Copyright (c) 2007 Nicholas Marriott - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include - -#include "tmux.h" - -/* - * Send prefix key as a key. - */ - -enum cmd_retval cmd_send_prefix_exec(struct cmd *, struct cmd_ctx *); - -const struct cmd_entry cmd_send_prefix_entry = { - "send-prefix", NULL, - "2t:", 0, 0, - "[-2] " CMD_TARGET_PANE_USAGE, - 0, - NULL, - NULL, - cmd_send_prefix_exec -}; - -enum cmd_retval -cmd_send_prefix_exec(struct cmd *self, struct cmd_ctx *ctx) -{ - struct args *args = self->args; - struct session *s; - struct window_pane *wp; - int key; - - if (cmd_find_pane(ctx, args_get(args, 't'), &s, &wp) == NULL) - return (CMD_RETURN_ERROR); - - if (args_has(args, '2')) - key = options_get_number(&s->options, "prefix2"); - else - key = options_get_number(&s->options, "prefix"); - window_pane_key(wp, s, key); - - return (CMD_RETURN_NORMAL); -} diff --git a/cmd-show-buffer.c b/cmd-show-buffer.c deleted file mode 100644 index b345ebc1..00000000 --- a/cmd-show-buffer.c +++ /dev/null @@ -1,111 +0,0 @@ -/* $Id$ */ - -/* - * Copyright (c) 2007 Nicholas Marriott - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include - -#include - -#include "tmux.h" - -/* - * Show a paste buffer. - */ - -enum cmd_retval cmd_show_buffer_exec(struct cmd *, struct cmd_ctx *); - -const struct cmd_entry cmd_show_buffer_entry = { - "show-buffer", "showb", - "b:", 0, 0, - CMD_BUFFER_USAGE, - 0, - NULL, - NULL, - cmd_show_buffer_exec -}; - -enum cmd_retval -cmd_show_buffer_exec(struct cmd *self, struct cmd_ctx *ctx) -{ - struct args *args = self->args; - struct session *s; - struct paste_buffer *pb; - int buffer; - char *in, *buf, *ptr, *cause; - size_t size, len; - u_int width; - - if ((s = cmd_find_session(ctx, NULL, 0)) == NULL) - return (CMD_RETURN_ERROR); - - if (!args_has(args, 'b')) { - if ((pb = paste_get_top(&global_buffers)) == NULL) { - ctx->error(ctx, "no buffers"); - return (CMD_RETURN_ERROR); - } - } else { - buffer = args_strtonum(args, 'b', 0, INT_MAX, &cause); - if (cause != NULL) { - ctx->error(ctx, "buffer %s", cause); - free(cause); - return (CMD_RETURN_ERROR); - } - - pb = paste_get_index(&global_buffers, buffer); - if (pb == NULL) { - ctx->error(ctx, "no buffer %d", buffer); - return (CMD_RETURN_ERROR); - } - } - - size = pb->size; - if (size > SIZE_MAX / 4 - 1) - size = SIZE_MAX / 4 - 1; - in = xmalloc(size * 4 + 1); - strvisx(in, pb->data, size, VIS_OCTAL|VIS_TAB); - - width = s->sx; - if (ctx->cmdclient != NULL) - width = ctx->cmdclient->tty.sx; - - buf = xmalloc(width + 1); - len = 0; - - ptr = in; - do { - buf[len++] = *ptr++; - - if (len == width || buf[len - 1] == '\n') { - if (buf[len - 1] == '\n') - len--; - buf[len] = '\0'; - - ctx->print(ctx, "%s", buf); - len = 0; - } - } while (*ptr != '\0'); - - if (len != 0) { - buf[len] = '\0'; - ctx->print(ctx, "%s", buf); - } - free(buf); - - free(in); - - return (CMD_RETURN_NORMAL); -} diff --git a/cmd.c b/cmd.c index 16a9eb98..eecac462 100644 --- a/cmd.c +++ b/cmd.c @@ -1333,7 +1333,7 @@ cmd_get_default_path(struct cmd_q *cmdq, const char *cwd) if (c != NULL && c->session == NULL && c->cwd != NULL) root = c->cwd; else if (s->curw != NULL) - root = get_proc_cwd(s->curw->window->active->fd); + root = osdep_get_cwd(s->curw->window->active->fd); else return (s->cwd); skip = 0; diff --git a/format.c b/format.c index d70b7678..fa2dd0b2 100644 --- a/format.c +++ b/format.c @@ -434,7 +434,7 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp) format_add(ft, "pane_start_path", "%s", wp->cwd); if ((cwd = osdep_get_cwd(wp->fd)) != NULL) format_add(ft, "pane_current_path", "%s", cwd); - if ((cmd = get_proc_name(wp->fd, wp->tty)) != NULL) { + if ((cmd = osdep_get_name(wp->fd, wp->tty)) != NULL) { format_add(ft, "pane_current_command", "%s", cmd); free(cmd); }