diff options
| author | David Bremner <david@tethera.net> | 2018-08-30 08:29:14 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2018-09-06 08:07:13 -0300 |
| commit | b31e44c678bf3bfe81bcc5f159e627551f12700f (patch) | |
| tree | 1339a62a28fe461033ea5e1ad00f11e794f6754c /test/message-id-parse.c | |
| parent | b8e6f042c57739cc2b183395a3f9dfd64a6eb3d2 (diff) | |
lib: add _notmuch_message_id_parse_strict
The idea is that if a message-id parses with this function, the MUA
generating it was probably sane, and in particular it's probably safe
to use the result as a parent from In-Reply-to.
Diffstat (limited to 'test/message-id-parse.c')
| -rw-r--r-- | test/message-id-parse.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/message-id-parse.c b/test/message-id-parse.c new file mode 100644 index 00000000..752eb1fd --- /dev/null +++ b/test/message-id-parse.c @@ -0,0 +1,26 @@ +#include <stdio.h> +#include <talloc.h> +#include "notmuch-private.h" + +int +main (unused (int argc), unused (char **argv)) +{ + char *line = NULL; + size_t len = 0; + ssize_t nread; + void *local = talloc_new (NULL); + + while ((nread = getline (&line, &len, stdin)) != -1) { + int last = strlen (line) - 1; + if (line[last] == '\n') + line[last] = '\0'; + + char *mid = _notmuch_message_id_parse_strict (local, line); + if (mid) + printf ("GOOD: %s\n", mid); + else + printf ("BAD: %s\n", line); + } + + talloc_free (local); +} |
