9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] man! play nice (redux)
@ 2005-09-17  3:00 erik quanstrom
  0 siblings, 0 replies; only message in thread
From: erik quanstrom @ 2005-09-17  3:00 UTC (permalink / raw)
  To: 9fans

this version should play nicely with any flavor of rc.
and it supports -u and -9 to force one way or the other.

edit the shebang line to your liking.

erik

----

#!/usr/local/bin/rc
u_man=/usr/bin/man
9_man=$PLAN9 ^ /bin/man

fn u_psv {
	psv -
}

fn u_cat {
	sed 's///g
s.//g'
}

fn do_u_man { uargs=() viewer=() {
	for (i){
		switch($i){
		case -P:
			uargs=($uargs -t)
			viewer=u_psv
		case *
			uargs=($uargs $i)
			viewer=u_cat
		}
	}

	$u_man $uargs | $viewer
}}

force=()
args=()

for(i){
	switch($i){
	case -u
		force=u
	case -9
		force=9
	case *
		args=($args $i)
	}
}

if (~ $PLAN9 ()){
	force=u
}

switch($force){
case u
	do_u_man $args
case 9
	$9_man $args >[2] /dev/null
case *
	$9_man $args >[2] /dev/null || do_u_man $args
}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-09-17  3:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-17  3:00 [9fans] man! play nice (redux) erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).