console(8): add console command and manpage

the console command runs a command or the system shell under
a new instance of kbdfs, optionally providing a serial console
when $console environment variable is set.
This commit is contained in:
cinap_lenrek 2019-12-09 17:44:28 +01:00
parent 1bfde84148
commit 57dbe35fb6
2 changed files with 44 additions and 5 deletions

16
rc/bin/console Executable file
View file

@ -0,0 +1,16 @@
#!/bin/rc
if(~ $#* 0)
*=(rc -i)
a=$console(1)
if(! ~ $#a 0){
if(! ~ $a /* '#'*)
a=/dev/eia^$a
if(test -e /dev/kbd){
@{rfork ns; aux/kbdfs; exec $* </dev/cons >/dev/cons >[2=1]} | tee $a
exit
}
}
aux/kbdfs $a
exec $* </dev/cons >/dev/cons >[2=1]