diff options
author | 2014-05-13 07:34:35 +0000 | |
---|---|---|
committer | 2014-05-13 07:34:35 +0000 | |
commit | a41fa27a7a7d81a2718aed810231593ca5d4d42a (patch) | |
tree | 6f9e54947c41df6d05b7c7b9a6ec979545ee9031 /usr.bin/tmux/cmd-delete-buffer.c | |
parent | Since this is limited to ffs, use ufsinfo_t instead of ino_t. (diff) | |
download | wireguard-openbsd-a41fa27a7a7d81a2718aed810231593ca5d4d42a.tar.xz wireguard-openbsd-a41fa27a7a7d81a2718aed810231593ca5d4d42a.zip |
Add support for named buffers. If you don't name a buffer, things work
much as before - buffers are automatically named "buffer0000",
"buffer0001" and so on and ordered as a stack. Buffers can be named
explicitly when creating ("loadb -b foo" etc) or renamed ("setb -b
buffer0000 -n foo"). If buffers are named explicitly, they are not
deleted when buffer-limit is reached. Diff from J Raynor.
Diffstat (limited to 'usr.bin/tmux/cmd-delete-buffer.c')
-rw-r--r-- | usr.bin/tmux/cmd-delete-buffer.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/usr.bin/tmux/cmd-delete-buffer.c b/usr.bin/tmux/cmd-delete-buffer.c index f5e4e701da5..d60897ab7e2 100644 --- a/usr.bin/tmux/cmd-delete-buffer.c +++ b/usr.bin/tmux/cmd-delete-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-delete-buffer.c,v 1.11 2014/04/24 09:14:43 nicm Exp $ */ +/* $OpenBSD: cmd-delete-buffer.c,v 1.12 2014/05/13 07:34:35 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -41,23 +41,16 @@ enum cmd_retval cmd_delete_buffer_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; - char *cause; - int buffer; + const char *bufname; if (!args_has(args, 'b')) { paste_free_top(); return (CMD_RETURN_NORMAL); } + bufname = args_get(args, 'b'); - buffer = args_strtonum(args, 'b', 0, INT_MAX, &cause); - if (cause != NULL) { - cmdq_error(cmdq, "buffer %s", cause); - free(cause); - return (CMD_RETURN_ERROR); - } - - if (paste_free_index(buffer) != 0) { - cmdq_error(cmdq, "no buffer %d", buffer); + if (paste_free_name(bufname) != 0) { + cmdq_error(cmdq, "no buffer %s", bufname); return (CMD_RETURN_ERROR); } |