aboutsummaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-04-17 22:10:43 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-04-17 22:10:43 +0200
commitf9125c38c0e9560649f9be6c4d6565ed8fc9fb6e (patch)
tree5a9864c7b26b13a78da515a542a2f7a5a888baa9 /degesch.c
parent5b9dadcc5821c347da6da4ad6a1869e142f499e6 (diff)
downloadxK-f9125c38c0e9560649f9be6c4d6565ed8fc9fb6e.tar.gz
xK-f9125c38c0e9560649f9be6c4d6565ed8fc9fb6e.tar.xz
xK-f9125c38c0e9560649f9be6c4d6565ed8fc9fb6e.zip
degesch: prepare for printing to buffers
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/degesch.c b/degesch.c
index b1ec7fd..23e2ae1 100644
--- a/degesch.c
+++ b/degesch.c
@@ -789,9 +789,9 @@ buffer_send (struct app_context *ctx, struct buffer *buffer,
line->type = type;
line->flags = flags;
line->when = time (NULL);
- line->who = xstrdup (origin);
+ line->who = origin ? xstrdup (origin) : NULL;
line->object = str_steal (&text);
- line->reason = xstrdup (reason);
+ line->reason = reason ? xstrdup (reason) : NULL;
LIST_APPEND_WITH_TAIL (buffer->lines, buffer->lines_tail, line);
buffer->lines_count++;
@@ -804,6 +804,11 @@ buffer_send (struct app_context *ctx, struct buffer *buffer,
buffer_line_display (ctx, line);
}
+#define buffer_send_status(ctx, buffer, ...) \
+ buffer_send (ctx, buffer, BUFFER_LINE_STATUS, 0, NULL, NULL, __VA_ARGS__)
+#define buffer_send_error(ctx, buffer, ...) \
+ buffer_send (ctx, buffer, BUFFER_LINE_ERROR, 0, NULL, NULL, __VA_ARGS__)
+
static struct buffer *
buffer_by_name (struct app_context *ctx, const char *name)
{