interplane.Get Omega
Read in your language

mailhand

mailhand: agents look after a person's email in seeded Omega. Maildir + MIME parsing, JSONL CLI and MCP, rule triage, policy-gated sending, hash-chained audit. Free (Apache-2.0).

Brought by drakestapleton

branch main Branches Tags History

mailhand / tests / gen / mkmaildir.om

55 lines · 1648 bytes Raw Blame History
1note ======== tests/gen/mkmaildir.om: deterministic synthetic Maildir (GateBuilder benchmark) ========
2note Usage: mkmaildir DIR [N [SEED]] N default 10000, SEED default 1 (decimal, 0..2^64-1).
3note Build: ./build.sh tests/units/mkmaildir.txt build/mkmaildir
4note DIR becomes a Maildir root (INBOX): DIR/cur, DIR/new, DIR/tmp and N message files; DIR must not
5note exist and its parent must. File names, kinds and contents: tests/bench-lib.om (top). The same N
6note and SEED give byte-identical files. Nothing in DIR is ever overwritten (files are created with
7note O_EXCL|O_NOFOLLOW).
8note stdout, one line: "mkmaildir N=.. seed=.. bytes=.. new=.. cur=.. plain=.. multipart=.. qp=..
9note encoded_subject=.. reply=.. dir=DIR" (bytes: the sum of all message file sizes).
10note Exit 0 written; 1 usage (argument count, N or SEED not a decimal ulong, DIR empty or longer than
11note 4095 bytes, DIR exists); 6 I/O (stderr names errno and the path; a partial message file is removed;
12note files written before the failure stay).
13
14text mmt_us "usage: mkmaildir DIR [N [SEED]] (N default 10000, SEED default 1; DIR must not exist)"
15text mmt_head "mkmaildir "
16text mmt_kdir " dir="
17
18fn main to int
19c = ulong argcnt
20if or lt c 2 gt c 4
21mk_err mmt_us
22ret 1
23end
24b = new uchar 131072 0
25k = argread 1 b 0 131072
26if le k 0
27mk_err mmt_us
28ret 1
29end
30n = ulong 10000
31seed = ulong 1
32if ge c 3
33n = mk_argnum 2
34end
35if ge c 4
36seed = mk_argnum 3
37end
38if ne get mk_g MKG_BAD 0
39mk_err mmt_us
40ret 1
41end
42z = s_mem S_AUX
43s_addt S_AUX part b 0 ulong k
44r = mk_gen n seed
45if ne r 0
46ret r
47end
48o_raw mmt_head
49mk_osum
50o_raw mmt_kdir
51o_raw part b 0 ulong k
52o_b 10
53o_flush
54ret 0
55end