--- /dev/null
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id BC35F431FAF\r
+ for <notmuch@notmuchmail.org>; Sun, 15 Jan 2012 00:05:18 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.699\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5\r
+ tests=[HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id m9UHXtLjTjfT for <notmuch@notmuchmail.org>;\r
+ Sun, 15 Jan 2012 00:05:17 -0800 (PST)\r
+Received: from mail-pz0-f53.google.com (mail-pz0-f53.google.com\r
+ [209.85.210.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 49D2A431FAE\r
+ for <notmuch@notmuchmail.org>; Sun, 15 Jan 2012 00:05:17 -0800 (PST)\r
+Received: by dalz17 with SMTP id z17so2743369dal.26\r
+ for <notmuch@notmuchmail.org>; Sun, 15 Jan 2012 00:05:15 -0800 (PST)\r
+MIME-Version: 1.0\r
+Received: by 10.68.213.38 with SMTP id np6mr16285599pbc.37.1326614715150; Sun,\r
+ 15 Jan 2012 00:05:15 -0800 (PST)\r
+Received: by 10.68.58.234 with HTTP; Sun, 15 Jan 2012 00:05:15 -0800 (PST)\r
+Received: by 10.68.58.234 with HTTP; Sun, 15 Jan 2012 00:05:15 -0800 (PST)\r
+In-Reply-To: <1326591624-15493-10-git-send-email-david@tethera.net>\r
+References: <874nwxbkhr.fsf@zancas.localnet>\r
+ <1326591624-15493-1-git-send-email-david@tethera.net>\r
+ <1326591624-15493-10-git-send-email-david@tethera.net>\r
+Date: Sun, 15 Jan 2012 10:05:15 +0200\r
+Message-ID:\r
+ <CAB+hUn9Eas_4DRc8FDk+S88JiWhcOipHc_ePn4pHe89B72=JiA@mail.gmail.com>\r
+Subject: Re: [PATCH v3 09/10] random-dump.c: new test-binary to generate dump\r
+ files\r
+From: Jani Nikula <jani@nikula.org>\r
+To: David Bremner <david@tethera.net>\r
+Content-Type: multipart/alternative; boundary=e89a8ff1c322d9b16904b68c8ec8\r
+Cc: notmuch@notmuchmail.org, David Bremner <bremner@debian.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 15 Jan 2012 08:05:18 -0000\r
+\r
+--e89a8ff1c322d9b16904b68c8ec8\r
+Content-Type: text/plain; charset=UTF-8\r
+\r
+On Jan 15, 2012 3:41 AM, "David Bremner" <david@tethera.net> wrote:\r
+>\r
+> From: David Bremner <bremner@debian.org>\r
+>\r
+> This binary creates a "torture test" dump file for the new dump\r
+> format.\r
+> ---\r
+> test/Makefile.local | 4 ++\r
+> test/basic | 2 +-\r
+> test/random-dump.c | 144\r
++++++++++++++++++++++++++++++++++++++++++++++++++++\r
+> 3 files changed, 149 insertions(+), 1 deletions(-)\r
+> create mode 100644 test/random-dump.c\r
+>\r
+> diff --git a/test/Makefile.local b/test/Makefile.local\r
+> index ba697f4..b59f837 100644\r
+> --- a/test/Makefile.local\r
+> +++ b/test/Makefile.local\r
+> @@ -16,6 +16,9 @@ $(dir)/arg-test: $(dir)/arg-test.o\r
+command-line-arguments.o util/libutil.a\r
+> $(dir)/hex-xcode: $(dir)/hex-xcode.o command-line-arguments.o\r
+util/libutil.a\r
+> $(call quiet,CC) -I. $^ -o $@ -ltalloc\r
+>\r
+> +$(dir)/random-dump: $(dir)/random-dump.o command-line-arguments.o\r
+util/libutil.a\r
+> + $(call quiet,CC) -I. $^ -o $@ -ltalloc -lm\r
+> +\r
+> $(dir)/smtp-dummy: $(smtp_dummy_modules)\r
+> $(call quiet,CC) $^ -o $@\r
+>\r
+> @@ -25,6 +28,7 @@ $(dir)/symbol-test: $(dir)/symbol-test.o\r
+> .PHONY: test check\r
+>\r
+> test-binaries: $(dir)/arg-test $(dir)/hex-xcode \\r
+> + $(dir)/random-dump \\r
+> $(dir)/smtp-dummy $(dir)/symbol-test\r
+>\r
+> test: all test-binaries\r
+> diff --git a/test/basic b/test/basic\r
+> index af57026..e3a6cef 100755\r
+> --- a/test/basic\r
+> +++ b/test/basic\r
+> @@ -54,7 +54,7 @@ test_begin_subtest 'Ensure that all available tests\r
+will be run by notmuch-test'\r
+> eval $(sed -n -e '/^TESTS="$/,/^"$/p' $TEST_DIRECTORY/notmuch-test)\r
+> tests_in_suite=$(for i in $TESTS; do echo $i; done | sort)\r
+> available=$(find "$TEST_DIRECTORY" -maxdepth 1 -type f -executable\r
+-printf '%f\n' | \\r
+> - sed -r -e\r
+"/^(aggregate-results.sh|notmuch-test|smtp-dummy|test-verbose|symbol-test|arg-test|hex-xcode)$/d"\r
+| \\r
+> + sed -r -e\r
+"/^(aggregate-results.sh|notmuch-test|smtp-dummy|test-verbose|symbol-test|arg-test|hex-xcode|random-dump)$/d"\r
+| \\r
+> sort)\r
+> test_expect_equal "$tests_in_suite" "$available"\r
+>\r
+> diff --git a/test/random-dump.c b/test/random-dump.c\r
+> new file mode 100644\r
+> index 0000000..1949425\r
+> --- /dev/null\r
+> +++ b/test/random-dump.c\r
+> @@ -0,0 +1,144 @@\r
+> +/*\r
+> + Generate a random dump file in 'notmuch' format.\r
+> + Generated message-id's and tags are intentionally nasty.\r
+> +\r
+> + We restrict ourselves to 7 bit message-ids, because generating\r
+> + random valid UTF-8 seems like work. And invalid UTF-8 can't be\r
+> + round-tripped via Xapian.\r
+> +\r
+> + */\r
+> +\r
+> +#include <stdlib.h>\r
+> +#include <assert.h>\r
+> +#include <talloc.h>\r
+> +#include <string.h>\r
+> +#include "math.h"\r
+> +#include "hex-escape.h"\r
+> +#include "command-line-arguments.h"\r
+> +\r
+> +static void\r
+> +hex_out (void *ctx, char *buf)\r
+> +{\r
+> + static char *encoded_buf = NULL;\r
+> + static size_t encoded_buf_size = 0;\r
+> +\r
+> + if (hex_encode (ctx, buf, &encoded_buf, &encoded_buf_size) !=\r
+HEX_SUCCESS) {\r
+> + fprintf (stderr, "Hex encoding failed");\r
+> + exit (1);\r
+> + }\r
+> +\r
+> + fputs (encoded_buf, stdout);\r
+> +}\r
+> +\r
+> +static void\r
+> +random_chars (char *buf, int from, int stop, int max_char,\r
+> + const char *blacklist)\r
+> +{\r
+> + int i;\r
+> +\r
+> + for (i = from; i < stop; i++) {\r
+> + do {\r
+> + buf[i] = ' ' + (random () % (max_char - ' '));\r
+> + } while (blacklist && strchr (blacklist, buf[i]));\r
+> + }\r
+> +}\r
+> +\r
+> +static void\r
+> +random_tag (void *ctx, size_t len)\r
+> +{\r
+> + static char *buf = NULL;\r
+> + static size_t buf_len = 0;\r
+> +\r
+> + int use = (random () % (len - 1)) + 1;\r
+> +\r
+> + if (len > buf_len) {\r
+> + buf = talloc_realloc (ctx, buf, char, len);\r
+> + buf_len = len;\r
+> + }\r
+> +\r
+> + random_chars (buf, 0, use, 255, NULL);\r
+> +\r
+> + buf[use] = '\0';\r
+> +\r
+> + hex_out (ctx, buf);\r
+> +}\r
+> +\r
+> +static void\r
+> +random_message_id (void *ctx, size_t len)\r
+> +{\r
+> + static char *buf = NULL;\r
+> + static size_t buf_len = 0;\r
+> +\r
+> + int lhs_len = (random () % (len / 2 - 1)) + 1;\r
+> +\r
+> + int rhs_len = (random () % len / 2) + 1;\r
+> +\r
+> + const char *blacklist = "\n\r@<>[]()";\r
+> +\r
+> + if (len > buf_len) {\r
+> + buf = talloc_realloc (ctx, buf, char, len);\r
+> + buf_len = len;\r
+> + }\r
+> +\r
+> + random_chars (buf, 0, lhs_len, 127, blacklist);\r
+> +\r
+> + buf[lhs_len] = '@';\r
+> +\r
+> + random_chars (buf, lhs_len + 1, lhs_len + rhs_len + 1, 127,\r
+blacklist);\r
+> +\r
+> + hex_out (ctx, buf);\r
+> +}\r
+> +\r
+> +int\r
+> +main (int argc, char **argv)\r
+> +{\r
+> +\r
+> + void *ctx = talloc_new (NULL);\r
+> + int num_lines = 500;\r
+> + int max_tags = 10;\r
+> + int message_id_len = 100;\r
+> + int tag_len = 50;\r
+> + int seed = 734569;\r
+> +\r
+> + int pad_tag = 0, pad_mid = 0;\r
+> +\r
+> + notmuch_opt_desc_t options[] = {\r
+> + { NOTMUCH_OPT_INT, &num_lines, "num-lines", 'n', 0 },\r
+> + { NOTMUCH_OPT_INT, &max_tags, "max-tags", 'm', 0 },\r
+> + { NOTMUCH_OPT_INT, &message_id_len, "message-id-len", 'M', 0 },\r
+> + { NOTMUCH_OPT_INT, &tag_len, "tag-len", 't', 0 },\r
+> + { NOTMUCH_OPT_INT, &seed, "tag-len", 't', 0 },\r
+\r
+s/tag-len/seed/\r
+\r
+> + { 0, 0, 0, 0, 0 }\r
+> + };\r
+> +\r
+> + int opt_index = parse_arguments (argc, argv, options, 1);\r
+> +\r
+> + if (opt_index < 0)\r
+> + exit (1);\r
+> +\r
+> + pad_mid = ((int) log10 (num_lines) + 1);\r
+> + pad_tag = ((int) log10 (max_tags)) + 1;\r
+> +\r
+> + srandom (seed);\r
+> +\r
+> + int line;\r
+> + for (line = 0; line < num_lines; line++) {\r
+> +\r
+> + printf ("%0*d-", pad_mid, line);\r
+> +\r
+> + random_message_id (ctx, message_id_len);\r
+> +\r
+> + int num_tags = random () % (max_tags + 1);\r
+> +\r
+> + int j;\r
+> + for (j = 0; j < num_tags; j++) {\r
+> + printf (" %0*d-", pad_tag, j);\r
+> + random_tag (ctx, tag_len);\r
+> + }\r
+> + putchar ('\n');\r
+> + }\r
+> +\r
+> + talloc_free (ctx);\r
+> +\r
+> + return 0;\r
+> +}\r
+> --\r
+> 1.7.7.3\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r
+\r
+--e89a8ff1c322d9b16904b68c8ec8\r
+Content-Type: text/html; charset=UTF-8\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+<p><br>\r
+On Jan 15, 2012 3:41 AM, "David Bremner" <<a href=3D"mailto:da=\r
+vid@tethera.net">david@tethera.net</a>> wrote:<br>\r
+><br>\r
+> From: David Bremner <<a href=3D"mailto:bremner@debian.org">bremner@=\r
+debian.org</a>><br>\r
+><br>\r
+> This binary creates a "torture test" dump file for the new d=\r
+ump<br>\r
+> format.<br>\r
+> ---<br>\r
+> =C2=A0test/Makefile.local | =C2=A0 =C2=A04 ++<br>\r
+> =C2=A0test/basic =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A02 +-=\r
+<br>\r
+> =C2=A0test/random-dump.c =C2=A0| =C2=A0144 +++++++++++++++++++++++++++=\r
+++++++++++++++++++++++++<br>\r
+> =C2=A03 files changed, 149 insertions(+), 1 deletions(-)<br>\r
+> =C2=A0create mode 100644 test/random-dump.c<br>\r
+><br>\r
+> diff --git a/test/Makefile.local b/test/Makefile.local<br>\r
+> index ba697f4..b59f837 100644<br>\r
+> --- a/test/Makefile.local<br>\r
+> +++ b/test/Makefile.local<br>\r
+> @@ -16,6 +16,9 @@ $(dir)/arg-test: $(dir)/arg-test.o command-line-argu=\r
+ments.o util/libutil.a<br>\r
+> =C2=A0$(dir)/hex-xcode: $(dir)/hex-xcode.o command-line-arguments.o ut=\r
+il/libutil.a<br>\r
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0$(call quiet,CC) -I. $^ -o $@ -ltalloc<br>\r
+><br>\r
+> +$(dir)/random-dump: =C2=A0$(dir)/random-dump.o command-line-arguments=\r
+.o util/libutil.a<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 $(call quiet,CC) -I. $^ -o $@ -ltalloc -lm<br>\r
+> +<br>\r
+> =C2=A0$(dir)/smtp-dummy: $(smtp_dummy_modules)<br>\r
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0$(call quiet,CC) $^ -o $@<br>\r
+><br>\r
+> @@ -25,6 +28,7 @@ $(dir)/symbol-test: $(dir)/symbol-test.o<br>\r
+> =C2=A0.PHONY: test check<br>\r
+><br>\r
+> =C2=A0test-binaries: $(dir)/arg-test $(dir)/hex-xcode \<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 $(dir)/random-dump \<br>\r
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 $(dir)/smtp-dummy $(dir)/symbol-test<br>\r
+><br>\r
+> =C2=A0test: =C2=A0all test-binaries<br>\r
+> diff --git a/test/basic b/test/basic<br>\r
+> index af57026..e3a6cef 100755<br>\r
+> --- a/test/basic<br>\r
+> +++ b/test/basic<br>\r
+> @@ -54,7 +54,7 @@ test_begin_subtest 'Ensure that all available te=\r
+sts will be run by notmuch-test'<br>\r
+> =C2=A0eval $(sed -n -e '/^TESTS=3D"$/,/^"$/p' $TEST_=\r
+DIRECTORY/notmuch-test)<br>\r
+> =C2=A0tests_in_suite=3D$(for i in $TESTS; do echo $i; done | sort)<br>\r
+> =C2=A0available=3D$(find "$TEST_DIRECTORY" -maxdepth 1 -type=\r
+ f -executable -printf '%f\n' | \<br>\r
+> - =C2=A0 =C2=A0sed -r -e "/^(aggregate-results.sh|notmuch-test|sm=\r
+tp-dummy|test-verbose|symbol-test|arg-test|hex-xcode)$/d" | \<br>\r
+> + =C2=A0 =C2=A0sed -r -e "/^(aggregate-results.sh|notmuch-test|sm=\r
+tp-dummy|test-verbose|symbol-test|arg-test|hex-xcode|random-dump)$/d" =\r
+| \<br>\r
+> =C2=A0 =C2=A0 sort)<br>\r
+> =C2=A0test_expect_equal "$tests_in_suite" "$available&q=\r
+uot;<br>\r
+><br>\r
+> diff --git a/test/random-dump.c b/test/random-dump.c<br>\r
+> new file mode 100644<br>\r
+> index 0000000..1949425<br>\r
+> --- /dev/null<br>\r
+> +++ b/test/random-dump.c<br>\r
+> @@ -0,0 +1,144 @@<br>\r
+> +/*<br>\r
+> + =C2=A0 Generate a random dump file in 'notmuch' format.<br>\r
+> + =C2=A0 Generated message-id's and tags are intentionally nasty.<=\r
+br>\r
+> +<br>\r
+> + =C2=A0 We restrict ourselves to 7 bit message-ids, because generatin=\r
+g<br>\r
+> + =C2=A0 random valid UTF-8 seems like work. And invalid UTF-8 can'=\r
+;t be<br>\r
+> + =C2=A0 round-tripped via Xapian.<br>\r
+> +<br>\r
+> + */<br>\r
+> +<br>\r
+> +#include <stdlib.h><br>\r
+> +#include <assert.h><br>\r
+> +#include <talloc.h><br>\r
+> +#include <string.h><br>\r
+> +#include "math.h"<br>\r
+> +#include "hex-escape.h"<br>\r
+> +#include "command-line-arguments.h"<br>\r
+> +<br>\r
+> +static void<br>\r
+> +hex_out (void *ctx, char *buf)<br>\r
+> +{<br>\r
+> + =C2=A0 =C2=A0static char *encoded_buf =3D NULL;<br>\r
+> + =C2=A0 =C2=A0static size_t encoded_buf_size =3D 0;<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0if (hex_encode (ctx, buf, &encoded_buf, &encode=\r
+d_buf_size) !=3D HEX_SUCCESS) {<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 fprintf (stderr, "Hex encoding failed"=\r
+;);<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 exit (1);<br>\r
+> + =C2=A0 =C2=A0}<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0fputs (encoded_buf, stdout);<br>\r
+> +}<br>\r
+> +<br>\r
+> +static void<br>\r
+> +random_chars (char *buf, int from, int stop, int max_char,<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 const char *blacklist)<br>\r
+> +{<br>\r
+> + =C2=A0 =C2=A0int i;<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0for (i =3D from; i < stop; i++) {<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 do {<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 buf[i] =3D ' ' + (random =\r
+() % (max_char - ' '));<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 } while (blacklist && strchr (blacklist=\r
+, buf[i]));<br>\r
+> + =C2=A0 =C2=A0}<br>\r
+> +}<br>\r
+> +<br>\r
+> +static void<br>\r
+> +random_tag (void *ctx, size_t len)<br>\r
+> +{<br>\r
+> + =C2=A0 =C2=A0static char *buf =3D NULL;<br>\r
+> + =C2=A0 =C2=A0static size_t buf_len =3D 0;<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0int use =3D (random () % (len - 1)) + 1;<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0if (len > buf_len) {<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 buf =3D talloc_realloc (ctx, buf, char, len);<b=\r
+r>\r
+> + =C2=A0 =C2=A0 =C2=A0 buf_len =3D len;<br>\r
+> + =C2=A0 =C2=A0}<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0random_chars (buf, 0, use, 255, NULL);<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0buf[use] =3D '\0';<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0hex_out (ctx, buf);<br>\r
+> +}<br>\r
+> +<br>\r
+> +static void<br>\r
+> +random_message_id (void *ctx, size_t len)<br>\r
+> +{<br>\r
+> + =C2=A0 =C2=A0static char *buf =3D NULL;<br>\r
+> + =C2=A0 =C2=A0static size_t buf_len =3D 0;<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0int lhs_len =3D (random () % (len / 2 - 1)) + 1;<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0int rhs_len =3D (random () % len / 2) + 1;<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0const char *blacklist =3D "\n\r@<>[]()"=\r
+;<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0if (len > buf_len) {<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 buf =3D talloc_realloc (ctx, buf, char, len);<b=\r
+r>\r
+> + =C2=A0 =C2=A0 =C2=A0 buf_len =3D len;<br>\r
+> + =C2=A0 =C2=A0}<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0random_chars (buf, 0, lhs_len, 127, blacklist);<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0buf[lhs_len] =3D '@';<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0random_chars (buf, lhs_len + 1, lhs_len + rhs_len + 1, =\r
+127, blacklist);<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0hex_out (ctx, buf);<br>\r
+> +}<br>\r
+> +<br>\r
+> +int<br>\r
+> +main (int argc, char **argv)<br>\r
+> +{<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0void *ctx =3D talloc_new (NULL);<br>\r
+> + =C2=A0 =C2=A0int num_lines =3D 500;<br>\r
+> + =C2=A0 =C2=A0int max_tags =3D 10;<br>\r
+> + =C2=A0 =C2=A0int message_id_len =3D 100;<br>\r
+> + =C2=A0 =C2=A0int tag_len =3D 50;<br>\r
+> + =C2=A0 =C2=A0int seed =3D 734569;<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0int pad_tag =3D 0, pad_mid =3D 0;<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0notmuch_opt_desc_t options[] =3D {<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 { NOTMUCH_OPT_INT, &num_lines, "num-li=\r
+nes", 'n', 0 },<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 { NOTMUCH_OPT_INT, &max_tags, "max-tag=\r
+s", 'm', 0 },<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 { NOTMUCH_OPT_INT, &message_id_len, "m=\r
+essage-id-len", 'M', 0 },<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 { NOTMUCH_OPT_INT, &tag_len, "tag-len&=\r
+quot;, 't', 0 },<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 { NOTMUCH_OPT_INT, &seed, "tag-len&quo=\r
+t;, 't', 0 },</p>\r
+<p>s/tag-len/seed/</p>\r
+<p>> + =C2=A0 =C2=A0 =C2=A0 { 0, 0, 0, 0, 0 }<br>\r
+> + =C2=A0 =C2=A0};<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0int opt_index =3D parse_arguments (argc, argv, options,=\r
+ 1);<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0if (opt_index < 0)<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 exit (1);<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0pad_mid =3D ((int) log10 (num_lines) + 1);<br>\r
+> + =C2=A0 =C2=A0pad_tag =3D ((int) log10 (max_tags)) + 1;<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0srandom (seed);<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0int line;<br>\r
+> + =C2=A0 =C2=A0for (line =3D 0; line < num_lines; line++) {<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 printf ("%0*d-", pad_mid, line);<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 random_message_id (ctx, message_id_len);<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 int num_tags =3D random () % (max_tags + 1);<br=\r
+>\r
+> +<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 int j;<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 for (j =3D 0; j < num_tags; j++) {<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 printf (" %0*d-", pad_t=\r
+ag, j);<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 random_tag (ctx, tag_len);<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 }<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 putchar ('\n');<br>\r
+> + =C2=A0 =C2=A0}<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0talloc_free (ctx);<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0return 0;<br>\r
+> +}<br>\r
+> --<br>\r
+> 1.7.7.3<br>\r
+><br>\r
+> _______________________________________________<br>\r
+> notmuch mailing list<br>\r
+> <a href=3D"mailto:notmuch@notmuchmail.org">notmuch@notmuchmail.org</a>=\r
+<br>\r
+> <a href=3D"http://notmuchmail.org/mailman/listinfo/notmuch">http://not=\r
+muchmail.org/mailman/listinfo/notmuch</a><br>\r
+</p>\r
+\r
+--e89a8ff1c322d9b16904b68c8ec8--\r