aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch-search.c
diff options
context:
space:
mode:
authorGravatar Jani Nikula <jani@nikula.org>2014-02-03 21:51:41 +0200
committerGravatar David Bremner <david@tethera.net>2014-03-09 10:12:52 -0300
commit6d0a17c46ec112f99ebeefc9619dd9586fceaa46 (patch)
tree42d6cf328b7165df6c15ee497090c6def81c88f6 /notmuch-search.c
parente79d2fc993dcd6fb328c31b2a0466cf7413a8276 (diff)
cli: sanitize tabs and newlines to spaces in notmuch search
Sanitize tabs and newlines to spaces rather than question marks in --output=summary --format=text output. This will also hide any difference in unfolding a header that has been folded with a tab. Our own header parser replaces tabs with spaces, while gmime would retain the tab.
Diffstat (limited to 'notmuch-search.c')
-rw-r--r--notmuch-search.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/notmuch-search.c b/notmuch-search.c
index 91b5d105..0262eb30 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -41,7 +41,9 @@ sanitize_string (const void *ctx, const char *str)
loop = out = talloc_strdup (ctx, str);
for (; *loop; loop++) {
- if ((unsigned char)(*loop) < 32)
+ if (*loop == '\t' || *loop == '\n')
+ *loop = ' ';
+ else if ((unsigned char)(*loop) < 32)
*loop = '?';
}
return out;