File: message-id-parse.c

package info (click to toggle)
notmuch 0.39-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,104 kB
  • sloc: sh: 21,888; ansic: 14,897; lisp: 9,061; cpp: 7,990; python: 6,221; perl: 391; makefile: 231; javascript: 34; ruby: 13
file content (26 lines) | stat: -rw-r--r-- 539 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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);
}