27 lines
315 B
Plaintext
Raw Normal View History

import io
2025-01-20 21:37:23 +01:00
import mem
import sys
main() {
length := 256
command := mem.alloc(length)
loop {
2025-02-16 21:30:36 +01:00
io.out("λ ")
n := io.in(command)
2025-01-20 21:37:23 +01:00
if n <= 0 {
return
}
2025-02-16 21:30:36 +01:00
command[n-1] = 0
2025-01-20 21:37:23 +01:00
pid := sys.fork()
if pid == 0 {
2025-02-16 21:30:36 +01:00
sys.execve(command, 0, 0)
2025-01-20 21:37:23 +01:00
return
}
2025-02-17 17:49:42 +01:00
sys.waitid(idtype.pid, pid, 0, state.exited)
2025-01-20 21:37:23 +01:00
}
}