35 lines
369 B
Plaintext
35 lines
369 B
Plaintext
import io
|
|
import mem
|
|
import sys
|
|
|
|
const idtype {
|
|
pid 1
|
|
}
|
|
|
|
const state {
|
|
exited 0x4
|
|
}
|
|
|
|
main() {
|
|
length := 256
|
|
command := mem.alloc(length)
|
|
|
|
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, 0, state.exited)
|
|
}
|
|
} |