9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] page vs 9 file
@ 2005-09-17 18:33 erik quanstrom
  0 siblings, 0 replies; only message in thread
From: erik quanstrom @ 2005-09-17 18:33 UTC (permalink / raw)
  To: 9fans

i was looking into why my man wrapper didn't like -P anymore.
the reason was that i changed my path. it seems that plan 9 file
says "postscript" and gnu file says "PostScript".

here's a diff. 

; diff page $home/new/plan9/bin
31c31
< 		file "$1"
---
> 		file - < "$1"
52c52
< 		*[Pp]ost[Ss]cript*)
---
> 		*PostScript*)
62c62
< 
---
> 	
80c80
< 	*[pP]ost[Ss]cript*)
---
> 	*PostScript*)

here's man wrapper redux reprised:

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

fn do_u_man { uargs=() viewer=nobs {
	for (i){
		switch($i){
		case -P
			uargs=($uargs -t)
			viewer=page
		case *
			uargs=($uargs $i)
		}
	}
	$u_man $uargs | $viewer
}}

fn do_9_man {
	#path = ($PLAN9/bin $path) man $*
	9 man $*
}

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
	do_9_man $args
case *
	do_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 18:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-17 18:33 [9fans] page vs 9 file 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).