#include #include #include #include struct object { u8 a; s16 b; bool c; }; #define _slit(s) ((ksraw){Kmsz(s),s}) stat_long entry(kenv e) { const char msg[] = "hello from libk\n"; ksraw ptr = { Kmsz(msg), msg }; bool maybe = true; maybe = no; if (kiosend(e.std, ptr, null) == kiocond_ok) { /* great, continue */ } else { return kbad_io; } kmres alloc = kmheapa(2048); if (alloc.cond != kmcond_ok) return kbad_mem; void* region = alloc.raw; kmzero(region,2048); if (kmheapf(region) >= kmcond_fail) return kbad_mem; void* top = kmlini(); kmres rst = kmlina(1230); if(rst.cond != kmcond_ok) return kbad_mem; kmres rst2 = kmlina(789); if(rst2.cond != kmcond_ok) return kbad_mem; const char varmsg[] = "printing environment variables\n"; ksraw msgptr = { Kmsz(varmsg), varmsg }; kiosend(e.std, msgptr, null); for (sz i = 0; i < e.varc; ++i) { kiosend(e.std, _slit(" - "), null); kiosend(e.std, e.vars[i].name, null); kiosend(e.std, _slit(" = ["), null); kiosend(e.std, e.vars[i].val, null); kiosend(e.std, _slit("]\n"), null); } return kbad_ok; }