ref: 17ecec63f2109a344a2e610668017c5af5f9914d
parent: c78953170058247994815336f4f4c05c13b18937
author: kvik <[email protected]>
date: Sat Feb 15 14:56:58 EST 2020
Add x/man
--- /dev/null
+++ b/man
@@ -1,0 +1,29 @@
+#!/bin/rc
+# x/man -- print manual pages from remote systems
+rfork e
+
+flags=()
+section=()
+width=72
+
+fn usage {
+ echo usage: x/man [flags] [section] title ...
+ exit usage
+}
+
+while(! ~ $#* 0 && ~ $1 -* && ! ~ $1 --){
+ flags=($flags $1)
+ shift
+}
+if(~ $1 --)
+ shift
+if(~ $#* 0)
+ usage
+if(echo $1 | grep -s '^[0-9][0-9A-Za-z]*'){
+ section=$1
+ shift
+}
+if(~ $#section 0)
+ x/run 'MANWIDTH='$width man $flags $*
+if not
+ x/run 'MANWIDTH='$width man $flags -s $section $*