X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-search.c;h=616fe68a12f8253045a4faa973571e1303823a2f;hp=69af6171b3461f9528460676c308749dad0e1ca3;hb=5143e5e840b5e9d95611f57fdc9d4b27af6f0564;hpb=049ac914f9041df54bfdbcb43f9356c4e74c1279 diff --git a/notmuch-search.c b/notmuch-search.c index 69af6171..616fe68a 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -111,6 +111,23 @@ format_item_id_text (unused (const void *ctx), printf ("%s%s", item_type, item_id); } +static char * +sanitize_string (const void *ctx, const char *str) +{ + char *out, *loop; + + if (NULL == str) + return NULL; + + loop = out = talloc_strdup (ctx, str); + + for (; *loop; loop++) { + if ((unsigned char)(*loop) < 32) + *loop = '?'; + } + return out; +} + static void format_thread_text (const void *ctx, const char *thread_id, @@ -120,13 +137,17 @@ format_thread_text (const void *ctx, const char *authors, const char *subject) { + void *ctx_quote = talloc_new (ctx); + printf ("thread:%s %12s [%d/%d] %s; %s", thread_id, notmuch_time_relative_date (ctx, date), matched, total, - authors, - subject); + sanitize_string (ctx_quote, authors), + sanitize_string (ctx_quote, subject)); + + talloc_free (ctx_quote); } static void