From 941eab33e9722b26244e7f344311f065eb28ef44 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 30 Oct 2007 10:59:43 +0000 Subject: [PATCH] %u -> %d for indexes. Some lint fixes. --- Makefile | 5 ++++- cmd-kill-window.c | 4 ++-- cmd-link-window.c | 4 ++-- cmd-list-windows.c | 4 ++-- cmd-rename-window.c | 4 ++-- cmd-select-window.c | 4 ++-- cmd-set-option.c | 8 ++++---- cmd-unlink-window.c | 4 ++-- cmd.c | 4 ++-- server-fn.c | 4 ++-- server.c | 5 ++--- status.c | 4 ++-- 12 files changed, 28 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index f908b128..9dbb50c2 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.33 2007-10-26 16:57:32 nicm Exp $ +# $Id: Makefile,v 1.34 2007-10-30 10:59:42 nicm Exp $ .SUFFIXES: .c .o .y .h .PHONY: clean @@ -80,6 +80,9 @@ ${PROG}: ${OBJS} depend: mkdep ${CFLAGS} ${INCDIRS} ${SRCS:M*.c} +lint: + lint -cehvx ${CFLAGS:M-D*} ${SRCS:M*.c} + clean: rm -f ${CLEANFILES} diff --git a/cmd-kill-window.c b/cmd-kill-window.c index 401d6faa..5c6b6d57 100644 --- a/cmd-kill-window.c +++ b/cmd-kill-window.c @@ -1,4 +1,4 @@ -/* $Id: cmd-kill-window.c,v 1.3 2007-10-26 16:57:32 nicm Exp $ */ +/* $Id: cmd-kill-window.c,v 1.4 2007-10-30 10:59:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -102,7 +102,7 @@ cmd_kill_window_exec(void *ptr, struct cmd_ctx *ctx) if (data->idx == -1) wl = s->curw; else if ((wl = winlink_find_by_index(&s->windows, data->idx)) == NULL) { - ctx->error(ctx, "no window %u", data->idx); + ctx->error(ctx, "no window %d", data->idx); return; } diff --git a/cmd-link-window.c b/cmd-link-window.c index ee8ddd83..4295232d 100644 --- a/cmd-link-window.c +++ b/cmd-link-window.c @@ -1,4 +1,4 @@ -/* $Id: cmd-link-window.c,v 1.3 2007-10-26 16:57:32 nicm Exp $ */ +/* $Id: cmd-link-window.c,v 1.4 2007-10-30 10:59:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -125,7 +125,7 @@ cmd_link_window_exec(void *ptr, struct cmd_ctx *ctx) else { wl = winlink_find_by_index(&src->windows, data->srcidx); if (wl == NULL) { - ctx->error(ctx, "no window %u", data->srcidx); + ctx->error(ctx, "no window %d", data->srcidx); return; } } diff --git a/cmd-list-windows.c b/cmd-list-windows.c index a2bce816..2040d0eb 100644 --- a/cmd-list-windows.c +++ b/cmd-list-windows.c @@ -1,4 +1,4 @@ -/* $Id: cmd-list-windows.c,v 1.4 2007-10-26 12:29:07 nicm Exp $ */ +/* $Id: cmd-list-windows.c,v 1.5 2007-10-30 10:59:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -49,7 +49,7 @@ cmd_list_windows_exec(unused void *ptr, struct cmd_ctx *ctx) RB_FOREACH(wl, winlinks, &s->windows) { w = wl->window; - ctx->print(ctx, "%u: %s \"%s\" (%s) [%ux%u]", wl->idx, + ctx->print(ctx, "%d: %s \"%s\" (%s) [%ux%u]", wl->idx, w->name, w->screen.title, ttyname(w->fd), w->screen.sx, w->screen.sy); } diff --git a/cmd-rename-window.c b/cmd-rename-window.c index 6a949cc0..3d46bbc2 100644 --- a/cmd-rename-window.c +++ b/cmd-rename-window.c @@ -1,4 +1,4 @@ -/* $Id: cmd-rename-window.c,v 1.9 2007-10-26 16:57:32 nicm Exp $ */ +/* $Id: cmd-rename-window.c,v 1.10 2007-10-30 10:59:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -104,7 +104,7 @@ cmd_rename_window_exec(void *ptr, struct cmd_ctx *ctx) if (data->idx == -1) wl = s->curw; else if ((wl = winlink_find_by_index(&s->windows, data->idx)) == NULL) { - ctx->error(ctx, "no window %u", data->idx); + ctx->error(ctx, "no window %d", data->idx); return; } xfree(wl->window->name); diff --git a/cmd-select-window.c b/cmd-select-window.c index 8685dd30..7b260ad3 100644 --- a/cmd-select-window.c +++ b/cmd-select-window.c @@ -1,4 +1,4 @@ -/* $Id: cmd-select-window.c,v 1.6 2007-10-26 16:57:32 nicm Exp $ */ +/* $Id: cmd-select-window.c,v 1.7 2007-10-30 10:59:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -115,7 +115,7 @@ cmd_select_window_exec(void *ptr, struct cmd_ctx *ctx) case 1: break; default: - ctx->error(ctx, "no window %u", data->idx); + ctx->error(ctx, "no window %d", data->idx); break; } diff --git a/cmd-set-option.c b/cmd-set-option.c index 24d4a2f6..dff7361d 100644 --- a/cmd-set-option.c +++ b/cmd-set-option.c @@ -1,4 +1,4 @@ -/* $Id: cmd-set-option.c,v 1.10 2007-10-20 09:57:08 nicm Exp $ */ +/* $Id: cmd-set-option.c,v 1.11 2007-10-30 10:59:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -90,8 +90,8 @@ cmd_set_option_exec(void *ptr, unused struct cmd_ctx *ctx) struct cmd_set_option_data *data = ptr; struct client *c = ctx->client; const char *errstr; - u_int number, i; - int bool, key; + u_int i; + int number, bool, key; if (data == NULL) return; @@ -103,7 +103,7 @@ cmd_set_option_exec(void *ptr, unused struct cmd_ctx *ctx) number = -1; if (data->value != NULL) { - number = strtonum(data->value, 0, UINT_MAX, &errstr); + number = strtonum(data->value, 0, INT_MAX, &errstr); bool = -1; if (number == 1 || strcasecmp(data->value, "on") == 0 || diff --git a/cmd-unlink-window.c b/cmd-unlink-window.c index ea3c0aa4..be3b6f58 100644 --- a/cmd-unlink-window.c +++ b/cmd-unlink-window.c @@ -1,4 +1,4 @@ -/* $Id: cmd-unlink-window.c,v 1.1 2007-10-26 16:57:32 nicm Exp $ */ +/* $Id: cmd-unlink-window.c,v 1.2 2007-10-30 10:59:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -106,7 +106,7 @@ cmd_unlink_window_exec(void *ptr, struct cmd_ctx *ctx) else { wl = winlink_find_by_index(&s->windows, data->idx); if (wl == NULL) { - ctx->error(ctx, "no window %u", data->idx); + ctx->error(ctx, "no window %d", data->idx); return; } } diff --git a/cmd.c b/cmd.c index c71d52ee..2f7d3064 100644 --- a/cmd.c +++ b/cmd.c @@ -1,4 +1,4 @@ -/* $Id: cmd.c,v 1.22 2007-10-26 16:57:32 nicm Exp $ */ +/* $Id: cmd.c,v 1.23 2007-10-30 10:59:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -113,7 +113,7 @@ usage: void cmd_exec(struct cmd *cmd, struct cmd_ctx *ctx) { - return (cmd->entry->exec(cmd->data, ctx)); + cmd->entry->exec(cmd->data, ctx); } void diff --git a/server-fn.c b/server-fn.c index 536ad781..a04b181c 100644 --- a/server-fn.c +++ b/server-fn.c @@ -1,4 +1,4 @@ -/* $Id: server-fn.c,v 1.23 2007-10-26 12:29:07 nicm Exp $ */ +/* $Id: server-fn.c,v 1.24 2007-10-30 10:59:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -44,7 +44,7 @@ server_extract_session(struct msg_command_data *data, char *name, char **cause) return (NULL); } if (data->idx > ARRAY_LENGTH(&sessions)) { - xasprintf(cause, "index out of range: %u", data->idx); + xasprintf(cause, "index out of range: %d", data->idx); return (NULL); } if ((s = ARRAY_ITEM(&sessions, data->idx)) == NULL) { diff --git a/server.c b/server.c index 81c0cddd..3a0290b3 100644 --- a/server.c +++ b/server.c @@ -1,4 +1,4 @@ -/* $Id: server.c,v 1.35 2007-10-26 12:29:07 nicm Exp $ */ +/* $Id: server.c,v 1.36 2007-10-30 10:59:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -59,11 +59,10 @@ server_start(char *path) { struct sockaddr_un sa; size_t size; - pid_t pid; mode_t mask; int n, fd, mode; - switch (pid = fork()) { + switch (fork()) { case -1: log_warn("fork"); return (-1); diff --git a/status.c b/status.c index 0f1b5680..ad0ef1b2 100644 --- a/status.c +++ b/status.c @@ -1,4 +1,4 @@ -/* $Id: status.c,v 1.7 2007-10-26 12:29:07 nicm Exp $ */ +/* $Id: status.c,v 1.8 2007-10-30 10:59:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -47,7 +47,7 @@ status_write(struct client *c) if (session_hasbell(c->session, wl)) flag = '!'; status_print( - b, &size, "%u:%s%c ", wl->idx, wl->window->name, flag); + b, &size, "%d:%s%c ", wl->idx, wl->window->name, flag); if (size == 0) break;