nx_coreutils_test.nx
buildroot/runtime/nx_coreutils_test.nx
about
nx_coreutils_test.nx -- sovereign COREUTILS (the CLI daily-driver gap): cat / cp / mv / rm / ls,
built on real syscalls (sys_read_file, sys_openat_wr, sys_renameat, sys_getdents64, sys_mkdir).
NISHI rm = SOFT-DELETE to a trash dir (Rule 13: additive-only, history is sacred, reversible) --
NOT a hard unlink. KAT proves each on real files in /tmp. No persistent-hardware writes (Rule 26).
expect_exit: 0 license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 8 | func cu_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 9 | func cu_putn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 } |
| 10 | func beq(a: *u8, b: *u8, n: i64) -> i64 { var i: i64=0; while i<n { if a[i]!=b[i] { return 0 } i=i+1 } return 1 } called by 1: main |
| 13 | func cu_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 23 | func cu_write(path: *u8, buf: *u8, n: i64) -> i64 |
| 30 | func cu_cp(src: *u8, dst: *u8) -> i64 |
| 36 | func cu_mv(src: *u8, dst: *u8) -> i64 { return sys_renameat(src, dst) } |
| 38 | func cu_rm_soft(path: *u8, trash: *u8) -> i64 { return sys_renameat(path, trash) } |
| 40 | func cu_ls(path: *u8) -> i64 |
| 63 | func main() -> i64 |