code wiki / (root) / _ed_fetch_html.nx

_ed_fetch_html.nx source

↩ module page · 19 lines · 771 B

1// _ed_fetch_html.nx -- single-URL RAW-HTML fetch unit for the discovery 2// crawler. Staged fetch = the SHARED nx_fetch_unit (Rule #15 -- extracted 3// 2026-06-10 standards audit); this child just writes the decoded body (link 4// extraction needs markup, not text). Runs under nx_guarded_run. 5// usage: _ed_fetch_html <url> <out_html_path>; exit 0 ok / 2 fail / 3 args 6import "nx_syscalls.nx" 7import "nx_fetch_unit.nx" 8 9func main(argc: i64, argv: *i64) -> i64 { 10 if argc < 3 { return 3 } 11 let body: *u8 = sys_mmap(FU_CAP) 12 let blen: i64 = nx_fetch_staged(argv[1] as *u8, body, FU_CAP) 13 if blen <= 0 { return 2 } 14 let fd: i64 = sys_openat_wr(argv[2] as *u8, 0x1a4) 15 if fd < 0 { return 2 } 16 sys_write(fd, body, blen) 17 sys_close(fd) 18 return 0 19}