code wiki / _hdl_build / nx_publish_banner.nx

nx_publish_banner.nx source

↩ module page · 26 lines · 1392 B

1// nx_publish_banner.nx -- hand the GATED banner builder daemon to THE NISHI PUBLISHER (pub_submit). The 2// publisher SHIPS it to the NAS; the hosting workstream adds the /ad proxy route + runs it (bundled with the 3// sites.elf stability test). Binary pre-staged under knowledge/publish/staging/. Idempotent at the publisher. 4import "nx_syscalls.nx" 5import "nx_publisher.nx" 6 7func pb_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return n } 8func pb_puti(v: i64) -> i64 { 9 let t: *u8 = sys_mmap(28); var m: i64 = v; var neg: i64 = 0 10 if m < 0 { neg = 1; m = 0 - m } 11 var k: i64 = 0; if m == 0 { t[0] = 48 as u8; k = 1 } 12 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 13 let o: *u8 = sys_mmap(30); var w: i64 = 0; if neg == 1 { o[0] = 45 as u8; w = 1 } 14 var q: i64 = k - 1; while q >= 0 { o[w] = t[q]; w = w + 1; q = q - 1 } 15 sys_write(1, o, w); return 0 16} 17 18func main(argc: i64, argv: *i64) -> i64 { 19 pub_init() 20 let r: i64 = pub_submit( 21 "knowledge/publish/staging/nx_ad_banner_gated.elf" as *u8, 22 "/volume1/homes/elderwesto/nishihost/nx_ad_banner_gated.elf" as *u8, 23 "nishifamily" as *u8, "ad-banner-builder" as *u8, "deploy-daemon+ad-route" as *u8) 24 pb_puts("submit banner-builder -> " as *u8); pb_puti(r); pb_puts(" (1=enqueued)\n" as *u8) 25 sys_exit(0); return 0 26}