mirror of
https://github.com/tmux/tmux.git
synced 2024-12-04 19:58:48 +00:00
Portability fix-ups
* Ammend the Makefile to include newer commands. * "compat/vis.h" versus <vis.h> * Removal of cmd-send-prefix.c and cmd-show-buffer.c * osdep-* for processes. BUG-ID: N/A
This commit is contained in:
parent
7a87c7eff6
commit
97b5df35b1
@ -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 \
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <vis.h>
|
||||
#include "compat/vis.h"
|
||||
|
||||
#include "tmux.h"
|
||||
|
||||
|
@ -1,57 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
*
|
||||
* 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 <sys/types.h>
|
||||
|
||||
#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);
|
||||
}
|
@ -1,111 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
*
|
||||
* 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 <sys/types.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#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);
|
||||
}
|
2
cmd.c
2
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;
|
||||
|
2
format.c
2
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user