X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2Frandom-corpus.c;h=8ed7ff766cdd274844515038e07d1384b0180407;hp=f354d4b92c9f9e82d5cdccf6aa9360c3e729dc28;hb=a8bf94af44b21449d8f28478013400c096b0241d;hpb=76fa93e2a2002940335c941e76e94d69abd71fe9 diff --git a/test/random-corpus.c b/test/random-corpus.c index f354d4b9..8ed7ff76 100644 --- a/test/random-corpus.c +++ b/test/random-corpus.c @@ -19,7 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ . + * along with this program. If not, see https://www.gnu.org/licenses/ . * * Author: David Bremner */ @@ -96,7 +96,9 @@ random_utf8_string (void *ctx, size_t char_count) buf = talloc_realloc (ctx, buf, gchar, buf_size); } - randomchar = random_unichar (); + do { + randomchar = random_unichar (); + } while (randomchar == '\n'); written = g_unichar_to_utf8 (randomchar, buf + offset); @@ -112,6 +114,25 @@ random_utf8_string (void *ctx, size_t char_count) return buf; } +/* stubs since we cannot link with notmuch.o */ +const notmuch_opt_desc_t notmuch_shared_options[] = { + { } +}; + +const char *notmuch_requested_db_uuid = NULL; + +void +notmuch_process_shared_options (unused (const char *dummy)) +{ +} + +int +notmuch_minimal_options (unused (const char *subcommand), + unused (int argc), + unused (char **argv)) +{ + return 0; +} int main (int argc, char **argv) @@ -119,7 +140,7 @@ main (int argc, char **argv) void *ctx = talloc_new (NULL); - char *config_path = NULL; + const char *config_path = NULL; notmuch_config_t *config; notmuch_database_t *notmuch; @@ -134,13 +155,13 @@ main (int argc, char **argv) int seed = 734569; notmuch_opt_desc_t options[] = { - { NOTMUCH_OPT_STRING, &config_path, "config-path", 'c', 0 }, - { NOTMUCH_OPT_INT, &num_messages, "num-messages", 'n', 0 }, - { NOTMUCH_OPT_INT, &max_tags, "max-tags", 'm', 0 }, - { NOTMUCH_OPT_INT, &message_id_len, "message-id-len", 'M', 0 }, - { NOTMUCH_OPT_INT, &tag_len, "tag-len", 't', 0 }, - { NOTMUCH_OPT_INT, &seed, "seed", 's', 0 }, - { 0, 0, 0, 0, 0 } + { .opt_string = &config_path, .name = "config-path" }, + { .opt_int = &num_messages, .name = "num-messages" }, + { .opt_int = &max_tags, .name = "max-tags" }, + { .opt_int = &message_id_len, .name = "message-id-len" }, + { .opt_int = &tag_len, .name = "tag-len" }, + { .opt_int = &seed, .name = "seed" }, + { } }; int opt_index = parse_arguments (argc, argv, options, 1); @@ -158,7 +179,7 @@ main (int argc, char **argv) exit (1); } - config = notmuch_config_open (ctx, config_path, NULL); + config = notmuch_config_open (ctx, config_path, false); if (config == NULL) return 1;