36 lines
402 B
Plaintext

import io
import mem
import sys
const idtype {
pid 1
}
const state {
exited 0x4
}
main() {
length := 256
command := mem.alloc(length)
siginfo := mem.alloc(128)
loop {
io.out("λ ")
n := io.in(command)
if n <= 0 {
return
}
command[n-1] = 0
pid := sys.fork()
if pid == 0 {
sys.execve(command, 0, 0)
return
}
sys.waitid(idtype.pid, pid, siginfo, state.exited)
}
}