This adds the definition file for the renumber-windows command, as well as
supporting its addition in the Makefile.
---
trunk/Makefile.am | 1 +
trunk/cmd-renumber-windows.c | 53 ++++++++++++++++++++++++++++++++++++++++++
trunk/cmd.c | 1 +
trunk/tmux.h | 1 +
4 files changed, 56 insertions(+), 0 deletions(-)
create mode 100644 trunk/cmd-renumber-windows.c
diff --git a/trunk/Makefile.am b/trunk/Makefile.am
index 0a70dca..ca64c99 100644
--- a/trunk/Makefile.am
+++ b/trunk/Makefile.am
@@ -104,6 +104,7 @@ dist_tmux_SOURCES = \
cmd-refresh-client.c \
cmd-rename-session.c \
cmd-rename-window.c \
+ cmd-renumber-windows.c \
cmd-resize-pane.c \
cmd-respawn-pane.c \
cmd-respawn-window.c \
diff --git a/trunk/cmd-renumber-windows.c b/trunk/cmd-renumber-windows.c
new file mode 100644
index 0000000..6cf7428
--- /dev/null
+++ b/trunk/cmd-renumber-windows.c
@@ -0,0 +1,53 @@
+/* $Id$ */
+
+/*
+ * Copyright (c) 2011 Nicholas Marriott <[email protected]>
+ * Copyright (c) 2011 Thomas Adam <[email protected]>
+ *
+ * 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"
+
+/*
+ * Renumber all of the windows in a session in order, starting at base-index
+ * if set.
+ */
+
+int cmd_renumber_windows_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_renumber_windows_entry = {
+ "renumber-windows", "renumberw",
+ "t:", 0, 0,
+ CMD_TARGET_SESSION_USAGE,
+ 0,
+ NULL,
+ NULL,
+ cmd_renumber_windows_exec
+};
+
+int
+cmd_renumber_windows_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct args *args = self->args;
+ struct session *s;
+
+ if ((s = cmd_find_session(ctx, args_get(args, 't'), 0)) == NULL)
+ return (-1);
+
+ return window_renumber_windows(s);
+}
diff --git a/trunk/cmd.c b/trunk/cmd.c
index 2027f75..d5f7a61 100644
--- a/trunk/cmd.c
+++ b/trunk/cmd.c
@@ -78,6 +78,7 @@ const struct cmd_entry *cmd_table[] = {
&cmd_refresh_client_entry,
&cmd_rename_session_entry,
&cmd_rename_window_entry,
+ &cmd_renumber_windows_entry,
&cmd_resize_pane_entry,
&cmd_respawn_pane_entry,
&cmd_respawn_window_entry,
diff --git a/trunk/tmux.h b/trunk/tmux.h
index ba5044e..b118f49 100644
--- a/trunk/tmux.h
+++ b/trunk/tmux.h
@@ -1578,6 +1578,7 @@ extern const struct cmd_entry cmd_previous_window_entry;
extern const struct cmd_entry cmd_refresh_client_entry;
extern const struct cmd_entry cmd_rename_session_entry;
extern const struct cmd_entry cmd_rename_window_entry;
+extern const struct cmd_entry cmd_renumber_windows_entry;
extern const struct cmd_entry cmd_resize_pane_entry;
extern const struct cmd_entry cmd_respawn_pane_entry;
extern const struct cmd_entry cmd_respawn_window_entry;
--
1.7.5.4
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
tmux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-users