notmuch.git  about / heads / tags
Unnamed repository; edit this file 'description' to name the repository.
blob 752eb1fde7ce4956ccce6f840107e05bc20d9761 539 bytes (raw)
name: test/message-id-parse.c 	 # note: path name is non-authoritative(*)

 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);
}

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

git clone https://yhetil.org/notmuch.git