nx_tool_argecho.nx source
↩ module page · 23 lines · 1034 B
1// nx_tool_argecho.nx -- the multi-arg WITNESS organ for the executable API. Where nx_tool_ping proves an
2// argless organ forks+captures, this one proves a FULL argv vector reaches the child: it echoes a fixed
3// sentinel then each of its argv[1..] on its own line, and exits 0. Zero side effects (no files, no network)
4// -- the SAFE tool to allowlist for proving that /mcp tools/call now passes params.arguments.argv through to
5// the organ as real argv (the arg-passing exceed that makes multi-arg organs, e.g. nx_mgmt_client, callable).
6// license_tier: ORIGINAL expect_exit: 0
7import "nx_syscalls.nx"
8
9func ae_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
10
11func main(argc: i64, argv: *i64) -> i64 {
12 sys_write(1, "NX_TOOL_ARGECHO_OK" as *u8, 18)
13 var i: i64 = 1
14 while i < argc {
15 sys_write(1, "\n" as *u8, 1)
16 let a: *u8 = argv[i] as *u8
17 sys_write(1, a, ae_slen(a))
18 i = i + 1
19 }
20 sys_write(1, "\n" as *u8, 1)
21 sys_exit(0)
22 return 0
23}