summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/status.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-11-04 21:04:44 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-11-04 21:04:44 +0000
commit69b2d345034deaad1ed3e6a7107713027c4989c3 (patch)
tree33ea0416fb67067f8a46f96f2b4de8ab5f7b5bcf /usr.bin/tmux/status.c
parentc4951f362efa741b6aaf42f94c0cfb7073db3d9f (diff)
Switch jobs over to use a bufferevent.
Diffstat (limited to 'usr.bin/tmux/status.c')
-rw-r--r--usr.bin/tmux/status.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c
index 6c5220c36a1..94e27f7e764 100644
--- a/usr.bin/tmux/status.c
+++ b/usr.bin/tmux/status.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: status.c,v 1.40 2009/11/04 20:35:19 nicm Exp $ */
+/* $OpenBSD: status.c,v 1.41 2009/11/04 21:04:43 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -486,23 +486,26 @@ status_job(struct client *c, char **iptr)
void
status_job_callback(struct job *job)
{
- char *buf;
+ char *line, *buf;
size_t len;
- len = BUFFER_USED(job->out);
- buf = xmalloc(len + 1);
- if (len != 0)
- buffer_read(job->out, buf, len);
- buf[len] = '\0';
- buf[strcspn(buf, "\n")] = '\0';
+ buf = NULL;
+ if ((line = evbuffer_readline(job->event->input)) == NULL) {
+ len = EVBUFFER_LENGTH(job->event->input);
+ buf = xmalloc(len + 1);
+ if (len != 0)
+ memcpy(buf, EVBUFFER_DATA(job->event->input), len);
+ buf[len] = '\0';
+ }
if (job->data != NULL)
xfree(job->data);
else
server_redraw_client(job->client);
- job->data = xstrdup(buf);
+ job->data = xstrdup(line);
- xfree(buf);
+ if (buf != NULL)
+ xfree(buf);
}
size_t