summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2019-12-09 17:44:28 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2019-12-09 17:44:28 +0100
commit57dbe35fb68dda4888fc4c9e8c8d0b3106a8a21c (patch)
tree1935a2646569c68ab3310afc6bb3dd36e4dfa226
parent1bfde841484fadb1c41f41a6279e7e070f61a31b (diff)
downloadplan9front-57dbe35fb68dda4888fc4c9e8c8d0b3106a8a21c.tar.xz
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.
-rwxr-xr-xrc/bin/console16
-rw-r--r--sys/man/8/kbdfs33
2 files changed, 44 insertions, 5 deletions
diff --git a/rc/bin/console b/rc/bin/console
new file mode 100755
index 000000000..87f24a726
--- /dev/null
+++ b/rc/bin/console
@@ -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]
diff --git a/sys/man/8/kbdfs b/sys/man/8/kbdfs
index 9ed2b9268..20619dfa7 100644
--- a/sys/man/8/kbdfs
+++ b/sys/man/8/kbdfs
@@ -1,6 +1,6 @@
.TH KBDFS 8
.SH NAME
-kbdfs \- keyboard and console filesystem
+kbdfs, console \- keyboard and console filesystem
.SH SYNOPSIS
.B aux/kbdfs
[
@@ -12,7 +12,7 @@ kbdfs \- keyboard and console filesystem
.B -m
.I mntpnt
] [
-.I filename
+.I consfile
]
.nf
@@ -24,6 +24,12 @@ kbdfs \- keyboard and console filesystem
.B /dev/kbin
.B /dev/kbmap
.fi
+.PP
+.B console
+[
+.I cmd
+.I args...
+]
.SH DESCRIPTION
.PP
Started on
@@ -81,6 +87,17 @@ mounts itself on
otherwise on
.B /dev
(the default).
+.PP
+The
+.B console
+command executes
+.I cmd
+(defaults to the system shell)
+under its own
+.I kbdfs
+instance providing a serial console if
+.B $console
+environment variable is set.
.SS Console
.PP
Reading the
@@ -151,14 +168,17 @@ to
causes the characters to be printed on the console screen.
.PP
When a
-.I filename
+.I consfile
is passed to
.IR kbdfs (8)
as its last argument, it reads and processes the
characters from that file and forwards them to the
.BR cons
file with the same text processing applied as on keyboard input.
-This is used on serial consoles.
+This is used to provide a serial console when
+.B $console
+environment variable is set. (see
+.IR plan9.ini (8)).
.SS Keyboard
A read on the
.BR kbd
@@ -254,11 +274,14 @@ to represent a control character.
.IR cons (3),
.IR keyboard (6),
.IR utf (6),
-.IR kbd (3)
+.IR kbd (3),
+.IR plan9.ini (8)
.SH FILES
.B /sys/lib/kbmap/*
.SH SOURCE
.B /sys/src/cmd/aux/kbdfs
+.br
+.B /rc/bin/console
.SH HISTORY
.I Kbdfs
first appeared in 9front (May, 2011).