shithub: riscv

Download patch

ref: e482b39f8d9ed8c27429cd2f510fc7c8a0dba1c1
parent: 6c41bd843caa1d738431b49460b83038b54fd303
author: cinap_lenrek <[email protected]>
date: Wed Feb 22 06:20:49 EST 2012

man: -P run single instance of page

--- a/rc/bin/man
+++ b/rc/bin/man
@@ -109,41 +109,49 @@
 		exit 'no man'
 	}
 }
-for(i in $fils) {
-	if(! /bin/test -f $i)
-		echo need $i >[1=2]
-	if not {
-		switch($cmd) {
-		case w
-			echo $i
+switch($cmd) {
+case p; out=proof
+case P; out=page
+case *; out=cat
+}
+{
+	for(i in $fils) {
+		if(! /bin/test -f $i)
+			echo need $i >[1=2]
+		if not {
+			switch($cmd) {
+			case w
+				echo $i
 
-		case t
-			roff t $i
+			case t
+				roff t $i
 
-		case p
-			roff t $i | grep -v '^x X html' | proof
+			case p
+				roff t $i | grep -v '^x X html'
 
-		case P
-			roff t $i | page
+			case P
+				roff t $i
 
-		case n
-			roff n $i | sed '
-				${
-        			       /^$/p
-				}
-				//N
-				/^\n$/D'
+			case n
+				roff n $i | sed '
+					${
+        				       /^$/p
+					}
+					//N
+					/^\n$/D'
 
-		case b
-			x=`{echo $i | sed 's;/sys/man/(.*)/(.*);\1 \2;'}
-			if(~ $x(2) 0intro) x=($x(1) intro)
-			roff n $i | sed '
-				${
-        			       /^$/p
-				}
-				//N
-				/^\n$/D' |
-			plumb -i -d edit -a 'action=showdata filename=/man/'$x(2)^'('$x(1)^')'
+			case b
+				x=`{echo $i | sed 's;/sys/man/(.*)/(.*);\1 \2;'}
+				if(~ $x(2) 0intro) x=($x(1) intro)
+				roff n $i | sed '
+					${
+        				       /^$/p
+					}
+					//N
+					/^\n$/D' |
+				plumb -i -d edit -a 'action=showdata filename=/man/'$x(2)^'('$x(1)^')'
+			}
 		}
 	}
-}
+} | $out
+