File: netscape-man

package info (click to toggle)
man2html 1.5-23.1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 344 kB
  • ctags: 218
  • sloc: ansic: 3,889; awk: 241; sh: 224; makefile: 124
file content (48 lines) | stat: -rwxr-xr-x 1,029 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
#
# Man2hmtl interface to a live (already running) netscape browser.
# 
# Michael Hamilton <michael@actrix.gen.nz>, Apr 1996
#
# Usage examples:
#        man 1                  - section 1 index
#        man 3 intro            - section 3 name+description index
#        man 1 lpr              - man page for lpr
#        man -k editor          - search
#
function nsfunc () {
	if ( /bin/ps xc | grep -q 'netscape$' ) ; then
		if [ -x  netscape-remote ] ; then
			exec netscape-remote  -remote "openURL($1,new_window)"
		else
			exec netscape -remote "openURL($1,new_window)"
		fi
	else
		netscape $1 &
	fi
}

if [ $# = 2 ] ; then
	case "$1" in
	  -k)
	      nsfunc "http:/cgi-bin/mansearch?$2"
	      ;;
	  *)
	      if [ $2 = 'intro' ] ; then
		nsfunc "http:/cgi-bin/manwhatis?$1"
	      else
		nsfunc "http:/cgi-bin/man2html?$2+$1"
	      fi
	      ;;
	esac
else
	case "$1" in
	  1|2|3|4|5|6|7|8)
	      nsfunc "http:/cgi-bin/mansec?$1"
	      ;;
	  *)
	      nsfunc "http:/cgi-bin/man2html?$1"
	      ;;
	esac
fi