man.sh revision 213470
1#! /bin/sh
2#
3#  Copyright (c) 2010 Gordon Tetlow
4#  All rights reserved.
5#
6#  Redistribution and use in source and binary forms, with or without
7#  modification, are permitted provided that the following conditions
8#  are met:
9#  1. Redistributions of source code must retain the above copyright
10#     notice, this list of conditions and the following disclaimer.
11#  2. Redistributions in binary form must reproduce the above copyright
12#     notice, this list of conditions and the following disclaimer in the
13#     documentation and/or other materials provided with the distribution.
14#
15#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16#  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18#  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19#  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20#  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21#  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22#  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23#  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24#  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25#  SUCH DAMAGE.
26#
27# $FreeBSD: head/usr.bin/man/man.sh 213470 2010-10-06 07:22:56Z gordon $
28
29# Usage: add_to_manpath path
30# Adds a variable to manpath while ensuring we don't have duplicates.
31# Returns true if we were able to add something. False otherwise.
32add_to_manpath() {
33	case "$manpath" in
34	*:$1)	decho "  Skipping duplicate manpath entry $1" 2 ;;
35	$1:*)	decho "  Skipping duplicate manpath entry $1" 2 ;;
36	*:$1:*)	decho "  Skipping duplicate manpath entry $1" 2 ;;
37	*)	if [ -d "$1" ]; then
38			decho "  Adding $1 to manpath"
39			manpath="$manpath:$1"
40			return 0
41		fi
42		;;
43	esac
44
45	return 1
46}
47
48# Usage: build_manlocales
49# Builds a correct MANLOCALES variable.
50build_manlocales() {
51	# If the user has set manlocales, who are we to argue.
52	if [ -n "$MANLOCALES" ]; then
53		return
54	fi
55
56	parse_configs
57
58	# Trim leading colon
59	MANLOCALES=${manlocales#:}
60
61	decho "Available manual locales: $MANLOCALES"
62}
63
64# Usage: build_manpath
65# Builds a correct MANPATH variable.
66build_manpath() {
67	local IFS
68
69	# If the user has set a manpath, who are we to argue.
70	if [ -n "$MANPATH" ]; then
71		return
72	fi
73
74	search_path
75
76	decho "Adding default manpath entries"
77	IFS=:
78	for path in $man_default_path; do
79		add_to_manpath "$path"
80	done
81	unset IFS
82
83	parse_configs
84
85	# Trim leading colon
86	MANPATH=${manpath#:}
87
88	decho "Using manual path: $MANPATH"
89}
90
91# Usage: check_cat catglob
92# Checks to see if a cat glob is available.
93check_cat() {
94	if exists "$1"; then
95		use_cat=yes
96		catpage=$found
97		decho "    Found catpage $catpage"
98		return 0
99	else
100		return 1
101	fi
102}
103
104# Usage: check_man manglob catglob
105# Given 2 globs, figures out if the manglob is available, if so, check to
106# see if the catglob is also available and up to date.
107check_man() {
108	if exists "$1"; then
109		# We have a match, check for a cat page
110		manpage=$found
111		decho "    Found manpage $manpage"
112
113		if exists "$2" && is_newer $found $manpage; then
114			# cat page found and is newer, use that
115			use_cat=yes
116			catpage=$found
117			decho "    Using catpage $catpage"
118		else
119			# no cat page or is older
120			unset use_cat
121			decho "    Skipping catpage: not found or old"
122		fi
123		return 0
124	fi
125
126	return 1
127}
128
129# Usage: decho "string" [debuglevel]
130# Echoes to stderr string prefaced with -- if high enough debuglevel.
131decho() {
132	if [ $debug -ge ${2:-1} ]; then
133		echo "-- $1" >&2
134	fi
135}
136
137# Usage: exists glob
138# Returns true if glob resolves to a real file.
139exists() {
140	local IFS
141
142	# Don't accidentally inherit callers IFS (breaks perl manpages)
143	unset IFS
144
145	# Use some globbing tricks in the shell to determine if a file
146	# exists or not.
147	set +f
148	set -- "$1" $1
149	set -f
150
151	if [ "$1" != "$2" -a -r "$2" ]; then
152		found="$2"
153		return 0
154	fi
155
156	return 1
157}
158
159# Usage: find_file path section subdir pagename
160# Returns: true if something is matched and found.
161# Search the given path/section combo for a given page.
162find_file() {
163	local manroot catroot mann man0 catn cat0
164
165	manroot="$1/man$2"
166	catroot="$1/cat$2"
167	if [ -n "$3" ]; then
168		manroot="$manroot/$3"
169		catroot="$catroot/$3"
170	fi
171
172	if [ ! -d "$manroot" ]; then
173		return 1
174	fi
175	decho "  Searching directory $manroot" 2
176
177	mann="$manroot/$4.$2*"
178	man0="$manroot/$4.0*"
179	catn="$catroot/$4.$2*"
180	cat0="$catroot/$4.0*"
181
182	# This is the behavior as seen by the original man utility.
183	# Let's not change that which doesn't seem broken.
184	if check_man "$mann" "$catn"; then
185		return 0
186	elif check_man "$man0" "$cat0"; then
187		return 0
188	elif check_cat "$catn"; then
189		return 0
190	elif check_cat "$cat0"; then
191		return 0
192	fi
193
194	return 1
195}
196
197# Usage: is_newer file1 file2
198# Returns true if file1 is newer than file2 as calculated by mtime.
199is_newer() {
200	if [ $(stat -f %m $1) -gt $(stat -f %m $2) ]; then
201		decho "    mtime: $1 newer than $2" 3
202		return 0
203	else
204		decho "    mtime: $1 older than $2" 3
205		return 1
206	fi
207}
208
209# Usage: manpath_parse_args "$@"
210# Parses commandline options for manpath.
211manpath_parse_args() {
212	local cmd_arg
213
214	while getopts 'Ldq' cmd_arg; do
215		case "${cmd_arg}" in
216		L)	Lflag=Lflag ;;
217		d)	debug=$(( $debug + 1 )) ;;
218		q)	qflag=qflag ;;
219		*)	manpath_usage ;;
220		esac
221	done >&2
222}
223
224# Usage: manpath_usage
225# Display usage for the manpath(1) utility.
226manpath_usage() {
227	echo 'usage: manpath [-Ldq]' >&2
228	exit 1
229}
230
231# Usage: manpath_warnings
232# Display some warnings to stderr.
233manpath_warnings() {
234	if [ -z "$Lflag" -a -n "$MANPATH" ]; then
235		echo "(Warning: MANPATH environment variable set)" >&2
236	fi
237
238	if [ -n "$Lflag" -a -n "$MANLOCALES" ]; then
239		echo "(Warning: MANLOCALES environment variable set)" >&2
240	fi
241}
242
243# Usage: man_display_page
244# Display either the manpage or catpage depending on the use_cat variable
245man_display_page() {
246	local EQN COL NROFF PIC TBL TROFF REFER VGRIND
247	local IFS l nroff_dev pipeline preproc_arg tool
248
249	# We are called with IFS set to colon. This causes really weird
250	# things to happen for the variables that have spaces in them.
251	unset IFS
252
253	# If we are supposed to use a catpage and we aren't using troff(1)
254	# just zcat the catpage and we are done.
255	if [ -z "$tflag" -a -n "$use_cat" ]; then
256		if [ -n "$wflag" ]; then
257			echo "$catpage (source: $manpage)"
258			ret=0
259		else
260			if [ $debug -gt 0 ]; then
261				decho "Command: $ZCAT $catpage | $PAGER"
262				ret=0
263			else
264				eval "$ZCAT $catpage | $PAGER"
265				ret=$?
266			fi
267		fi
268		return
269	fi
270
271	# Okay, we are using the manpage, do we just need to output the
272	# name of the manpage?
273	if [ -n "$wflag" ]; then
274		echo "$manpage"
275		ret=0
276		return
277	fi
278
279	# So, we really do need to parse the manpage. First, figure out the
280	# device flag (-T) we have to pass to eqn(1) and groff(1). Then,
281	# setup the pipeline of commands based on the user's request.
282
283	# Apparently the locale flags are switched on where the manpage is
284	# found not just the locale env variables.
285	nroff_dev="ascii"
286	case "X${use_locale}X${manpage}" in
287	XyesX*/${man_lang}*${man_charset}/*)
288		# I don't pretend to know this; I'm just copying from the
289		# previous version of man(1).
290		case "$man_charset" in
291		KOI8-R)		nroff_dev="koi8-r" ;;
292		ISO8859-1)	nroff_dev="latin1" ;;
293		ISO8859-15)	nroff_dev="latin1" ;;
294		UTF-8)		nroff_dev="utf8" ;;
295		*)		nroff_dev="ascii" ;;
296		esac
297
298		NROFF="$NROFF -T$nroff_dev -dlocale=$man_lang.$man_charset"
299		EQN="$EQN -T$nroff_dev"
300
301		# Allow language specific calls to override the default
302		# set of utilities.
303		l=$(echo $man_lang | tr [:lower:] [:upper:])
304		for tool in EQN COL NROFF PIC TBL TROFF REFER VGRIND; do
305			eval "$tool=\${${tool}_$l:-\$$tool}"
306		done
307		;;
308	*)	NROFF="$NROFF -Tascii"
309		EQN="$EQN -Tascii"
310		;;
311	esac
312
313	if [ -n "$MANROFFSEQ" ]; then
314		set -- -$MANROFFSEQ
315		while getopts 'egprtv' preproc_arg; do
316			case "${preproc_arg}" in
317			e)	pipeline="$pipeline | $EQN" ;;
318			g)	;; # Ignore for compatability.
319			p)	pipeline="$pipeline | $PIC" ;;
320			r)	pipeline="$pipeline | $REFER" ;;
321			t)	pipeline="$pipeline | $TBL"; use_col=yes ;;
322			v)	pipeline="$pipeline | $VGRIND" ;;
323			*)	usage ;;
324			esac
325		done
326		# Strip the leading " | " from the resulting pipeline.
327		pipeline="${pipeline#" | "}"
328	else
329		pipeline="$TBL"
330		use_col=yes
331	fi
332
333	if [ -n "$tflag" ]; then
334		pipeline="$pipeline | $TROFF"
335	else
336		pipeline="$pipeline | $NROFF"
337
338		if [ -n "$use_col" ]; then
339			pipeline="$pipeline | $COL"
340		fi
341
342		pipeline="$pipeline | $PAGER"
343	fi
344
345	if [ $debug -gt 0 ]; then
346		decho "Command: $ZCAT $manpage | $pipeline"
347		ret=0
348	else
349		eval "$ZCAT $manpage | $pipeline"
350		ret=$?
351	fi
352}
353
354# Usage: man_find_and_display page
355# Search through the manpaths looking for the given page.
356man_find_and_display() {
357	local found_page locpath p path sect
358
359	IFS=:
360	for sect in $MANSECT; do
361		decho "Searching section $sect" 2
362		for path in $MANPATH; do
363			for locpath in $locpaths; do
364				p=$path/$locpath
365				p=${p%/.} # Rid ourselves of the trailing /.
366
367				# Check if there is a MACHINE specific manpath.
368				if find_file $p $sect $MACHINE "$1"; then
369					found_page=yes
370					man_display_page
371					if [ -n "$aflag" ]; then
372						continue 2
373					else
374						return
375					fi
376				fi
377
378				# Check if there is a MACHINE_ARCH
379				# specific manpath.
380				if find_file $p $sect $MACHINE_ARCH "$1"; then
381					found_page=yes
382					man_display_page
383					if [ -n "$aflag" ]; then
384						continue 2
385					else
386						return
387					fi
388				fi
389
390				# Check plain old manpath.
391				if find_file $p $sect '' "$1"; then
392					found_page=yes
393					man_display_page
394					if [ -n "$aflag" ]; then
395						continue 2
396					else
397						return
398					fi
399				fi
400			done
401		done
402	done
403	unset IFS
404
405	# Nothing? Well, we are done then.
406	if [ -z "$found_page" ]; then
407		echo "No manual entry for $1" >&2
408		ret=1
409		return
410	fi
411}
412
413# Usage: man_parse_args "$@"
414# Parses commandline options for man.
415man_parse_args() {
416	local IFS cmd_arg
417
418	while getopts 'M:P:S:adfhkm:op:tw' cmd_arg; do
419		case "${cmd_arg}" in
420		M)	MANPATH=$OPTARG ;;
421		P)	PAGER=$OPTARG ;;
422		S)	MANSECT=$OPTARG ;;
423		a)	aflag=aflag ;;
424		d)	debug=$(( $debug + 1 )) ;;
425		f)	fflag=fflag ;;
426		h)	man_usage 0 ;;
427		k)	kflag=kflag ;;
428		m)	mflag=$OPTARG ;;
429		o)	oflag=oflag ;;
430		p)	MANROFFSEQ=$OPTARG ;;
431		t)	tflag=tflag ;;
432		w)	wflag=wflag ;;
433		*)	man_usage ;;
434		esac
435	done >&2
436
437	shift $(( $OPTIND - 1 ))
438
439	# Check the args for incompatible options.
440	case "${fflag}${kflag}${tflag}${wflag}" in
441	fflagkflag*)	echo "Incompatible options: -f and -k"; man_usage ;;
442	fflag*tflag*)	echo "Incompatible options: -f and -t"; man_usage ;;
443	fflag*wflag)	echo "Incompatible options: -f and -w"; man_usage ;;
444	*kflagtflag*)	echo "Incompatible options: -k and -t"; man_usage ;;
445	*kflag*wflag)	echo "Incompatible options: -k and -w"; man_usage ;;
446	*tflagwflag)	echo "Incompatible options: -t and -w"; man_usage ;;
447	esac
448
449	# Short circuit for whatis(1) and apropos(1)
450	if [ -n "$fflag" ]; then
451		do_whatis "$@"
452		exit
453	fi
454
455	if [ -n "$kflag" ]; then
456		do_apropos "$@"
457		exit
458	fi
459
460	IFS=:
461	for sect in $man_default_sections; do
462		if [ "$sect" = "$1" ]; then
463			decho "Detected manual section as first arg: $1"
464			MANSECT="$1"
465			shift
466			break
467		fi
468	done
469	unset IFS
470
471	pages="$*"
472}
473
474# Usage: man_setup
475# Setup various trivial but essential variables.
476man_setup() {
477	# Setup machine and architecture variables.
478	if [ -n "$mflag" ]; then
479		MACHINE_ARCH=${mflag%%:*}
480		MACHINE=${mflag##*:}
481	fi
482	if [ -z "$MACHINE_ARCH" ]; then
483		MACHINE_ARCH=$(sysctl -n hw.machine_arch)
484	fi
485	if [ -z "$MACHINE" ]; then
486		MACHINE=$(sysctl -n hw.machine)
487	fi
488	decho "Using architecture: $MACHINE_ARCH:$MACHINE"
489
490	setup_pager
491
492	# Setup manual sections to search.
493	if [ -z "$MANSECT" ]; then
494		MANSECT=$man_default_sections
495	fi
496	decho "Using manual sections: $MANSECT"
497
498	build_manpath
499	man_setup_locale
500}
501
502# Usage: man_setup_locale
503# Setup necessary locale variables.
504man_setup_locale() {
505	# Setup locale information.
506	if [ -n "$oflag" ]; then
507		decho "Using non-localized manpages"
508		unset use_locale
509	elif [ -n "$LC_ALL" ]; then
510		parse_locale "$LC_ALL"
511	elif [ -n "$LC_CTYPE" ]; then
512		parse_locale "$LC_CTYPE"
513	elif [ -n "$LANG" ]; then
514		parse_locale "$LANG"
515	fi
516
517	if [ -n "$use_locale" ]; then
518		locpaths="${man_lang}_${man_country}.${man_charset}"
519		locpaths="$locpaths:$man_lang.$man_charset"
520		if [ "$man_lang" != "en" ]; then
521			locpaths="$locpaths:en.$man_charset"
522		fi
523		locpaths="$locpaths:."
524	else
525		locpaths="."
526	fi
527	decho "Using locale paths: $locpaths"
528}
529
530# Usage: man_usage [exitcode]
531# Display usage for the man utility.
532man_usage() {
533	echo 'Usage:'
534	echo ' man [-adho] [-t | -w] [-M manpath] [-P pager] [-S mansect]'
535	echo '     [-m arch[:machine]] [-p [eprtv]] [mansect] page [...]'
536	echo ' man -f page [...] -- Emulates whatis(1)'
537	echo ' man -k page [...] -- Emulates apropos(1)'
538
539	# When exit'ing with -h, it's not an error.
540	exit ${1:-1}
541}
542
543# Usage: parse_configs
544# Reads the end-user adjustable config files.
545parse_configs() {
546	local IFS file files
547
548	if [ -n "$parsed_configs" ]; then
549		return
550	fi
551
552	unset IFS
553
554	# Read the global config first in case the user wants
555	# to override config_local.
556	if [ -r "$config_global" ]; then
557		parse_file "$config_global"
558	fi
559
560	# Glob the list of files to parse.
561	set +f
562	files=$(echo $config_local)
563	set -f
564
565	for file in $files; do
566		if [ -r "$file" ]; then
567			parse_file "$file"
568		fi
569	done
570
571	parsed_configs='yes'
572}
573
574# Usage: parse_file file
575# Reads the specified config files.
576parse_file() {
577	local file line tstr var
578
579	file="$1"
580	decho "Parsing config file: $file"
581	while read line; do
582		decho "  $line" 2
583		case "$line" in
584		\#*)		decho "    Comment" 3
585				;;
586		MANPATH*)	decho "    MANPATH" 3
587				trim "${line#MANPATH}"
588				add_to_manpath "$tstr"
589				;;
590		MANLOCALE*)	decho "    MANLOCALE" 3
591				trim "${line#MANLOCALE}"
592				manlocales="$manlocales:$tstr"
593				;;
594		MANCONFIG*)	decho "    MANCONFIG" 3
595				trim "${line#MANCONF}"
596				config_local="$tstr"
597				;;
598		# Set variables in the form of FOO_BAR
599		*_*[\ \	]*)	var="${line%%[\ \	]*}"
600				trim "${line#$var}"
601				eval "$var=\"$tstr\""
602				decho "    Parsed $var" 3
603				;;
604		esac
605	done < "$file"
606}
607
608# Usage: parse_locale localestring
609# Setup locale variables for proper parsing.
610parse_locale() {
611	local lang_cc
612
613	case "$1" in
614	C)				;;
615	POSIX)				;;
616	[a-z][a-z]_[A-Z][A-Z]\.*)	lang_cc="${1%.*}"
617					man_lang="${1%_*}"
618					man_country="${lang_cc#*_}"
619					man_charset="${1#*.}"
620					use_locale=yes
621					return 0
622					;;
623	*)				echo 'Unknown locale, assuming C' >&2
624					;;
625	esac
626
627	unset use_locale
628}
629
630# Usage: search_path
631# Traverse $PATH looking for manpaths.
632search_path() {
633	local IFS p path
634
635	decho "Searching PATH for man directories"
636
637	IFS=:
638	for path in $PATH; do
639		# Do a little special casing since the base manpages
640		# are in /usr/share/man instead of /usr/man or /man.
641		case "$path" in
642		/bin|/usr/bin)	add_to_manpath "/usr/share/man" ;;
643		*)	if add_to_manpath "$path/man"; then
644				:
645			elif add_to_manpath "$path/MAN"; then
646				:
647			else
648				case "$path" in
649				*/bin)	p="${path%/bin}/man"
650					add_to_manpath "$p"
651					;;
652				*)	;;
653				esac
654			fi
655			;;
656		esac
657	done
658	unset IFS
659
660	if [ -z "$manpath" ]; then
661		decho '  Unable to find any manpaths, using default'
662		manpath=$man_default_path
663	fi
664}
665
666# Usage: search_whatis cmd [arglist]
667# Do the heavy lifting for apropos/whatis
668search_whatis() {
669	local IFS bad cmd f good key keywords loc opt out path rval wlist
670
671	cmd="$1"
672	shift
673
674	whatis_parse_args "$@"
675
676	build_manpath
677	build_manlocales
678	setup_pager
679
680	if [ "$cmd" = "whatis" ]; then
681		opt="-w"
682	fi
683
684	f='whatis'
685
686	IFS=:
687	for path in $MANPATH; do
688		if [ \! -d "$path" ]; then
689			decho "Skipping non-existent path: $path" 2
690			continue
691		fi
692
693		if [ -f "$path/$f" -a -r "$path/$f" ]; then
694			decho "Found whatis: $path/$f"
695			wlist="$wlist $path/$f"
696		fi
697
698		for loc in $MANLOCALES; do
699			if [ -f "$path/$loc/$f" -a -r "$path/$loc/$f" ]; then
700				decho "Found whatis: $path/$loc/$f"
701				wlist="$wlist $path/$loc/$f"
702			fi
703		done
704	done
705	unset IFS
706
707	if [ -z "$wlist" ]; then
708		echo "$cmd: no whatis databases in $MANPATH" >&2
709		exit 1
710	fi
711
712	rval=0
713	for key in $keywords; do
714		out=$(grep -Ehi $opt -- "$key" $wlist)
715		if [ -n "$out" ]; then
716			good="$good\\n$out"
717		else
718			bad="$bad\\n$key: nothing appropriate"
719			rval=1
720		fi
721	done
722
723	# Strip leading carriage return.
724	good=${good#\\n}
725	bad=${bad#\\n}
726
727	if [ -n "$good" ]; then
728		echo -e "$good" | $PAGER
729	fi
730
731	if [ -n "$bad" ]; then
732		echo -e "$bad" >&2
733	fi
734
735	exit $rval
736}
737
738# Usage: setup_pager
739# Correctly sets $PAGER
740setup_pager() {
741	# Setup pager.
742	if [ -z "$PAGER" ]; then
743		PAGER="more -s"
744	fi
745	decho "Using pager: $PAGER"
746}
747
748# Usage: trim string
749# Trims whitespace from beginning and end of a variable
750trim() {
751	tstr=$1
752	while true; do
753		case "$tstr" in
754		[\ \	]*)	tstr="${tstr##[\ \	]}" ;;
755		*[\ \	])	tstr="${tstr%%[\ \	]}" ;;
756		*)		break ;;
757		esac
758	done
759}
760
761# Usage: whatis_parse_args "$@"
762# Parse commandline args for whatis and apropos.
763whatis_parse_args() {
764	local cmd_arg
765	while getopts 'd' cmd_arg; do
766		case "${cmd_arg}" in
767		d)	debug=$(( $debug + 1 )) ;;
768		*)	whatis_usage ;;
769		esac
770	done >&2
771
772	shift $(( $OPTIND - 1 ))
773
774	keywords="$*"
775}
776
777# Usage: whatis_usage
778# Display usage for the whatis/apropos utility.
779whatis_usage() {
780	echo "usage: $cmd [-d] keyword [...]"
781	exit 1
782}
783
784
785
786# Supported commands
787do_apropos() {
788	search_whatis apropos "$@"
789}
790
791do_man() {
792	man_parse_args "$@"
793	if [ -z "$pages" ]; then
794		echo 'What manual page do you want?' >&2
795		exit 1
796	fi
797	man_setup
798
799	for page in $pages; do
800		decho "Searching for $page"
801		man_find_and_display "$page"
802	done
803
804	exit ${ret:-0}
805}
806
807do_manpath() {
808	manpath_parse_args "$@"
809	if [ -z "$qflag" ]; then
810		manpath_warnings
811	fi
812	if [ -n "$Lflag" ]; then
813		build_manlocales
814		echo $MANLOCALES
815	else
816		build_manpath
817		echo $MANPATH
818	fi
819	exit 0
820}
821
822do_whatis() {
823	search_whatis whatis "$@"
824}
825
826EQN=/usr/bin/eqn
827COL=/usr/bin/col
828NROFF='/usr/bin/groff -S -Wall -mtty-char -man'
829PIC=/usr/bin/pic
830TBL=/usr/bin/tbl
831TROFF='/usr/bin/groff -S -man'
832REFER=/usr/bin/refer
833VGRIND=/usr/bin/vgrind
834ZCAT='/usr/bin/zcat -f'
835
836debug=0
837man_default_sections='1:1aout:8:2:3:n:4:5:6:7:9:l'
838man_default_path='/usr/share/man:/usr/share/openssl/man:/usr/local/man'
839
840config_global='/etc/man.conf'
841
842# This can be overridden via a setting in /etc/man.conf.
843config_local='/usr/local/etc/man.d/*.conf'
844
845# Set noglobbing for now. I don't want spurious globbing.
846set -f
847
848case "$0" in
849*apropos)	do_apropos "$@" ;;
850*manpath)	do_manpath "$@" ;;
851*whatis)	do_whatis "$@" ;;
852*)		do_man "$@" ;;
853esac
854