diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-09-29 13:22:15 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-09-29 13:22:15 +0000 |
commit | 653ee721df4b0464803d6cba46376b4fcbd09b82 (patch) | |
tree | 01473c0ff6aed723ac74af38073e5bf400e8ec2b /server-msg.c | |
parent | a6875d0dae0f656fe25df9380a0b3fd115edb454 (diff) |
Write error messages for rename. Also tweak some error outputs, and fix -i.
Diffstat (limited to 'server-msg.c')
-rw-r--r-- | server-msg.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/server-msg.c b/server-msg.c index 6ec36e8e..0ffa0ede 100644 --- a/server-msg.c +++ b/server-msg.c @@ -1,4 +1,4 @@ -/* $Id: server-msg.c,v 1.8 2007-09-28 22:47:21 nicm Exp $ */ +/* $Id: server-msg.c,v 1.9 2007-09-29 13:22:15 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -155,7 +155,7 @@ server_msg_fn_attach(struct hdr *hdr, struct client *c) c->sy = 25; if ((c->session = server_find_sessid(&data.sid, &cause)) == NULL) { - server_write_client(c, MSG_ERROR, cause, strlen(cause)); + server_write_error(c, "%s", cause); xfree(cause); return (0); } @@ -353,7 +353,7 @@ server_msg_fn_windows(struct hdr *hdr, struct client *c) buffer_read(c->in, &data, hdr->size); if ((s = server_find_sessid(&data.sid, &cause)) == NULL) { - server_write_client(c, MSG_ERROR, cause, strlen(cause)); + server_write_error(c, "%s", cause); xfree(cause); return (0); } @@ -396,26 +396,28 @@ server_msg_fn_rename(struct hdr *hdr, struct client *c) buffer_read(c->in, &data, hdr->size); data.newname[(sizeof data.newname) - 1] = '\0'; - if ((s = server_find_sessid(&data.sid, &cause)) == NULL) { - /* XXX: Send message to client */ + server_write_error(c, "%s", cause); + xfree(cause); return (0); } - if (data.idx == -1) + if (data.idx == -1) w = s->window; - else + else { + if (data.idx < 0) + fatalx("bad window index"); w = window_at(&s->windows, data.idx); - - if (w == NULL) { - /* XXX: Send message to client */ - return (0); + if (w == NULL) { + server_write_error(c, "window not found: %d", data.idx); + return (0); + } } strlcpy(w->name, data.newname, sizeof w->name); + server_write_client(c, MSG_DONE, NULL, 0); return (0); - } /* Last window message from client */ |