diff options
author | 2016-10-16 19:04:05 +0000 | |
---|---|---|
committer | 2016-10-16 19:04:05 +0000 | |
commit | 68e0a7f271bc1c08e58a23a65844d346c6665089 (patch) | |
tree | 315962d2740c0dca5e710bb5c9db0ac9878f55ba /usr.bin/tmux/cmd-load-buffer.c | |
parent | Replace fs/msdosfs/{msdosfs_conv.c,direntry.h} with stripped-down (diff) | |
download | wireguard-openbsd-68e0a7f271bc1c08e58a23a65844d346c6665089.tar.xz wireguard-openbsd-68e0a7f271bc1c08e58a23a65844d346c6665089.zip |
Mass rename struct cmd_q to struct cmdq_item and related.
Diffstat (limited to 'usr.bin/tmux/cmd-load-buffer.c')
-rw-r--r-- | usr.bin/tmux/cmd-load-buffer.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/usr.bin/tmux/cmd-load-buffer.c b/usr.bin/tmux/cmd-load-buffer.c index cac5835dd2b..ab9fd22aa1e 100644 --- a/usr.bin/tmux/cmd-load-buffer.c +++ b/usr.bin/tmux/cmd-load-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-load-buffer.c,v 1.45 2016/10/16 17:55:14 nicm Exp $ */ +/* $OpenBSD: cmd-load-buffer.c,v 1.46 2016/10/16 19:04:05 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -31,9 +31,9 @@ * Loads a paste buffer from a file. */ -static enum cmd_retval cmd_load_buffer_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_load_buffer_exec(struct cmd *, struct cmdq_item *); -static void cmd_load_buffer_callback(struct client *, int, void *); +static void cmd_load_buffer_callback(struct client *, int, void *); const struct cmd_entry cmd_load_buffer_entry = { .name = "load-buffer", @@ -47,16 +47,16 @@ const struct cmd_entry cmd_load_buffer_entry = { }; struct cmd_load_buffer_data { - struct cmd_q *cmdq; - char *bufname; + struct cmdq_item *item; + char *bufname; }; static enum cmd_retval -cmd_load_buffer_exec(struct cmd *self, struct cmd_q *cmdq) +cmd_load_buffer_exec(struct cmd *self, struct cmdq_item *item) { struct args *args = self->args; struct cmd_load_buffer_data *cdata; - struct client *c = cmdq->client; + struct client *c = item->client; struct session *s; FILE *f; const char *path, *bufname, *cwd; @@ -72,13 +72,13 @@ cmd_load_buffer_exec(struct cmd *self, struct cmd_q *cmdq) path = args->argv[0]; if (strcmp(path, "-") == 0) { cdata = xcalloc(1, sizeof *cdata); - cdata->cmdq = cmdq; + cdata->item = item; cdata->bufname = xstrdup(bufname); error = server_set_stdin_callback(c, cmd_load_buffer_callback, cdata, &cause); if (error != 0) { - cmdq_error(cmdq, "%s: %s", path, cause); + cmdq_error(item, "%s: %s", path, cause); free(cause); return (CMD_RETURN_ERROR); } @@ -98,13 +98,13 @@ cmd_load_buffer_exec(struct cmd *self, struct cmd_q *cmdq) xasprintf(&file, "%s/%s", cwd, path); if (realpath(file, resolved) == NULL && strlcpy(resolved, file, sizeof resolved) >= sizeof resolved) { - cmdq_error(cmdq, "%s: %s", file, strerror(ENAMETOOLONG)); + cmdq_error(item, "%s: %s", file, strerror(ENAMETOOLONG)); return (CMD_RETURN_ERROR); } f = fopen(resolved, "rb"); free(file); if (f == NULL) { - cmdq_error(cmdq, "%s: %s", resolved, strerror(errno)); + cmdq_error(item, "%s: %s", resolved, strerror(errno)); return (CMD_RETURN_ERROR); } @@ -113,14 +113,14 @@ cmd_load_buffer_exec(struct cmd *self, struct cmd_q *cmdq) while ((ch = getc(f)) != EOF) { /* Do not let the server die due to memory exhaustion. */ if ((new_pdata = realloc(pdata, psize + 2)) == NULL) { - cmdq_error(cmdq, "realloc error: %s", strerror(errno)); + cmdq_error(item, "realloc error: %s", strerror(errno)); goto error; } pdata = new_pdata; pdata[psize++] = ch; } if (ferror(f)) { - cmdq_error(cmdq, "%s: read error", resolved); + cmdq_error(item, "%s: read error", resolved); goto error; } if (pdata != NULL) @@ -129,7 +129,7 @@ cmd_load_buffer_exec(struct cmd *self, struct cmd_q *cmdq) fclose(f); if (paste_set(pdata, psize, bufname, &cause) != 0) { - cmdq_error(cmdq, "%s", cause); + cmdq_error(item, "%s", cause); free(pdata); free(cause); return (CMD_RETURN_ERROR); @@ -180,7 +180,7 @@ cmd_load_buffer_callback(struct client *c, int closed, void *data) free(cause); } out: - cdata->cmdq->flags &= ~CMD_Q_WAITING; + cdata->item->flags &= ~CMDQ_WAITING; free(cdata->bufname); free(cdata); |