summaryrefslogtreecommitdiff
path: root/rc/bin/sysinfo
diff options
context:
space:
mode:
authorstanley lieber <stanley.lieber@gmail.com>2013-07-05 15:42:45 -0400
committerstanley lieber <stanley.lieber@gmail.com>2013-07-05 15:42:45 -0400
commit252b0ff3c9b17628e641f2e9eb84468fb8975a6e (patch)
treeab968a27e2c1519f4581d354de568efad853e214 /rc/bin/sysinfo
parent33e13fa09c203b0116a671d533fe46845819f339 (diff)
sysinfo: add -e to include a reply-to e-mail address
Diffstat (limited to 'rc/bin/sysinfo')
-rwxr-xr-xrc/bin/sysinfo34
1 files changed, 25 insertions, 9 deletions
diff --git a/rc/bin/sysinfo b/rc/bin/sysinfo
index 5f8843f22..8905368f8 100755
--- a/rc/bin/sysinfo
+++ b/rc/bin/sysinfo
@@ -1,12 +1,10 @@
#!/bin/rc
rfork e
-
fn logprog{
echo % `{echo $"* | sed 's/#/''#''/g'}
$*
echo
}
-
fn print{
echo '% cd ''#ec''; for(i in *){echo $i ''='' `{cat $i}}'
cd '#ec'; for(i in *){echo $i '=' `{cat $i}}
@@ -42,10 +40,11 @@ fn print{
logprog cat '#A/volume'
logprog cat /mnt/apm/ctl
}
-
fn post{
file=/tmp/sysinfo.$user.$pid
- print >$file >[2=1]
+ if(! ~ $#e 0)
+ echo $e >$file
+ print >>$file >[2=1]
@{
rfork n
webfs
@@ -55,11 +54,28 @@ fn post{
rm -f $file
}
}
-
-switch($1){
-case -p
+argv0=$0
+fn usage {
+ echo usage: $argv0 '[ -e e-mail ] [ -p ]' >[1=2]
+ exit usage
+}
+e=()
+p=()
+while(~ $1 -*){
+ switch($1){
+ case -e
+ e=$2
+ shift
+ case -p
+ p=1
+ shift
+ case *
+ usage
+ }
+ shift
+}
+if(~ $p 1)
post
-case *
+if not
print
-}