code wiki / _hdl_build / nx_reader_list_test.nx

nx_reader_list_test.nx source

↩ module page · 12 lines · 704 B

1// nx_reader_list_test.nx -- DEFINITIVE check that /api/personal (rl_list_personal_json) returns a user's books. 2// argv[1] = the ukey (extracted from the on-disk idx_book_personal_<ukey>.wsl). Prints the exact JSON the daemon 3// would return -- so we can see whether the list logic (incl rl_slug_guard) surfaces the operator's downloads. 4import "nx_syscalls.nx" 5import "nx_reader_library.nx" 6func main(argc: i64, argv: *i64) -> i64 { 7 if argc < 2 { sys_write(1, "usage: nx_reader_list_test <ukey>\n" as *u8, 34); return 2 } 8 let buf: *u8 = sys_mmap(1048576) 9 let n: i64 = rl_list_personal_json(argv[1] as *u8, buf, 1048576) 10 sys_write(1, buf, n); sys_write(1, "\n" as *u8, 1) 11 return 0 12}