#! /bin/sh # # Copyright (c) 2010 Gordon Tetlow # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD: stable/11/usr.bin/man/man.sh 324233 2017-10-03 08:14:25Z bapt $ # Usage: add_to_manpath path # Adds a variable to manpath while ensuring we don't have duplicates. # Returns true if we were able to add something. False otherwise. proc add_to_manpath { match $manpath { with *:$1 decho " Skipping duplicate manpath entry $1" 2 with $1:* decho " Skipping duplicate manpath entry $1" 2 with *:$1:* decho " Skipping duplicate manpath entry $1" 2 with * if test -d $1 { decho " Adding $1 to manpath" setglobal manpath = ""$manpath:$1"" return 0 } } return 1 } # Usage: build_manlocales # Builds a correct MANLOCALES variable. proc build_manlocales { # If the user has set manlocales, who are we to argue. if test -n $MANLOCALES { return } parse_configs # Trim leading colon setglobal MANLOCALES = $(manlocales#:) decho "Available manual locales: $MANLOCALES" } # Usage: build_manpath # Builds a correct MANPATH variable. proc build_manpath { local IFS # If the user has set a manpath, who are we to argue. if test -n $MANPATH { match $MANPATH { with *: setglobal PREPEND_MANPATH = $(MANPATH) with :* setglobal APPEND_MANPATH = $(MANPATH) with *::* setglobal PREPEND_MANPATH = $(MANPATH%%::*) setglobal APPEND_MANPATH = $(MANPATH#*::) with * return } } if test -n $PREPEND_MANPATH { setglobal IFS = ':' for path in [$PREPEND_MANPATH] { add_to_manpath $path } unset IFS } search_path decho "Adding default manpath entries" setglobal IFS = ':' for path in [$man_default_path] { add_to_manpath $path } unset IFS parse_configs if test -n $APPEND_MANPATH { setglobal IFS = ':' for path in [$APPEND_MANPATH] { add_to_manpath $path } unset IFS } # Trim leading colon setglobal MANPATH = $(manpath#:) decho "Using manual path: $MANPATH" } # Usage: check_cat catglob # Checks to see if a cat glob is available. proc check_cat { if exists $1 { setglobal use_cat = 'yes' setglobal catpage = $found setup_cattool $catpage decho " Found catpage $catpage" return 0 } else { return 1 } } # Usage: check_man manglob catglob # Given 2 globs, figures out if the manglob is available, if so, check to # see if the catglob is also available and up to date. proc check_man { if exists $1 { # We have a match, check for a cat page setglobal manpage = $found setup_cattool $manpage decho " Found manpage $manpage" if test -n $(use_width) { # non-standard width unset use_cat decho " Skipping catpage: non-standard page width" } elif exists $2 && is_newer $found $manpage { # cat page found and is newer, use that setglobal use_cat = 'yes' setglobal catpage = $found setup_cattool $catpage decho " Using catpage $catpage" } else { # no cat page or is older unset use_cat decho " Skipping catpage: not found or old" } return 0 } return 1 } # Usage: decho "string" [debuglevel] # Echoes to stderr string prefaced with -- if high enough debuglevel. proc decho { if test $debug -ge $(2:-1) { echo "-- $1" > !2 } } # Usage: exists glob # Returns true if glob resolves to a real file. proc exists { local IFS # Don't accidentally inherit callers IFS (breaks perl manpages) unset IFS # Use some globbing tricks in the shell to determine if a file # exists or not. set +f set -- $1 $1 set -f if test $1 != $2 -a -r $2 { setglobal found = $2 return 0 } return 1 } # Usage: find_file path section subdir pagename # Returns: true if something is matched and found. # Search the given path/section combo for a given page. proc find_file { local manroot catroot mann man0 catn cat0 setglobal manroot = ""$1/man$2"" setglobal catroot = ""$1/cat$2"" if test -n $3 { setglobal manroot = ""$manroot/$3"" setglobal catroot = ""$catroot/$3"" } if test ! -d $manroot { return 1 } decho " Searching directory $manroot" 2 setglobal mann = ""$manroot/$4.$2*"" setglobal man0 = ""$manroot/$4.0*"" setglobal catn = ""$catroot/$4.$2*"" setglobal cat0 = ""$catroot/$4.0*"" # This is the behavior as seen by the original man utility. # Let's not change that which doesn't seem broken. if check_man $mann $catn { return 0 } elif check_man $man0 $cat0 { return 0 } elif check_cat $catn { return 0 } elif check_cat $cat0 { return 0 } return 1 } # Usage: is_newer file1 file2 # Returns true if file1 is newer than file2 as calculated by mtime. proc is_newer { if ! test $1 -ot $2 { decho " mtime: $1 not older than $2" 3 return 0 } else { decho " mtime: $1 older than $2" 3 return 1 } } # Usage: manpath_parse_args "$@" # Parses commandline options for manpath. proc manpath_parse_args { local cmd_arg while getopts 'Ldq' cmd_arg { match $(cmd_arg) { with L setglobal Lflag = 'Lflag' with d setglobal debug = $shExpr(' $debug + 1 ') with q setglobal qflag = 'qflag' with * manpath_usage } } >&2 } # Usage: manpath_usage # Display usage for the manpath(1) utility. proc manpath_usage { echo 'usage: manpath [-Ldq]' > !2 exit 1 } # Usage: manpath_warnings # Display some warnings to stderr. proc manpath_warnings { if test -n $Lflag -a -n $MANLOCALES { echo "(Warning: MANLOCALES environment variable set)" > !2 } } # Usage: man_check_for_so page path # Returns: True if able to resolve the file, false if it ended in tears. # Detects the presence of the .so directive and causes the file to be # redirected to another source file. proc man_check_for_so { local IFS line tstr unset IFS # We need to loop to accommodate multiple .so directives. while true { setglobal line = $[$cattool $manpage | head -1] match $line { with .so* trim $(line#.so) decho "$manpage includes $tstr" # Glob and check for the file. if ! check_man "$path/$tstr*" "" { decho " Unable to find $tstr" return 1 } with * break } } return 0 } # Usage: man_display_page # Display either the manpage or catpage depending on the use_cat variable proc man_display_page { local IFS pipeline testline # We are called with IFS set to colon. This causes really weird # things to happen for the variables that have spaces in them. unset IFS # If we are supposed to use a catpage and we aren't using troff(1) # just zcat the catpage and we are done. if test -z $tflag -a -n $use_cat { if test -n $wflag { echo "$catpage (source: $manpage)" setglobal ret = '0' } else { if test $debug -gt 0 { decho "Command: $cattool $catpage | $MANPAGER" setglobal ret = '0' } else { eval "$cattool $catpage | $MANPAGER" setglobal ret = $Status } } return } # Okay, we are using the manpage, do we just need to output the # name of the manpage? if test -n $wflag { echo $manpage setglobal ret = '0' return } if test -n $use_width { setglobal mandoc_args = ""-O width=$(use_width)"" } setglobal testline = '"mandoc -Tlint -Wunsupp >/dev/null 2>&1'" if test -n $tflag { setglobal pipeline = ""mandoc -Tps $mandoc_args"" } else { setglobal pipeline = ""mandoc $mandoc_args | $MANPAGER"" } if ! eval "$cattool $manpage | $testline" { if which -s groff { man_display_page_groff } else { echo "This manpage needs groff(1) to be rendered" > !2 echo "First install groff(1): " > !2 echo "pkg install groff " > !2 setglobal ret = '1' } return } if test $debug -gt 0 { decho "Command: $cattool $manpage | $pipeline" setglobal ret = '0' } else { eval "$cattool $manpage | $pipeline" setglobal ret = $Status } } # Usage: man_display_page_groff # Display the manpage using groff proc man_display_page_groff { local EQN NROFF PIC TBL TROFF REFER VGRIND local IFS l nroff_dev pipeline preproc_arg tool # So, we really do need to parse the manpage. First, figure out the # device flag (-T) we have to pass to eqn(1) and groff(1). Then, # setup the pipeline of commands based on the user's request. # If the manpage is from a particular charset, we need to setup nroff # to properly output for the correct device. match $(manpage) { with *.${man_charset}/* # I don't pretend to know this; I'm just copying from the # previous version of man(1). match $man_charset { with KOI8-R setglobal nroff_dev = '"koi8-r'" with ISO8859-1 setglobal nroff_dev = '"latin1'" with ISO8859-15 setglobal nroff_dev = '"latin1'" with UTF-8 setglobal nroff_dev = '"utf8'" with * setglobal nroff_dev = '"ascii'" } setglobal NROFF = ""$NROFF -T$nroff_dev"" setglobal EQN = ""$EQN -T$nroff_dev"" # Iff the manpage is from the locale and not just the charset, # then we need to define the locale string. match $(manpage) { with */${man_lang}_${man_country}.${man_charset}/* setglobal NROFF = ""$NROFF -dlocale=$man_lang.$man_charset"" with */${man_lang}.${man_charset}/* setglobal NROFF = ""$NROFF -dlocale=$man_lang.$man_charset"" } # Allow language specific calls to override the default # set of utilities. setglobal l = $[echo $man_lang | tr [:lower:] [:upper:]] for tool in [EQN NROFF PIC TBL TROFF REFER VGRIND] { eval "$tool=\${$(tool)_$l:-\$$tool}" } with * setglobal NROFF = ""$NROFF -Tascii"" setglobal EQN = ""$EQN -Tascii"" } if test -z $MANCOLOR { setglobal NROFF = ""$NROFF -P-c"" } if test -n $(use_width) { setglobal NROFF = ""$NROFF -rLL=$(use_width)n -rLT=$(use_width)n"" } if test -n $MANROFFSEQ { set -- -$MANROFFSEQ while getopts 'egprtv' preproc_arg { match $(preproc_arg) { with e setglobal pipeline = ""$pipeline | $EQN"" with g # Ignore for compatibility. with p setglobal pipeline = ""$pipeline | $PIC"" with r setglobal pipeline = ""$pipeline | $REFER"" with t setglobal pipeline = ""$pipeline | $TBL"" with v setglobal pipeline = ""$pipeline | $VGRIND"" with * usage } } # Strip the leading " | " from the resulting pipeline. setglobal pipeline = $(pipeline#" | ") } else { setglobal pipeline = $TBL } if test -n $tflag { setglobal pipeline = ""$pipeline | $TROFF"" } else { setglobal pipeline = ""$pipeline | $NROFF | $MANPAGER"" } if test $debug -gt 0 { decho "Command: $cattool $manpage | $pipeline" setglobal ret = '0' } else { eval "$cattool $manpage | $pipeline" setglobal ret = $Status } } # Usage: man_find_and_display page # Search through the manpaths looking for the given page. proc man_find_and_display { local found_page locpath p path sect # Check to see if it's a file. But only if it has a '/' in # the filename. match $1 { with */* if test -f $1 -a -r $1 { decho "Found a usable page, displaying that" unset use_cat setglobal manpage = $1 setup_cattool $manpage if man_check_for_so $manpage $[dirname $manpage] { setglobal found_page = 'yes' man_display_page } return } } setglobal IFS = ':' for sect in [$MANSECT] { decho "Searching section $sect" 2 for path in [$MANPATH] { for locpath in [$locpaths] { setglobal p = "$path/$locpath" setglobal p = $(p%/.) # Rid ourselves of the trailing /. # Check if there is a MACHINE specific manpath. if find_file $p $sect $MACHINE $1 { if man_check_for_so $manpage $p { setglobal found_page = 'yes' man_display_page if test -n $aflag { continue 2 } else { return } } } # Check if there is a MACHINE_ARCH # specific manpath. if find_file $p $sect $MACHINE_ARCH $1 { if man_check_for_so $manpage $p { setglobal found_page = 'yes' man_display_page if test -n $aflag { continue 2 } else { return } } } # Check plain old manpath. if find_file $p $sect '' $1 { if man_check_for_so $manpage $p { setglobal found_page = 'yes' man_display_page if test -n $aflag { continue 2 } else { return } } } } } } unset IFS # Nothing? Well, we are done then. if test -z $found_page { echo "No manual entry for $1" > !2 setglobal ret = '1' return } } # Usage: man_parse_args "$@" # Parses commandline options for man. proc man_parse_args { local IFS cmd_arg while getopts 'M:P:S:adfhkm:op:tw' cmd_arg { match $(cmd_arg) { with M setglobal MANPATH = $OPTARG with P setglobal MANPAGER = $OPTARG with S setglobal MANSECT = $OPTARG with a setglobal aflag = 'aflag' with d setglobal debug = $shExpr(' $debug + 1 ') with f setglobal fflag = 'fflag' with h man_usage 0 with k setglobal kflag = 'kflag' with m setglobal mflag = $OPTARG with o setglobal oflag = 'oflag' with p setglobal MANROFFSEQ = $OPTARG with t setglobal tflag = 'tflag' with w setglobal wflag = 'wflag' with * man_usage } } >&2 shift $shExpr(' $OPTIND - 1 ') # Check the args for incompatible options. match "$(fflag)$(kflag)$(tflag)$(wflag)" { with fflagkflag* echo "Incompatible options: -f and -k"; man_usage with fflag*tflag* echo "Incompatible options: -f and -t"; man_usage with fflag*wflag echo "Incompatible options: -f and -w"; man_usage with *kflagtflag* echo "Incompatible options: -k and -t"; man_usage with *kflag*wflag echo "Incompatible options: -k and -w"; man_usage with *tflagwflag echo "Incompatible options: -t and -w"; man_usage } # Short circuit for whatis(1) and apropos(1) if test -n $fflag { do_whatis @Argv exit } if test -n $kflag { do_apropos @Argv exit } setglobal IFS = ':' for sect in [$man_default_sections] { if test $sect = $1 { decho "Detected manual section as first arg: $1" setglobal MANSECT = $1 shift break } } unset IFS setglobal pages = "$ifsjoin(Argv)" } # Usage: man_setup # Setup various trivial but essential variables. proc man_setup { # Setup machine and architecture variables. if test -n $mflag { setglobal MACHINE_ARCH = $(mflag%%:*) setglobal MACHINE = $(mflag##*:) } if test -z $MACHINE_ARCH { setglobal MACHINE_ARCH = $[$SYSCTL -n hw.machine_arch] } if test -z $MACHINE { setglobal MACHINE = $[$SYSCTL -n hw.machine] } decho "Using architecture: $MACHINE_ARCH:$MACHINE" setup_pager # Setup manual sections to search. if test -z $MANSECT { setglobal MANSECT = $man_default_sections } decho "Using manual sections: $MANSECT" build_manpath man_setup_locale man_setup_width } # Usage: man_setup_width # Set up page width. proc man_setup_width { local sizes unset use_width match $MANWIDTH { with [0-9]* if test $MANWIDTH -gt 0 2>/dev/null { setglobal use_width = $MANWIDTH } with [Tt][Tt][Yy] if do { setglobal sizes = $[$STTY size !0 > !3 !2 >/dev/null]; } 3>&1 { set -- $sizes if test $2 -gt 80 { setglobal use_width = $shExpr('$2-2') } } } if test -n $use_width { decho "Using non-standard page width: $(use_width)" } else { decho 'Using standard page width' } } # Usage: man_setup_locale # Setup necessary locale variables. proc man_setup_locale { local lang_cc setglobal locpaths = ''.'' setglobal man_charset = ''US-ASCII'' # Setup locale information. if test -n $oflag { decho 'Using non-localized manpages' } else { # Use the locale tool to give us the proper LC_CTYPE eval $[ $LOCALE] match $LC_CTYPE { with C with POSIX with [a-z][a-z]_[A-Z][A-Z]\.* setglobal lang_cc = $(LC_CTYPE%.*) setglobal man_lang = $(LC_CTYPE%_*) setglobal man_country = $(lang_cc#*_) setglobal man_charset = $(LC_CTYPE#*.) setglobal locpaths = $LC_CTYPE setglobal locpaths = ""$locpaths:$man_lang.$man_charset"" if test $man_lang != "en" { setglobal locpaths = ""$locpaths:en.$man_charset"" } setglobal locpaths = ""$locpaths:."" with * echo 'Unknown locale, assuming C' > !2 } } decho "Using locale paths: $locpaths" } # Usage: man_usage [exitcode] # Display usage for the man utility. proc man_usage { echo 'Usage:' echo ' man [-adho] [-t | -w] [-M manpath] [-P pager] [-S mansect]' echo ' [-m arch[:machine]] [-p [eprtv]] [mansect] page [...]' echo ' man -f page [...] -- Emulates whatis(1)' echo ' man -k page [...] -- Emulates apropos(1)' # When exit'ing with -h, it's not an error. exit ${1:-1} } # Usage: parse_configs # Reads the end-user adjustable config files. proc parse_configs { local IFS file files if test -n $parsed_configs { return } unset IFS # Read the global config first in case the user wants # to override config_local. if test -r $config_global { parse_file $config_global } # Glob the list of files to parse. set +f setglobal files = $[echo $config_local] set -f for file in [$files] { if test -r $file { parse_file $file } } setglobal parsed_configs = ''yes'' } # Usage: parse_file file # Reads the specified config files. proc parse_file { local file line tstr var setglobal file = $1 decho "Parsing config file: $file" while read line { decho " $line" 2 match $line { with \#* decho " Comment" 3 with MANPATH* decho " MANPATH" 3 trim $(line#MANPATH) add_to_manpath $tstr with MANLOCALE* decho " MANLOCALE" 3 trim $(line#MANLOCALE) setglobal manlocales = ""$manlocales:$tstr"" with MANCONFIG* decho " MANCONFIG" 3 trim $(line#MANCONFIG) setglobal config_local = $tstr # Set variables in the form of FOO_BAR with *_*[\ \ ]* setglobal var = $(line%%[\ \ ]*) trim $(line#$var) eval "$var=\"$tstr\"" decho " Parsed $var" 3 } } < "$file" } # Usage: search_path # Traverse $PATH looking for manpaths. proc search_path { local IFS p path decho "Searching PATH for man directories" setglobal IFS = ':' for path in [$PATH] { # Do a little special casing since the base manpages # are in /usr/share/man instead of /usr/man or /man. match $path { with /bin|/usr/bin add_to_manpath "/usr/share/man" with * if add_to_manpath "$path/man" { : } elif add_to_manpath "$path/MAN" { : } else { match $path { with */bin setglobal p = ""$(path%/bin)/man"" add_to_manpath $p setglobal p = ""$(path%/bin)/share/man"" add_to_manpath $p with * } } } } unset IFS if test -z $manpath { decho ' Unable to find any manpaths, using default' setglobal manpath = $man_default_path } } # Usage: search_whatis cmd [arglist] # Do the heavy lifting for apropos/whatis proc search_whatis { local IFS bad cmd f good key keywords loc opt out path rval wlist setglobal cmd = $1 shift whatis_parse_args @Argv build_manpath build_manlocales setup_pager if test $cmd = "whatis" { setglobal opt = '"-w'" } setglobal f = ''whatis'' setglobal IFS = ':' for path in [$MANPATH] { if test '!' -d $path { decho "Skipping non-existent path: $path" 2 continue } if test -f "$path/$f" -a -r "$path/$f" { decho "Found whatis: $path/$f" setglobal wlist = ""$wlist $path/$f"" } for loc in [$MANLOCALES] { if test -f "$path/$loc/$f" -a -r "$path/$loc/$f" { decho "Found whatis: $path/$loc/$f" setglobal wlist = ""$wlist $path/$loc/$f"" } } } unset IFS if test -z $wlist { echo "$cmd: no whatis databases in $MANPATH" > !2 exit 1 } setglobal rval = '0' for key in [$keywords] { setglobal out = $[grep -Ehi $opt -- $key $wlist] if test -n $out { setglobal good = ""$good\\n$out"" } else { setglobal bad = ""$bad\\n$key: nothing appropriate"" setglobal rval = '1' } } # Strip leading carriage return. setglobal good = $(good#\\n) setglobal bad = $(bad#\\n) if test -n $good { echo -e $good | $MANPAGER } if test -n $bad { echo -e $bad > !2 } exit $rval } # Usage: setup_cattool page # Finds an appropriate decompressor based on extension proc setup_cattool { match $1 { with *.bz setglobal cattool = ''/usr/bin/bzcat'' with *.bz2 setglobal cattool = ''/usr/bin/bzcat'' with *.gz setglobal cattool = ''/usr/bin/zcat'' with *.lzma setglobal cattool = ''/usr/bin/lzcat'' with *.xz setglobal cattool = ''/usr/bin/xzcat'' with * setglobal cattool = ''/usr/bin/zcat -f'' } } # Usage: setup_pager # Correctly sets $MANPAGER proc setup_pager { # Setup pager. if test -z $MANPAGER { if test -n $MANCOLOR { setglobal MANPAGER = '"less -sR'" } else { if test -n $PAGER { setglobal MANPAGER = $PAGER } else { setglobal MANPAGER = '"more -s'" } } } decho "Using pager: $MANPAGER" } # Usage: trim string # Trims whitespace from beginning and end of a variable proc trim { setglobal tstr = $1 while true { match $tstr { with [\ \ ]* setglobal tstr = $(tstr##[\ \ ]) with *[\ \ ] setglobal tstr = $(tstr%%[\ \ ]) with * break } } } # Usage: whatis_parse_args "$@" # Parse commandline args for whatis and apropos. proc whatis_parse_args { local cmd_arg while getopts 'd' cmd_arg { match $(cmd_arg) { with d setglobal debug = $shExpr(' $debug + 1 ') with * whatis_usage } } >&2 shift $shExpr(' $OPTIND - 1 ') setglobal keywords = "$ifsjoin(Argv)" } # Usage: whatis_usage # Display usage for the whatis/apropos utility. proc whatis_usage { echo "usage: $cmd [-d] keyword [...]" exit 1 } # Supported commands proc do_apropos { test $[stat -f %i /usr/bin/man] -ne $[stat -f %i /usr/bin/apropos] && \ exec apropos @Argv search_whatis apropos @Argv } proc do_man { man_parse_args @Argv if test -z $pages { echo 'What manual page do you want?' > !2 exit 1 } man_setup for page in [$pages] { decho "Searching for $page" man_find_and_display $page } exit ${ret:-0} } proc do_manpath { manpath_parse_args @Argv if test -z $qflag { manpath_warnings } if test -n $Lflag { build_manlocales echo $MANLOCALES } else { build_manpath echo $MANPATH } exit 0 } proc do_whatis { test $[stat -f %i /usr/bin/man] -ne $[stat -f %i /usr/bin/whatis] && \ exec whatis @Argv search_whatis whatis @Argv } # User's PATH setting decides on the groff-suite to pick up. setglobal EQN = 'eqn' setglobal NROFF = ''groff -S -P-h -Wall -mtty-char -man'' setglobal PIC = 'pic' setglobal REFER = 'refer' setglobal TBL = 'tbl' setglobal TROFF = ''groff -S -man'' setglobal VGRIND = 'vgrind' setglobal LOCALE = '/usr/bin/locale' setglobal STTY = '/bin/stty' setglobal SYSCTL = '/sbin/sysctl' setglobal debug = '0' setglobal man_default_sections = ''1:8:2:3:n:4:5:6:7:9:l'' setglobal man_default_path = ''/usr/share/man:/usr/share/openssl/man:/usr/local/man'' setglobal cattool = ''/usr/bin/zcat -f'' setglobal config_global = ''/etc/man.conf'' # This can be overridden via a setting in /etc/man.conf. setglobal config_local = ''/usr/local/etc/man.d/*.conf'' # Set noglobbing for now. I don't want spurious globbing. set -f match $0 { with *apropos do_apropos @Argv with *manpath do_manpath @Argv with *whatis do_whatis @Argv with * do_man @Argv }