From aaa98ab4a2d70014ecae09941f292775d08fa7ee Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 3 Oct 2007 12:43:47 +0000 Subject: [PATCH] Rename some bits. --- cmd.c | 28 ++++++++++++++-------------- op.c | 17 +++++++++-------- tmux.c | 8 ++++---- tmux.h | 6 +++--- 4 files changed, 30 insertions(+), 29 deletions(-) diff --git a/cmd.c b/cmd.c index 54974909..c5823f3b 100644 --- a/cmd.c +++ b/cmd.c @@ -1,4 +1,4 @@ -/* $Id: cmd.c,v 1.3 2007-10-03 12:34:16 nicm Exp $ */ +/* $Id: cmd.c,v 1.4 2007-10-03 12:43:47 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -25,15 +25,15 @@ int cmd_prefix = META; -void cmd_fn_create(struct client *, struct cmd *); void cmd_fn_detach(struct client *, struct cmd *); void cmd_fn_last(struct client *, struct cmd *); void cmd_fn_meta(struct client *, struct cmd *); +void cmd_fn_new(struct client *, struct cmd *); void cmd_fn_next(struct client *, struct cmd *); void cmd_fn_previous(struct client *, struct cmd *); void cmd_fn_refresh(struct client *, struct cmd *); void cmd_fn_select(struct client *, struct cmd *); -void cmd_fn_windowinfo(struct client *, struct cmd *); +void cmd_fn_info(struct client *, struct cmd *); const struct cmd cmd_default[] = { { '0', cmd_fn_select, 0, NULL }, @@ -46,8 +46,8 @@ const struct cmd cmd_default[] = { { '7', cmd_fn_select, 7, NULL }, { '8', cmd_fn_select, 8, NULL }, { '9', cmd_fn_select, 9, NULL }, - { 'C', cmd_fn_create, 0, NULL }, - { 'c', cmd_fn_create, 0, NULL }, + { 'C', cmd_fn_new, 0, NULL }, + { 'c', cmd_fn_new, 0, NULL }, { 'D', cmd_fn_detach, 0, NULL }, { 'd', cmd_fn_detach, 0, NULL }, { 'N', cmd_fn_next, 0, NULL }, @@ -58,23 +58,23 @@ const struct cmd cmd_default[] = { { 'r', cmd_fn_refresh, 0, NULL }, { 'L', cmd_fn_last, 0, NULL }, { 'l', cmd_fn_last, 0, NULL }, - { 'I', cmd_fn_windowinfo, 0, NULL }, - { 'i', cmd_fn_windowinfo, 0, NULL }, + { 'I', cmd_fn_info, 0, NULL }, + { 'i', cmd_fn_info, 0, NULL }, { META, cmd_fn_meta, 0, NULL }, }; u_int cmd_count = (sizeof cmd_default / sizeof cmd_default[0]); struct cmd *cmd_table; const struct bind cmd_bind_table[] = { - { "select", cmd_fn_select, BIND_NUMBER|BIND_USER }, - { "create", cmd_fn_create, BIND_STRING|BIND_USER }, { "detach", cmd_fn_detach, 0 }, + { "info", cmd_fn_info, 0 }, + { "last", cmd_fn_last, 0 }, + { "meta", cmd_fn_meta, 0 }, + { "new", cmd_fn_new, BIND_STRING|BIND_USER }, { "next", cmd_fn_next, 0 }, { "previous", cmd_fn_previous, 0 }, { "refresh", cmd_fn_refresh, 0 }, - { "last", cmd_fn_last, 0 }, - { "window-info",cmd_fn_windowinfo, 0 }, - { "meta", cmd_fn_meta, 0 } + { "select", cmd_fn_select, BIND_NUMBER|BIND_USER }, }; #define NCMDBIND (sizeof cmd_bind_table / sizeof cmd_bind_table[0]) @@ -170,7 +170,7 @@ cmd_dispatch(struct client *c, int key) } void -cmd_fn_create(struct client *c, struct cmd *cmd) +cmd_fn_new(struct client *c, struct cmd *cmd) { char *s; @@ -238,7 +238,7 @@ cmd_fn_select(struct client *c, struct cmd *cmd) } void -cmd_fn_windowinfo(struct client *c, unused struct cmd *cmd) +cmd_fn_info(struct client *c, unused struct cmd *cmd) { struct window *w; char *buf; diff --git a/op.c b/op.c index 110eadb8..80ab66a6 100644 --- a/op.c +++ b/op.c @@ -1,4 +1,4 @@ -/* $Id: op.c,v 1.11 2007-10-03 12:34:16 nicm Exp $ */ +/* $Id: op.c,v 1.12 2007-10-03 12:43:47 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -25,7 +25,7 @@ #include "tmux.h" int -op_new(char *path, int argc, char **argv) +op_new_session(char *path, int argc, char **argv) { struct new_data data; struct client_ctx cctx; @@ -48,13 +48,13 @@ op_new(char *path, int argc, char **argv) break; case '?': default: - return (usage("new [-d] [-s session]")); + return (usage("new-session [-d] [-s session]")); } } argc -= optind; argv += optind; if (argc != 0) - return (usage("new [-s session]")); + return (usage("new-session [-s session]")); if (client_init(path, &cctx, 1) != 0) return (1); @@ -109,7 +109,7 @@ op_attach(char *path, int argc, char **argv) } int -op_rename(char *path, int argc, char **argv) +op_rename_window(char *path, int argc, char **argv) { struct rename_data data; struct client_ctx cctx; @@ -139,13 +139,14 @@ op_rename(char *path, int argc, char **argv) break; case '?': default: - return (usage("rename [-s session] [-i index] name")); + return (usage( + "rename-window [-s session] [-i index] name")); } } argc -= optind; argv += optind; if (argc != 1) - return (usage("rename [-s session] [-i index] name")); + return (usage("rename-window [-s session] [-i index] name")); if (client_init(path, &cctx, 1) != 0) return (1); @@ -213,7 +214,7 @@ op_bind_key(char *path, int argc, char **argv) len = strlen(str); } else if (bind->flags & BIND_NUMBER) { data.flags |= BIND_NUMBER; - data.num = strtonum(argv[2], 0, INT_MAX, &errstr); + data.num = strtonum(argv[2], 0, UINT_MAX, &errstr); if (errstr != NULL) { log_warnx("argument %s: %s", errstr, argv[2]); return (1); diff --git a/tmux.c b/tmux.c index 6b95f993..58ed9f93 100644 --- a/tmux.c +++ b/tmux.c @@ -1,4 +1,4 @@ -/* $Id: tmux.c,v 1.22 2007-10-03 12:34:16 nicm Exp $ */ +/* $Id: tmux.c,v 1.23 2007-10-03 12:43:47 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -47,11 +47,11 @@ struct op { }; const struct op op_table[] = { { "attach", NULL, op_attach }, + { "bind-key", "bind", op_bind_key }, { "list-sessions", "ls", op_list_sessions }, { "list-windows", "lsw", op_list_windows }, - { "new-session", "new", op_new/*_session*/ }, - { "rename-window", "renw", op_rename }, - { "bind-key", "bind", op_bind_key }, + { "new-session", "new", op_new_session }, + { "rename-window", "renw", op_rename_window }, { "unbind-key", "unbind", op_unbind_key }, }; #define NOP (sizeof op_table / sizeof op_table[0]) diff --git a/tmux.h b/tmux.h index 0d03dd06..97b5df8c 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.36 2007-10-03 12:34:16 nicm Exp $ */ +/* $Id: tmux.h,v 1.37 2007-10-03 12:43:47 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -528,9 +528,9 @@ void siginit(void); void sigreset(void); /* op.c */ -int op_new(char *, int, char **); +int op_new_session(char *, int, char **); int op_attach(char *, int, char **); -int op_rename(char *, int, char **); +int op_rename_window(char *, int, char **); int op_bind_key(char *, int, char **); int op_unbind_key(char *, int, char **);