code wiki / _hdl_build / nx_worldgen_ship.nx

nx_worldgen_ship.nx source

↩ module page · 20 lines · 1499 B

1// nx_worldgen_ship.nx -- stage the world showcase for nx_aw_push: knowledge/world.html -> docroot world/index.html 2// -> https://nishifamily.com/world (additive, never-brick). license_tier: ORIGINAL expect_exit: 0 3import "nx_syscalls.nx" 4func sw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 5func main() -> i64 { 6 let sfd: i64 = sys_openat_wr("/mnt/c/Users/elder/AppData/Local/Temp/awpush.src\x00" as *u8, 420) 7 if sfd < 0 { sw("worldgen_ship: cannot stage src\n\x00" as *u8); return 1 } 8 let sp: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/world.html\n\x00" as *u8 9 var sn: i64 = 0 10 while sp[sn] != (0 as u8) { sn = sn + 1 } 11 sys_write(sfd, sp, sn); sys_close(sfd) 12 let dfd: i64 = sys_openat_wr("/mnt/c/Users/elder/AppData/Local/Temp/awpush.dst\x00" as *u8, 420) 13 if dfd < 0 { sw("worldgen_ship: cannot stage dst\n\x00" as *u8); return 2 } 14 let dp: *u8 = "mkdir -p /volume1/homes/elderwesto/nishihost/sites/nishifamily/world; cat > /volume1/homes/elderwesto/nishihost/sites/nishifamily/world/index.html.tmp; mv -f /volume1/homes/elderwesto/nishihost/sites/nishifamily/world/index.html.tmp /volume1/homes/elderwesto/nishihost/sites/nishifamily/world/index.html\n\x00" as *u8 15 var dn: i64 = 0 16 while dp[dn] != (0 as u8) { dn = dn + 1 } 17 sys_write(dfd, dp, dn); sys_close(dfd) 18 sw("nx_worldgen_ship: staged (world.html -> sites/nishifamily/world/index.html); deploy = nx_aw_push\n\x00" as *u8) 19 return 0 20}