1 /* notmuch - Not much of an email program, (just index and search)
3 * Copyright © 2009 Carl Worth
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see http://www.gnu.org/licenses/ .
18 * Author: Carl Worth <cworth@cworth.org>
21 #include "notmuch-client.h"
23 /* Construct a single query string from the passed arguments, using
24 * 'ctx' as the talloc owner for all allocations.
26 * Currently, the arguments are just connected with space characters,
27 * but we might do more processing in the future, (such as inserting
28 * any AND operators needed to work around Xapian QueryParser bugs).
30 * This function returns NULL in case of insufficient memory.
33 query_string_from_args (void *ctx, int argc, char *argv[])
38 query_string = talloc_strdup (ctx, "");
39 if (query_string == NULL)
42 for (i = 0; i < argc; i++) {
44 query_string = talloc_strdup_append (query_string, " ");
45 if (query_string == NULL)
49 query_string = talloc_strdup_append (query_string, argv[i]);
50 if (query_string == NULL)