interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / seed / host / tests / environment.om

33 lines · 484 bytes Raw Blame History
1note envcnt/envread: find OMTEST=hello in the process environment, and refuse a short buffer with -105.
2text want "OMTEST=hello"
3global buf uchar 128
4fn main to int
5c = ulong envcnt
6if eq c 0
7ret 1
8end
9n0 = envread 0 buf 0 1
10if ne n0 -105
11ret 3
12end
13i = ulong 0
14while lt i c
15n = envread i buf 0 len buf
16if eq n long len want
17j = long 0
18same = ulong 1
19while lt j n
20if ne get buf j get want j
21same = ulong 0
22break
23end
24j = add j 1
25end
26if eq same 1
27ret 0
28end
29end
30i = add i 1
31end
32ret 2
33end