aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch-show.c
diff options
context:
space:
mode:
authorAustin Clements <amdragon@MIT.EDU>2012-04-07 20:57:49 -0400
committerDavid Bremner <bremner@debian.org>2012-04-15 09:42:15 -0300
commit67da35222c73672d61050c0561757c0b739e9195 (patch)
tree3486bd4d87eb0d6c82d8fcad5b3fcca94a313d55 /notmuch-show.c
parent9070e5cc432b7dcad09a47508f6ade34ff63d47d (diff)
show: Support NULL values for message_set_{start, sep, end}
Many formats don't need these, so it's more convenient if they don't have to set them at all.
Diffstat (limited to 'notmuch-show.c')
-rw-r--r--notmuch-show.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/notmuch-show.c b/notmuch-show.c
index 69164bda..aa909324 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -845,17 +845,19 @@ show_messages (void *ctx,
int next_indent;
notmuch_status_t status, res = NOTMUCH_STATUS_SUCCESS;
- fputs (format->message_set_start, stdout);
+ if (format->message_set_start)
+ fputs (format->message_set_start, stdout);
for (;
notmuch_messages_valid (messages);
notmuch_messages_move_to_next (messages))
{
- if (!first_set)
+ if (!first_set && format->message_set_sep)
fputs (format->message_set_sep, stdout);
first_set = 0;
- fputs (format->message_set_start, stdout);
+ if (format->message_set_start)
+ fputs (format->message_set_start, stdout);
message = notmuch_messages_get (messages);
@@ -870,7 +872,7 @@ show_messages (void *ctx,
res = status;
next_indent = indent + 1;
- if (!status)
+ if (!status && format->message_set_sep)
fputs (format->message_set_sep, stdout);
}
@@ -884,10 +886,12 @@ show_messages (void *ctx,
notmuch_message_destroy (message);
- fputs (format->message_set_end, stdout);
+ if (format->message_set_end)
+ fputs (format->message_set_end, stdout);
}
- fputs (format->message_set_end, stdout);
+ if (format->message_set_end)
+ fputs (format->message_set_end, stdout);
return res;
}
@@ -933,7 +937,8 @@ do_show (void *ctx,
int first_toplevel = 1;
notmuch_status_t status, res = NOTMUCH_STATUS_SUCCESS;
- fputs (format->message_set_start, stdout);
+ if (format->message_set_start)
+ fputs (format->message_set_start, stdout);
for (threads = notmuch_query_search_threads (query);
notmuch_threads_valid (threads);
@@ -947,7 +952,7 @@ do_show (void *ctx,
INTERNAL_ERROR ("Thread %s has no toplevel messages.\n",
notmuch_thread_get_thread_id (thread));
- if (!first_toplevel)
+ if (!first_toplevel && format->message_set_sep)
fputs (format->message_set_sep, stdout);
first_toplevel = 0;
@@ -959,7 +964,8 @@ do_show (void *ctx,
}
- fputs (format->message_set_end, stdout);
+ if (format->message_set_end)
+ fputs (format->message_set_end, stdout);
return res != NOTMUCH_STATUS_SUCCESS;
}