[PATCH 2/6] cli: sanitize tabs to spaces in notmuch search

Jani Nikula jani at nikula.org
Wed Oct 16 12:00:09 PDT 2013


This is in preparation of switching to gmime header parsing, but
arguably converting tabs to spaces rather than question marks is the
right thing to do anyway.
---
 notmuch-search.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/notmuch-search.c b/notmuch-search.c
index d9d39ec..eab314f 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -40,7 +40,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 = ' ';
+	else if ((unsigned char)(*loop) < 32)
 	    *loop = '?';
     }
     return out;
-- 
1.8.4.rc3



More information about the notmuch mailing list