shithub: riscv

Download patch

ref: 252b0ff3c9b17628e641f2e9eb84468fb8975a6e
parent: 33e13fa09c203b0116a671d533fe46845819f339
author: stanley lieber <[email protected]>
date: Fri Jul 5 11:42:45 EDT 2013

sysinfo: add -e to include a reply-to e-mail address

--- 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 @@
 	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 @@
 		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
-}
--- a/sys/man/1/sysinfo
+++ b/sys/man/1/sysinfo
@@ -4,6 +4,9 @@
 .SH SYNOPSIS
 .B sysinfo
 [
+.B -e e-mail
+]
+[
 .B -p
 ]
 .br
@@ -27,7 +30,12 @@
 mailing list,
 .B [email protected].
 A URL pointing to the archived output is returned.
-This flag is useful for reporting new installs to the
+The
+.B -e
+flag causes a reply-to e-mail address to be included
+in the message (the e-mail address is not divulged
+to the mailing list).
+These flags are useful for reporting new installs to the
 development team.
 .PP
 .I Sysupdate