summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2015-11-18 16:01:23 +0000
committerThomas Adam <thomas@xteddy.org>2015-11-18 16:01:23 +0000
commit7fe8edc3962d5c30bf87677ecb2cf8633404f63c (patch)
treed354de9a04867168c1b296e15c556231f33c03f4
parentf8a1f8843c91ebb1262ec6a000fd495eeb27e179 (diff)
parent577c0e3e5a79e9f1f860487bc3f411d26758f026 (diff)
Merge branch 'obsd-master'
-rw-r--r--alerts.c4
-rw-r--r--cfg.c2
-rw-r--r--client.c5
-rw-r--r--cmd-kill-server.c2
-rw-r--r--cmd-list-buffers.c2
-rw-r--r--cmd-list-keys.c6
-rw-r--r--cmd-lock-server.c2
-rw-r--r--cmd-pipe-pane.c4
-rw-r--r--cmd-set-option.c14
-rw-r--r--cmd-wait-for.c4
-rw-r--r--control-notify.c8
-rw-r--r--control.c2
-rw-r--r--format.c88
-rw-r--r--job.c5
-rw-r--r--log.c2
-rw-r--r--names.c2
-rw-r--r--proc.c4
-rw-r--r--screen-write.c2
-rw-r--r--server-client.c8
-rw-r--r--server-fn.c2
-rw-r--r--server.c2
-rw-r--r--session.c4
-rw-r--r--status.c4
-rw-r--r--tmux.17
-rw-r--r--tmux.h3
-rw-r--r--tty-keys.c2
-rw-r--r--tty.c8
-rw-r--r--window-choose.c4
-rw-r--r--window-clock.c8
-rw-r--r--window-copy.c6
-rw-r--r--window.c8
31 files changed, 141 insertions, 83 deletions
diff --git a/alerts.c b/alerts.c
index f1477030..32e0d496 100644
--- a/alerts.c
+++ b/alerts.c
@@ -35,7 +35,7 @@ int alerts_check_silence(struct session *, struct winlink *);
void alerts_ring_bell(struct session *);
void
-alerts_timer(unused int fd, unused short events, void *arg)
+alerts_timer(__unused int fd, __unused short events, void *arg)
{
struct window *w = arg;
@@ -45,7 +45,7 @@ alerts_timer(unused int fd, unused short events, void *arg)
}
void
-alerts_callback(unused int fd, unused short events, unused void *arg)
+alerts_callback(__unused int fd, __unused short events, __unused void *arg)
{
struct window *w;
struct session *s;
diff --git a/cfg.c b/cfg.c
index 9657302b..975b89a4 100644
--- a/cfg.c
+++ b/cfg.c
@@ -132,7 +132,7 @@ load_cfg(const char *path, struct cmd_q *cmdq, char **cause)
}
void
-cfg_default_done(unused struct cmd_q *cmdq)
+cfg_default_done(__unused struct cmd_q *cmdq)
{
if (--cfg_references != 0)
return;
diff --git a/client.c b/client.c
index ccc58fb4..cade3a63 100644
--- a/client.c
+++ b/client.c
@@ -413,7 +413,8 @@ client_send_identify(const char *ttynam, const char *cwd)
/* Callback for client stdin read events. */
void
-client_stdin_callback(unused int fd, unused short events, unused void *arg)
+client_stdin_callback(__unused int fd, __unused short events,
+ __unused void *arg)
{
struct msg_stdin_data data;
@@ -515,7 +516,7 @@ client_signal(int sig)
/* Callback for client read events. */
void
-client_dispatch(struct imsg *imsg, unused void *arg)
+client_dispatch(struct imsg *imsg, __unused void *arg)
{
if (imsg == NULL) {
client_exitreason = CLIENT_EXIT_LOST_SERVER;
diff --git a/cmd-kill-server.c b/cmd-kill-server.c
index 07d94302..4107e6b6 100644
--- a/cmd-kill-server.c
+++ b/cmd-kill-server.c
@@ -46,7 +46,7 @@ const struct cmd_entry cmd_start_server_entry = {
};
enum cmd_retval
-cmd_kill_server_exec(struct cmd *self, unused struct cmd_q *cmdq)
+cmd_kill_server_exec(struct cmd *self, __unused struct cmd_q *cmdq)
{
if (self->entry == &cmd_kill_server_entry)
kill(getpid(), SIGTERM);
diff --git a/cmd-list-buffers.c b/cmd-list-buffers.c
index 3a8a790a..a0036032 100644
--- a/cmd-list-buffers.c
+++ b/cmd-list-buffers.c
@@ -41,7 +41,7 @@ const struct cmd_entry cmd_list_buffers_entry = {
};
enum cmd_retval
-cmd_list_buffers_exec(unused struct cmd *self, struct cmd_q *cmdq)
+cmd_list_buffers_exec(struct cmd *self, struct cmd_q *cmdq)
{
struct args *args = self->args;
struct paste_buffer *pb;
diff --git a/cmd-list-keys.c b/cmd-list-keys.c
index 3b6afa3e..4355f24e 100644
--- a/cmd-list-keys.c
+++ b/cmd-list-keys.c
@@ -30,7 +30,7 @@
enum cmd_retval cmd_list_keys_exec(struct cmd *, struct cmd_q *);
enum cmd_retval cmd_list_keys_table(struct cmd *, struct cmd_q *);
-enum cmd_retval cmd_list_keys_commands(struct cmd *, struct cmd_q *);
+enum cmd_retval cmd_list_keys_commands(struct cmd_q *);
const struct cmd_entry cmd_list_keys_entry = {
"list-keys", "lsk",
@@ -60,7 +60,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq)
int repeat, width, tablewidth, keywidth;
if (self->entry == &cmd_list_commands_entry)
- return (cmd_list_keys_commands(self, cmdq));
+ return (cmd_list_keys_commands(cmdq));
if (args_has(args, 't'))
return (cmd_list_keys_table(self, cmdq));
@@ -178,7 +178,7 @@ cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq)
}
enum cmd_retval
-cmd_list_keys_commands(unused struct cmd *self, struct cmd_q *cmdq)
+cmd_list_keys_commands(struct cmd_q *cmdq)
{
const struct cmd_entry **entryp;
const struct cmd_entry *entry;
diff --git a/cmd-lock-server.c b/cmd-lock-server.c
index de76475d..a0204129 100644
--- a/cmd-lock-server.c
+++ b/cmd-lock-server.c
@@ -51,7 +51,7 @@ const struct cmd_entry cmd_lock_client_entry = {
};
enum cmd_retval
-cmd_lock_server_exec(struct cmd *self, unused struct cmd_q *cmdq)
+cmd_lock_server_exec(struct cmd *self, __unused struct cmd_q *cmdq)
{
struct args *args = self->args;
struct client *c;
diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c
index 49b156c6..4d662d32 100644
--- a/cmd-pipe-pane.c
+++ b/cmd-pipe-pane.c
@@ -141,8 +141,8 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_q *cmdq)
}
void
-cmd_pipe_pane_error_callback(
- unused struct bufferevent *bufev, unused short what, void *data)
+cmd_pipe_pane_error_callback(__unused struct bufferevent *bufev,
+ __unused short what, void *data)
{
struct window_pane *wp = data;
diff --git a/cmd-set-option.c b/cmd-set-option.c
index c5a77b45..894f0c43 100644
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -350,7 +350,7 @@ cmd_set_option_set(struct cmd *self, struct cmd_q *cmdq,
/* Set a string option. */
struct options_entry *
-cmd_set_option_string(struct cmd *self, unused struct cmd_q *cmdq,
+cmd_set_option_string(struct cmd *self, __unused struct cmd_q *cmdq,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
@@ -372,7 +372,7 @@ cmd_set_option_string(struct cmd *self, unused struct cmd_q *cmdq,
/* Set a number option. */
struct options_entry *
-cmd_set_option_number(unused struct cmd *self, struct cmd_q *cmdq,
+cmd_set_option_number(__unused struct cmd *self, struct cmd_q *cmdq,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
@@ -390,7 +390,7 @@ cmd_set_option_number(unused struct cmd *self, struct cmd_q *cmdq,
/* Set a key option. */
struct options_entry *
-cmd_set_option_key(unused struct cmd *self, struct cmd_q *cmdq,
+cmd_set_option_key(__unused struct cmd *self, struct cmd_q *cmdq,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
@@ -406,7 +406,7 @@ cmd_set_option_key(unused struct cmd *self, struct cmd_q *cmdq,
/* Set a colour option. */
struct options_entry *
-cmd_set_option_colour(unused struct cmd *self, struct cmd_q *cmdq,
+cmd_set_option_colour(__unused struct cmd *self, struct cmd_q *cmdq,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
@@ -422,7 +422,7 @@ cmd_set_option_colour(unused struct cmd *self, struct cmd_q *cmdq,
/* Set an attributes option. */
struct options_entry *
-cmd_set_option_attributes(unused struct cmd *self, struct cmd_q *cmdq,
+cmd_set_option_attributes(__unused struct cmd *self, struct cmd_q *cmdq,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
@@ -438,7 +438,7 @@ cmd_set_option_attributes(unused struct cmd *self, struct cmd_q *cmdq,
/* Set a flag option. */
struct options_entry *
-cmd_set_option_flag(unused struct cmd *self, struct cmd_q *cmdq,
+cmd_set_option_flag(__unused struct cmd *self, struct cmd_q *cmdq,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
@@ -466,7 +466,7 @@ cmd_set_option_flag(unused struct cmd *self, struct cmd_q *cmdq,
/* Set a choice option. */
struct options_entry *
-cmd_set_option_choice(unused struct cmd *self, struct cmd_q *cmdq,
+cmd_set_option_choice(__unused struct cmd *self, struct cmd_q *cmdq,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
diff --git a/cmd-wait-for.c b/cmd-wait-for.c
index 79e0b55e..04316d5e 100644
--- a/cmd-wait-for.c
+++ b/cmd-wait-for.c
@@ -111,7 +111,7 @@ cmd_wait_for_remove(struct wait_channel *wc)
}
enum cmd_retval
-cmd_wait_for_exec(struct cmd *self, unused struct cmd_q *cmdq)
+cmd_wait_for_exec(struct cmd *self, struct cmd_q *cmdq)
{
struct args *args = self->args;
const char *name = args->argv[0];
@@ -130,7 +130,7 @@ cmd_wait_for_exec(struct cmd *self, unused struct cmd_q *cmdq)
}
enum cmd_retval
-cmd_wait_for_signal(unused struct cmd_q *cmdq, const char *name,
+cmd_wait_for_signal(__unused struct cmd_q *cmdq, const char *name,
struct wait_channel *wc)
{
struct cmd_q *wq, *wq1;
diff --git a/control-notify.c b/control-notify.c
index 16a98e3a..db3648a4 100644
--- a/control-notify.c
+++ b/control-notify.c
@@ -101,7 +101,7 @@ control_notify_window_layout_changed(struct window *w)
}
void
-control_notify_window_unlinked(unused struct session *s, struct window *w)
+control_notify_window_unlinked(__unused struct session *s, struct window *w)
{
struct client *c;
struct session *cs;
@@ -119,7 +119,7 @@ control_notify_window_unlinked(unused struct session *s, struct window *w)
}
void
-control_notify_window_linked(unused struct session *s, struct window *w)
+control_notify_window_linked(__unused struct session *s, struct window *w)
{
struct client *c;
struct session *cs;
@@ -183,7 +183,7 @@ control_notify_session_renamed(struct session *s)
}
void
-control_notify_session_created(unused struct session *s)
+control_notify_session_created(__unused struct session *s)
{
struct client *c;
@@ -196,7 +196,7 @@ control_notify_session_created(unused struct session *s)
}
void
-control_notify_session_close(unused struct session *s)
+control_notify_session_close(__unused struct session *s)
{
struct client *c;
diff --git a/control.c b/control.c
index f7264944..e799a4cb 100644
--- a/control.c
+++ b/control.c
@@ -51,7 +51,7 @@ control_write_buffer(struct client *c, struct evbuffer *buffer)
/* Control input callback. Read lines and fire commands. */
void
-control_callback(struct client *c, int closed, unused void *data)
+control_callback(struct client *c, int closed, __unused void *data)
{
char *line, *cause;
struct cmd_list *cmdlist;
diff --git a/format.c b/format.c
index 28c01a49..afa6af5d 100644
--- a/format.c
+++ b/format.c
@@ -101,6 +101,7 @@ format_job_cmp(struct format_job *fj1, struct format_job *fj2)
#define FORMAT_TIMESTRING 0x1
#define FORMAT_BASENAME 0x2
#define FORMAT_DIRNAME 0x4
+#define FORMAT_SUBSTITUTE 0x8
/* Entry in format tree. */
struct format_entry {
@@ -260,7 +261,7 @@ format_job_get(struct format_tree *ft, const char *cmd)
/* Remove old jobs. */
void
-format_job_timer(unused int fd, unused short events, unused void *arg)
+format_job_timer(__unused int fd, __unused short events, __unused void *arg)
{
struct format_job *fj, *fj1;
time_t now;
@@ -289,7 +290,7 @@ format_job_timer(unused int fd, unused short events, unused void *arg)
/* Callback for host. */
void
-format_cb_host(unused struct format_tree *ft, struct format_entry *fe)
+format_cb_host(__unused struct format_tree *ft, struct format_entry *fe)
{
char host[HOST_NAME_MAX + 1];
@@ -301,7 +302,7 @@ format_cb_host(unused struct format_tree *ft, struct format_entry *fe)
/* Callback for host_short. */
void
-format_cb_host_short(unused struct format_tree *ft, struct format_entry *fe)
+format_cb_host_short(__unused struct format_tree *ft, struct format_entry *fe)
{
char host[HOST_NAME_MAX + 1], *cp;
@@ -316,7 +317,7 @@ format_cb_host_short(unused struct format_tree *ft, struct format_entry *fe)
/* Callback for pid. */
void
-format_cb_pid(unused struct format_tree *ft, struct format_entry *fe)
+format_cb_pid(__unused struct format_tree *ft, struct format_entry *fe)
{
xasprintf(&fe->value, "%ld", (long)getpid());
}
@@ -699,8 +700,9 @@ int
format_replace(struct format_tree *ft, const char *key, size_t keylen,
char **buf, size_t *len, size_t *off)
{
- char *copy, *copy0, *endptr, *ptr, *saved, *trimmed, *value;
- size_t valuelen;
+ char *copy, *copy0, *endptr, *ptr, *found, *new, *value;
+ char *from = NULL, *to = NULL;
+ size_t valuelen, newlen, fromlen, tolen, used;
u_long limit = 0;
int modifiers = 0, brackets;
@@ -738,6 +740,29 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen,
modifiers |= FORMAT_TIMESTRING;
copy += 2;
break;
+ case 's':
+ if (copy[1] != '/')
+ break;
+ from = copy + 2;
+ for (copy = from; *copy != '\0' && *copy != '/'; copy++)
+ /* nothing */;
+ if (copy[0] != '/' || copy == from) {
+ copy = copy0;
+ break;
+ }
+ copy[0] = '\0';
+ to = copy + 1;
+ for (copy = to; *copy != '\0' && *copy != '/'; copy++)
+ /* nothing */;
+ if (copy[0] != '/' || copy[1] != ':') {
+ copy = copy0;
+ break;
+ }
+ copy[0] = '\0';
+
+ modifiers |= FORMAT_SUBSTITUTE;
+ copy += 2;
+ break;
}
/*
@@ -751,7 +776,7 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen,
*ptr = '\0';
value = ptr + 1;
- saved = format_find(ft, copy + 1, modifiers);
+ found = format_find(ft, copy + 1, modifiers);
brackets = 0;
for (ptr = ptr + 1; *ptr != '\0'; ptr++) {
@@ -765,29 +790,56 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen,
if (*ptr == '\0')
goto fail;
- if (saved != NULL && *saved != '\0' &&
- (saved[0] != '0' || saved[1] != '\0')) {
+ if (found != NULL && *found != '\0' &&
+ (found[0] != '0' || found[1] != '\0')) {
*ptr = '\0';
} else
value = ptr + 1;
value = format_expand(ft, value);
- free(saved);
- saved = value;
+ free(found);
} else {
- saved = value = format_find(ft, copy, modifiers);
+ value = format_find(ft, copy, modifiers);
if (value == NULL)
- saved = value = xstrdup("");
+ value = xstrdup("");
+ }
+
+ /* Perform substitution if any. */
+ if (modifiers & FORMAT_SUBSTITUTE) {
+ fromlen = strlen(from);
+ tolen = strlen(to);
+
+ newlen = strlen(value) + 1;
+ copy = new = xmalloc(newlen);
+ for (ptr = value; *ptr != '\0'; /* nothing */) {
+ if (strncmp(ptr, from, fromlen) != 0) {
+ *new++ = *ptr++;
+ continue;
+ }
+ used = new - copy;
+
+ newlen += tolen;
+ copy = xrealloc(copy, newlen);
+
+ new = copy + used;
+ memcpy(new, to, tolen);
+
+ new += tolen;
+ ptr += fromlen;
+ }
+ *new = '\0';
+ free(value);
+ value = copy;
}
/* Truncate the value if needed. */
if (limit != 0) {
- value = trimmed = utf8_trimcstr(value, limit);
- free(saved);
- saved = trimmed;
+ new = utf8_trimcstr(value, limit);
+ free(value);
+ value = new;
}
- valuelen = strlen(value);
/* Expand the buffer and copy in the value. */
+ valuelen = strlen(value);
while (*len - *off < valuelen + 1) {
*buf = xreallocarray(*buf, 2, *len);
*len *= 2;
@@ -795,7 +847,7 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen,
memcpy(*buf + *off, value, valuelen);
*off += valuelen;
- free(saved);
+ free(value);
free(copy0);
return (0);
diff --git a/job.c b/job.c
index 191d0a0f..902fc3e6 100644
--- a/job.c
+++ b/job.c
@@ -149,7 +149,7 @@ job_free(struct job *job)
/* Called when output buffer falls below low watermark (default is 0). */
void
-job_write_callback(unused struct bufferevent *bufev, void *data)
+job_write_callback(__unused struct bufferevent *bufev, void *data)
{
struct job *job = data;
size_t len = EVBUFFER_LENGTH(EVBUFFER_OUTPUT(job->event));
@@ -165,7 +165,8 @@ job_write_callback(unused struct bufferevent *bufev, void *data)
/* Job buffer error callback. */
void
-job_callback(unused struct bufferevent *bufev, unused short events, void *data)
+job_callback(__unused struct bufferevent *bufev, __unused short events,
+ void *data)
{
struct job *job = data;
diff --git a/log.c b/log.c
index 895c2e9d..a07000a7 100644
--- a/log.c
+++ b/log.c
@@ -32,7 +32,7 @@ void log_vwrite(const char *, va_list);
/* Log callback for libevent. */
void
-log_event_cb(unused int severity, const char *msg)
+log_event_cb(__unused int severity, const char *msg)
{
log_debug("%s", msg);
}
diff --git a/names.c b/names.c
index 0e806ca0..7d956db3 100644
--- a/names.c
+++ b/names.c
@@ -29,7 +29,7 @@ void name_time_callback(int, short, void *);
int name_time_expired(struct window *, struct timeval *);
void
-name_time_callback(unused int fd, unused short events, void *arg)
+name_time_callback(__unused int fd, __unused short events, void *arg)
{
struct window *w = arg;
diff --git a/proc.c b/proc.c
index 30997a21..7aa59cff 100644
--- a/proc.c
+++ b/proc.c
@@ -52,7 +52,7 @@ static int peer_check_version(struct tmuxpeer *, struct imsg *);
static void proc_update_event(struct tmuxpeer *);
static void
-proc_event_cb(unused int fd, short events, void *arg)
+proc_event_cb(__unused int fd, short events, void *arg)
{
struct tmuxpeer *peer = arg;
ssize_t n;
@@ -100,7 +100,7 @@ proc_event_cb(unused int fd, short events, void *arg)
}
static void
-proc_signal_cb(int signo, unused short events, void *arg)
+proc_signal_cb(int signo, __unused short events, void *arg)
{
struct tmuxproc *tp = arg;
diff --git a/screen-write.c b/screen-write.c
index a887b0f1..53067efe 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -42,7 +42,7 @@ screen_write_start(struct screen_write_ctx *ctx, struct window_pane *wp,
/* Finish writing. */
void
-screen_write_stop(unused struct screen_write_ctx *ctx)
+screen_write_stop(__unused struct screen_write_ctx *ctx)
{
}
diff --git a/server-client.c b/server-client.c
index 6c8b121a..cf7e2582 100644
--- a/server-client.c
+++ b/server-client.c
@@ -244,7 +244,7 @@ server_client_unref(struct client *c)
/* Free dead client. */
void
-server_client_free(unused int fd, unused short events, void *arg)
+server_client_free(__unused int fd, __unused short events, void *arg)
{
struct client *c = arg;
@@ -826,7 +826,7 @@ server_client_reset_state(struct client *c)
/* Repeat time callback. */
void
-server_client_repeat_timer(unused int fd, unused short events, void *data)
+server_client_repeat_timer(__unused int fd, __unused short events, void *data)
{
struct client *c = data;
@@ -1227,7 +1227,7 @@ server_client_dispatch_shell(struct client *c)
/* Event callback to push more stdout data if any left. */
static void
-server_client_stdout_cb(unused int fd, unused short events, void *arg)
+server_client_stdout_cb(__unused int fd, __unused short events, void *arg)
{
struct client *c = arg;
@@ -1268,7 +1268,7 @@ server_client_push_stdout(struct client *c)
/* Event callback to push more stderr data if any left. */
static void
-server_client_stderr_cb(unused int fd, unused short events, void *arg)
+server_client_stderr_cb(__unused int fd, __unused short events, void *arg)
{
struct client *c = arg;
diff --git a/server-fn.c b/server-fn.c
index 7c3dada7..56c98462 100644
--- a/server-fn.c
+++ b/server-fn.c
@@ -444,7 +444,7 @@ server_clear_identify(struct client *c)
}
void
-server_callback_identify(unused int fd, unused short events, void *data)
+server_callback_identify(__unused int fd, __unused short events, void *data)
{
struct client *c = data;
diff --git a/server.c b/server.c
index 4e2304b3..052ca4d9 100644
--- a/server.c
+++ b/server.c
@@ -300,7 +300,7 @@ server_update_socket(void)
/* Callback for server socket. */
void
-server_accept(int fd, short events, unused void *data)
+server_accept(int fd, short events, __unused void *data)
{
struct sockaddr_storage sa;
socklen_t slen = sizeof sa;
diff --git a/session.c b/session.c
index 8d051710..09e3898e 100644
--- a/session.c
+++ b/session.c
@@ -180,7 +180,7 @@ session_unref(struct session *s)
/* Free session. */
void
-session_free(unused int fd, unused short events, void *arg)
+session_free(__unused int fd, __unused short events, void *arg)
{
struct session *s = arg;
@@ -235,7 +235,7 @@ session_check_name(const char *name)
/* Lock session if it has timed out. */
void
-session_lock_timer(unused int fd, unused short events, void *arg)
+session_lock_timer(__unused int fd, __unused short events, void *arg)
{
struct session *s = arg;
diff --git a/status.c b/status.c
index 326e5ad8..e09ac592 100644
--- a/status.c
+++ b/status.c
@@ -145,7 +145,7 @@ status_prompt_save_history(void)
/* Status timer callback. */
void
-status_timer_callback(unused int fd, unused short events, void *arg)
+status_timer_callback(__unused int fd, __unused short events, void *arg)
{
struct client *c = arg;
struct session *s = c->session;
@@ -604,7 +604,7 @@ status_message_clear(struct client *c)
/* Clear status line message after timer expires. */
void
-status_message_callback(unused int fd, unused short event, void *data)
+status_message_callback(__unused int fd, __unused short event, void *data)
{
struct client *c = data;
diff --git a/tmux.1 b/tmux.1
index 67116f8c..0a193bfb 100644
--- a/tmux.1
+++ b/tmux.1
@@ -3315,6 +3315,13 @@ prefixes are
and
.Xr dirname 3
of the variable respectively.
+A prefix of the form
+.Ql s/foo/bar/:
+will substitute
+.Ql foo
+with
+.Ql bar
+throughout.
.Pp
In addition, the first line of a shell command's output may be inserted using
.Ql #() .
diff --git a/tmux.h b/tmux.h
index 13cdf1b4..9923a721 100644
--- a/tmux.h
+++ b/tmux.h
@@ -72,9 +72,6 @@ struct tmuxproc;
#define READ_BACKOFF 512
#define READ_TIME 100
-/* Definition to shut gcc up about unused arguments. */
-#define unused __attribute__ ((unused))
-
/* Attribute to make gcc check printf-like arguments. */
#define printflike(a, b) __attribute__ ((format (printf, a, b)))
diff --git a/tty-keys.c b/tty-keys.c
index 52dae4f7..706dcc30 100644
--- a/tty-keys.c
+++ b/tty-keys.c
@@ -635,7 +635,7 @@ discard_key:
/* Key timer callback. */
void
-tty_keys_callback(unused int fd, unused short events, void *data)
+tty_keys_callback(__unused int fd, __unused short events, void *data)
{
struct tty *tty = data;
diff --git a/tty.c b/tty.c
index e67ebbb6..13ca7f8e 100644
--- a/tty.c
+++ b/tty.c
@@ -172,7 +172,7 @@ tty_open(struct tty *tty, char **cause)
}
void
-tty_read_callback(unused struct bufferevent *bufev, void *data)
+tty_read_callback(__unused struct bufferevent *bufev, void *data)
{
struct tty *tty = data;
@@ -181,8 +181,8 @@ tty_read_callback(unused struct bufferevent *bufev, void *data)
}
void
-tty_error_callback(
- unused struct bufferevent *bufev, unused short what, unused void *data)
+tty_error_callback(__unused struct bufferevent *bufev, __unused short what,
+ __unused void *data)
{
}
@@ -591,7 +591,7 @@ tty_repeat_space(struct tty *tty, u_int n)
* pane.
*/
int
-tty_large_region(unused struct tty *tty, const struct tty_ctx *ctx)
+tty_large_region(__unused struct tty *tty, const struct tty_ctx *ctx)
{
struct window_pane *wp = ctx->wp;
diff --git a/window-choose.c b/window-choose.c
index 5f406c78..cab3e5d8 100644
--- a/window-choose.c
+++ b/window-choose.c
@@ -509,8 +509,8 @@ window_choose_get_item(struct window_pane *wp, key_code key,
}
void
-window_choose_key(struct window_pane *wp, unused struct client *c,
- unused struct session *sess, key_code key, struct mouse_event *m)
+window_choose_key(struct window_pane *wp, __unused struct client *c,
+ __unused struct session *sess, key_code key, struct mouse_event *m)
{
struct window_choose_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
diff --git a/window-clock.c b/window-clock.c
index 51f97250..e8451f22 100644
--- a/window-clock.c
+++ b/window-clock.c
@@ -120,7 +120,7 @@ const char window_clock_table[14][5][5] = {
};
void
-window_clock_timer_callback(unused int fd, unused short events, void *arg)
+window_clock_timer_callback(__unused int fd, __unused short events, void *arg)
{
struct window_pane *wp = arg;
struct window_clock_mode_data *data = wp->modedata;
@@ -185,9 +185,9 @@ window_clock_resize(struct window_pane *wp, u_int sx, u_int sy)
}
void
-window_clock_key(struct window_pane *wp, unused struct client *c,
- unused struct session *sess, unused key_code key,
- unused struct mouse_event *m)
+window_clock_key(struct window_pane *wp, __unused struct client *c,
+ __unused struct session *sess, __unused key_code key,
+ __unused struct mouse_event *m)
{
window_pane_reset_mode(wp);
}
diff --git a/window-copy.c b/window-copy.c
index a28cdecc..37025302 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -2232,7 +2232,7 @@ window_copy_rectangle_toggle(struct window_pane *wp)
}
void
-window_copy_start_drag(struct client *c, unused struct mouse_event *m)
+window_copy_start_drag(struct client *c, struct mouse_event *m)
{
struct window_pane *wp;
u_int x, y;
@@ -2253,7 +2253,7 @@ window_copy_start_drag(struct client *c, unused struct mouse_event *m)
}
void
-window_copy_drag_update(unused struct client *c, struct mouse_event *m)
+window_copy_drag_update(__unused struct client *c, struct mouse_event *m)
{
struct window_pane *wp;
struct window_copy_mode_data *data;
@@ -2274,7 +2274,7 @@ window_copy_drag_update(unused struct client *c, struct mouse_event *m)
}
void
-window_copy_drag_release(unused struct client *c, struct mouse_event *m)
+window_copy_drag_release(__unused struct client *c, struct mouse_event *m)
{
struct window_pane *wp;
diff --git a/window.c b/window.c
index 831abcd3..d7eb22a2 100644
--- a/window.c
+++ b/window.c
@@ -929,13 +929,13 @@ window_pane_spawn(struct window_pane *wp, int argc, char **argv,
}
void
-window_pane_timer_callback(unused int fd, unused short events, void *data)
+window_pane_timer_callback(__unused int fd, __unused short events, void *data)
{
window_pane_read_callback(NULL, data);
}
void
-window_pane_read_callback(unused struct bufferevent *bufev, void *data)
+window_pane_read_callback(__unused struct bufferevent *bufev, void *data)
{
struct window_pane *wp = data;
struct evbuffer *evb = wp->event->input;
@@ -981,8 +981,8 @@ start_timer:
}
void
-window_pane_error_callback(unused struct bufferevent *bufev, unused short what,
- void *data)
+window_pane_error_callback(__unused struct bufferevent *bufev,
+ __unused short what, void *data)
{
struct window_pane *wp = data;