%u -> %d for indexes. Some lint fixes.

This commit is contained in:
Nicholas Marriott 2007-10-30 10:59:43 +00:00
parent ab097f0c0c
commit 941eab33e9
12 changed files with 28 additions and 26 deletions

View File

@ -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}

View File

@ -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 <nicm@users.sourceforge.net>
@ -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;
}

View File

@ -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 <nicm@users.sourceforge.net>
@ -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;
}
}

View File

@ -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 <nicm@users.sourceforge.net>
@ -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);
}

View File

@ -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 <nicm@users.sourceforge.net>
@ -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);

View File

@ -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 <nicm@users.sourceforge.net>
@ -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;
}

View File

@ -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 <nicm@users.sourceforge.net>
@ -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 ||

View File

@ -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 <nicm@users.sourceforge.net>
@ -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;
}
}

4
cmd.c
View File

@ -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 <nicm@users.sourceforge.net>
@ -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

View File

@ -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 <nicm@users.sourceforge.net>
@ -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) {

View File

@ -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 <nicm@users.sourceforge.net>
@ -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);

View File

@ -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 <nicm@users.sourceforge.net>
@ -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;