From ed62d1263ca180e8b088111bf77b8c7b4b2073de Mon Sep 17 00:00:00 2001 From: Theo Deraadt Date: Mon, 26 Oct 2009 21:42:04 +0000 Subject: [PATCH] tabs are better; ok nicm --- array.h | 2 +- cfg.c | 4 +-- cmd-server-info.c | 4 +-- cmd-string.c | 40 +++++++++++++++--------------- cmd.c | 4 +-- input.c | 6 ++--- server-client.c | 4 +-- server.c | 8 +++--- tmux.c | 10 ++++---- tty.c | 2 +- xmalloc.c | 62 +++++++++++++++++++++++------------------------ 11 files changed, 73 insertions(+), 73 deletions(-) diff --git a/array.h b/array.h index 46855d77..c5ed3d02 100644 --- a/array.h +++ b/array.h @@ -85,7 +85,7 @@ ARRAY_ITEMSIZE(a) * ((a)->num - (i) - 1)); \ } \ (a)->num--; \ - if ((a)->num == 0) \ + if ((a)->num == 0) \ ARRAY_FREE(a); \ } while (0) diff --git a/cfg.c b/cfg.c index d50eaae7..5f314b7b 100644 --- a/cfg.c +++ b/cfg.c @@ -53,9 +53,9 @@ cfg_error(unused struct cmd_ctx *ctx, const char *fmt, ...) int load_cfg(const char *path, struct cmd_ctx *ctxin, char **cause) { - FILE *f; + FILE *f; u_int n; - char *buf, *line, *ptr; + char *buf, *line, *ptr; size_t len; struct cmd_list *cmdlist; struct cmd_ctx ctx; diff --git a/cmd-server-info.c b/cmd-server-info.c index 7ad7bdd6..b4cce636 100644 --- a/cmd-server-info.c +++ b/cmd-server-info.c @@ -70,8 +70,8 @@ cmd_server_info_exec(unused struct cmd *self, struct cmd_ctx *ctx) ctx->print(ctx, "pid %ld, started %s", (long) getpid(), tim); ctx->print(ctx, "socket path %s, debug level %d%s", socket_path, debug_level, be_quiet ? ", quiet" : ""); - if (uname(&un) == 0) { - ctx->print(ctx, "system is %s %s %s %s", + if (uname(&un) == 0) { + ctx->print(ctx, "system is %s %s %s %s", un.sysname, un.release, un.version, un.machine); } if (cfg_file != NULL) diff --git a/cmd-string.c b/cmd-string.c index 41b20948..06f01a54 100644 --- a/cmd-string.c +++ b/cmd-string.c @@ -204,33 +204,33 @@ cmd_string_string(const char *s, size_t *p, char endch, int esc) char *buf, *t; size_t len; - buf = NULL; + buf = NULL; len = 0; - while ((ch = cmd_string_getc(s, p)) != endch) { - switch (ch) { + while ((ch = cmd_string_getc(s, p)) != endch) { + switch (ch) { case EOF: goto error; - case '\\': + case '\\': if (!esc) break; - switch (ch = cmd_string_getc(s, p)) { + switch (ch = cmd_string_getc(s, p)) { case EOF: goto error; case 'e': ch = '\033'; break; - case 'r': - ch = '\r'; - break; - case 'n': - ch = '\n'; - break; - case 't': - ch = '\t'; - break; - } - break; + case 'r': + ch = '\r'; + break; + case 'n': + ch = '\n'; + break; + case 't': + ch = '\t'; + break; + } + break; case '$': if (!esc) break; @@ -241,13 +241,13 @@ cmd_string_string(const char *s, size_t *p, char endch, int esc) len += strlen(t); xfree(t); continue; - } + } if (len >= SIZE_MAX - 2) goto error; buf = xrealloc(buf, 1, len + 1); - buf[len++] = ch; - } + buf[len++] = ch; + } buf = xrealloc(buf, 1, len + 1); buf[len] = '\0'; @@ -272,7 +272,7 @@ cmd_string_variable(const char *s, size_t *p) ((ch) >= 'a' && (ch) <= 'z') || ((ch) >= 'A' && (ch) <= 'Z') || \ ((ch) >= '0' && (ch) <= '9')) - buf = NULL; + buf = NULL; len = 0; fch = EOF; diff --git a/cmd.c b/cmd.c index bf07c3b0..96a06b6c 100644 --- a/cmd.c +++ b/cmd.c @@ -179,7 +179,7 @@ struct cmd * cmd_parse(int argc, char **argv, char **cause) { const struct cmd_entry **entryp, *entry; - struct cmd *cmd; + struct cmd *cmd; char s[BUFSIZ]; int opt, ambiguous = 0; @@ -842,7 +842,7 @@ cmd_find_pane(struct cmd_ctx *ctx, /* Get the current session. */ if ((s = cmd_current_session(ctx)) == NULL) { - ctx->error(ctx, "can't establish current session"); + ctx->error(ctx, "can't establish current session"); return (NULL); } if (sp != NULL) diff --git a/input.c b/input.c index bb6ac496..f0a566e5 100644 --- a/input.c +++ b/input.c @@ -128,7 +128,7 @@ input_sequence_cmp(const void *a, const void *b) void input_new_argument(struct input_ctx *ictx) { - struct input_arg *arg; + struct input_arg *arg; ARRAY_EXPAND(&ictx->args, 1); @@ -139,7 +139,7 @@ input_new_argument(struct input_ctx *ictx) int input_add_argument(struct input_ctx *ictx, u_char ch) { - struct input_arg *arg; + struct input_arg *arg; if (ARRAY_LENGTH(&ictx->args) == 0) return (0); @@ -792,7 +792,7 @@ input_handle_sequence(u_char ch, struct input_ctx *ictx) { struct input_sequence_entry *entry, find; struct screen *s = ictx->ctx.s; - u_int i; + u_int i; struct input_arg *iarg; log_debug2("-- sq %zu: %hhu (%c): %u [sx=%u, sy=%u, cx=%u, cy=%u, " diff --git a/server-client.c b/server-client.c index 5038a036..0cc943d5 100644 --- a/server-client.c +++ b/server-client.c @@ -492,8 +492,8 @@ server_client_msg_dispatch(struct client *c) struct msg_environ_data environdata; ssize_t n, datalen; - if ((n = imsg_read(&c->ibuf)) == -1 || n == 0) - return (-1); + if ((n = imsg_read(&c->ibuf)) == -1 || n == 0) + return (-1); for (;;) { if ((n = imsg_get(&c->ibuf, &imsg)) == -1) diff --git a/server.c b/server.c index 78c5af94..b7b35892 100644 --- a/server.c +++ b/server.c @@ -667,12 +667,12 @@ void server_lock_sessions(void) { struct session *s; - u_int i; + u_int i; int timeout; - time_t t; + time_t t; - t = time(NULL); - for (i = 0; i < ARRAY_LENGTH(&sessions); i++) { + t = time(NULL); + for (i = 0; i < ARRAY_LENGTH(&sessions); i++) { if ((s = ARRAY_ITEM(&sessions, i)) == NULL) continue; diff --git a/tmux.c b/tmux.c index add7289e..51f8dbef 100644 --- a/tmux.c +++ b/tmux.c @@ -344,10 +344,10 @@ main(int argc, char **argv) case 'v': debug_level++; break; - default: + default: usage(); - } - } + } + } argc -= optind; argv += optind; @@ -569,7 +569,7 @@ main(int argc, char **argv) if (pfd.revents & (POLLERR|POLLHUP|POLLNVAL)) fatalx("socket error"); - if (pfd.revents & POLLIN) { + if (pfd.revents & POLLIN) { if (dispatch_imsg(ibuf, shellcmd, &retcode) != 0) break; } @@ -594,7 +594,7 @@ dispatch_imsg(struct imsgbuf *ibuf, const char *shellcmd, int *retcode) struct msg_print_data printdata; struct msg_shell_data shelldata; - if ((n = imsg_read(ibuf)) == -1 || n == 0) + if ((n = imsg_read(ibuf)) == -1 || n == 0) fatalx("imsg_read failed"); for (;;) { diff --git a/tty.c b/tty.c index d329e15b..b0a91ffc 100644 --- a/tty.c +++ b/tty.c @@ -144,7 +144,7 @@ tty_start_tty(struct tty *tty) tio.c_lflag &= ~(IEXTEN|ICANON|ECHO|ECHOE|ECHONL|ECHOCTL| ECHOPRT|ECHOKE|ECHOCTL|ISIG); tio.c_cc[VMIN] = 1; - tio.c_cc[VTIME] = 0; + tio.c_cc[VTIME] = 0; if (tcsetattr(tty->fd, TCSANOW, &tio) != 0) fatal("tcsetattr failed"); diff --git a/xmalloc.c b/xmalloc.c index 5eb5c4a8..43b0080d 100644 --- a/xmalloc.c +++ b/xmalloc.c @@ -42,16 +42,16 @@ xstrdup(const char *s) void * xcalloc(size_t nmemb, size_t size) { - void *ptr; + void *ptr; - if (size == 0 || nmemb == 0) + if (size == 0 || nmemb == 0) fatalx("zero size"); - if (SIZE_MAX / nmemb < size) - fatalx("nmemb * size > SIZE_MAX"); - if ((ptr = calloc(nmemb, size)) == NULL) + if (SIZE_MAX / nmemb < size) + fatalx("nmemb * size > SIZE_MAX"); + if ((ptr = calloc(nmemb, size)) == NULL) fatal("xcalloc failed"); - return (ptr); + return (ptr); } void * @@ -59,12 +59,12 @@ xmalloc(size_t size) { void *ptr; - if (size == 0) - fatalx("zero size"); - if ((ptr = malloc(size)) == NULL) + if (size == 0) + fatalx("zero size"); + if ((ptr = malloc(size)) == NULL) fatal("xmalloc failed"); - return (ptr); + return (ptr); } void * @@ -74,13 +74,13 @@ xrealloc(void *oldptr, size_t nmemb, size_t size) void *newptr; if (newsize == 0) - fatalx("zero size"); - if (SIZE_MAX / nmemb < size) - fatalx("nmemb * size > SIZE_MAX"); - if ((newptr = realloc(oldptr, newsize)) == NULL) + fatalx("zero size"); + if (SIZE_MAX / nmemb < size) + fatalx("nmemb * size > SIZE_MAX"); + if ((newptr = realloc(oldptr, newsize)) == NULL) fatal("xrealloc failed"); - return (newptr); + return (newptr); } void @@ -94,12 +94,12 @@ xfree(void *ptr) int printflike2 xasprintf(char **ret, const char *fmt, ...) { - va_list ap; - int i; + va_list ap; + int i; - va_start(ap, fmt); - i = xvasprintf(ret, fmt, ap); - va_end(ap); + va_start(ap, fmt); + i = xvasprintf(ret, fmt, ap); + va_end(ap); return (i); } @@ -110,21 +110,21 @@ xvasprintf(char **ret, const char *fmt, va_list ap) int i; i = vasprintf(ret, fmt, ap); - if (i < 0 || *ret == NULL) - fatal("xvasprintf failed"); + if (i < 0 || *ret == NULL) + fatal("xvasprintf failed"); - return (i); + return (i); } int printflike3 xsnprintf(char *buf, size_t len, const char *fmt, ...) { - va_list ap; - int i; + va_list ap; + int i; - va_start(ap, fmt); - i = xvsnprintf(buf, len, fmt, ap); - va_end(ap); + va_start(ap, fmt); + i = xvsnprintf(buf, len, fmt, ap); + va_end(ap); return (i); } @@ -138,8 +138,8 @@ xvsnprintf(char *buf, size_t len, const char *fmt, va_list ap) fatalx("len > INT_MAX"); i = vsnprintf(buf, len, fmt, ap); - if (i < 0) - fatal("vsnprintf failed"); + if (i < 0) + fatal("vsnprintf failed"); - return (i); + return (i); }