Lines Matching +full:trim +full:- +full:config
3 # SPDX-License-Identifier: BSD-2-Clause
34 ulimit -t 20
40 set -o pipefail
50 *) if [ -d "$1" ]; then
65 if [ -n "$MANLOCALES" ]; then
71 # Trim leading colon
81 if [ -n "$MANSECT" ]; then
87 # Trim leading colon
90 if [ -z "$MANSECT" ]; then
102 if [ -n "$MANPATH" ]; then
114 if [ -n "$PREPEND_MANPATH" ]; then
133 if [ -n "$APPEND_MANPATH" ]; then
140 # Trim leading colon
170 if [ -n "${use_width}" ]; then
171 # non-standard width
173 decho " Skipping catpage: non-standard page width"
192 # Echoes to stderr string prefaced with -- if high enough debuglevel.
194 if [ $debug -ge ${2:-1} ]; then
195 echo "-- $1" >&2
204 if [ -z "$1" ]; then
218 if [ -r "$file" ]; then
220 set -f
224 set -f
237 if [ -n "$3" ]; then
242 if [ ! -d "$manroot" -a ! -d "$catroot" ]; then
270 if ! [ "$1" -ot "$2" ]; then
298 echo 'usage: manpath [-Ldq]' >&2
305 if [ -n "$Lflag" -a -n "$MANLOCALES" ]; then
320 if [ -n "$catpage" ]; then
325 while [ $counter_so -lt $counter_so_limit ]
329 line=$($cattool "$manpage" 2>/dev/null | grep -E -m1 -v '^\.\\"[ ]*|^[ ]*$')
332 '.so '*) trim "${line#.so}"
345 if [ $counter_so -ge $counter_so_limit ]; then
363 if [ -z "$tflag" -a -n "$use_cat" ]; then
364 if [ -n "$wflag" ]; then
368 if [ $debug -gt 0 ]; then
381 if [ -n "$wflag" ]; then
387 if [ -n "$use_width" ]; then
388 mandoc_args="-O width=${use_width}"
390 testline="mandoc -Tlint -Wunsupp >/dev/null 2>&1"
391 if [ -n "$tflag" ]; then
392 pipeline="mandoc -Tps $mandoc_args"
398 if which -s groff; then
409 if [ $debug -gt 0 ]; then
425 # device flag (-T) we have to pass to eqn(1) and groff(1). Then,
435 KOI8-R) nroff_dev="koi8-r" ;;
436 ISO8859-1) nroff_dev="latin1" ;;
437 ISO8859-15) nroff_dev="latin1" ;;
438 UTF-8) nroff_dev="utf8" ;;
442 NROFF="$NROFF -T$nroff_dev"
443 EQN="$EQN -T$nroff_dev"
449 NROFF="$NROFF -dlocale=$man_lang.$man_charset"
452 NROFF="$NROFF -dlocale=$man_lang.$man_charset"
460 eval "$tool=\${${tool}_$l:-\$$tool}"
463 *) NROFF="$NROFF -Tascii"
464 EQN="$EQN -Tascii"
468 if [ -z "$MANCOLOR" ]; then
469 NROFF="$NROFF -P-c"
472 if [ -n "${use_width}" ]; then
473 NROFF="$NROFF -rLL=${use_width}n -rLT=${use_width}n"
476 if [ -n "$MANROFFSEQ" ]; then
477 set -- -$MANROFFSEQ
496 if [ -n "$tflag" ]; then
502 if [ $debug -gt 0 ]; then
517 # the filename or if -l was specified.
522 if [ -n "$has_slash" -o -n "$lflag" ]; then
523 if [ -f "$1" -a -r "$1" ]; then
525 if [ -z "$lflag" ]; then
527 "use -l instead." >&2
542 elif [ -n "$lflag" ]; then
562 if [ -n "$aflag" ]; then
576 if [ -n "$aflag" ]; then
589 if [ -n "$aflag" ]; then
602 if [ -z "$found_page" ]; then
637 shift $(( $OPTIND - 1 ))
641 Kflagfflag*) echo "Incompatible options: -K and -f"; man_usage ;;
642 Kflag*kflag*) echo "Incompatible options: -K and -k"; man_usage ;;
643 Kflag*lflag*) echo "Incompatible options: -K and -l"; man_usage ;;
644 Kflag*tflag) echo "Incompatible options: -K and -t"; man_usage ;;
645 fflagkflag*) echo "Incompatible options: -f and -k"; man_usage ;;
646 fflag*lflag*) echo "Incompatible options: -f and -l"; man_usage ;;
647 fflag*tflag*) echo "Incompatible options: -f and -t"; man_usage ;;
648 fflag*wflag) echo "Incompatible options: -f and -w"; man_usage ;;
649 *kflaglflag*) echo "Incompatible options: -k and -l"; man_usage ;;
650 *kflag*tflag*) echo "Incompatible options: -k and -t"; man_usage ;;
651 *kflag*wflag) echo "Incompatible options: -k and -w"; man_usage ;;
652 *lflag*wflag) echo "Incompatible options: -l and -w"; man_usage ;;
653 *tflagwflag) echo "Incompatible options: -t and -w"; man_usage ;;
657 if [ -n "$fflag" ]; then
662 if [ -n "$kflag" ]; then
672 if [ -n "$mflag" ]; then
676 if [ -z "$MACHINE_ARCH" ]; then
677 MACHINE_ARCH=$($SYSCTL -n hw.machine_arch)
679 if [ -z "$MACHINE" ]; then
680 MACHINE=$($SYSCTL -n hw.machine)
698 [0-9]*)
699 if [ "$MANWIDTH" -gt 0 2>/dev/null ]; then
705 set -- $sizes
706 if [ $2 -gt 80 ]; then
707 use_width=$(($2-2))
712 if [ -n "$use_width" ]; then
713 decho "Using non-standard page width: ${use_width}"
726 man_charset='US-ASCII'
729 if [ -n "$oflag" ]; then
730 decho 'Using non-localized manpages'
735 if [ -n "$LANG" ]; then
743 C.UTF-8) ;;
745 [a-z][a-z]_[A-Z][A-Z]\.*)
769 echo ' man [-adhlo] [-t | -w] [-M manpath] [-P pager] [-S mansect]'
770 echo ' [-m arch[:machine]] [-p [eprtv]] [mansect] page [...]'
771 echo ' man -K | -f | -k expression [...] -- Search manual pages'
773 # When exit'ing with -h, it's not an error.
774 exit ${1:-1}
778 # Reads the end-user adjustable config files.
782 if [ -n "$parsed_configs" ]; then
788 # Read the global config first in case the user wants
790 if [ -r "$config_global" ]; then
797 set -f
800 if [ -r "$file" ]; then
809 # Reads the specified config files.
814 decho "Parsing config file: $file"
821 trim "${line#MANPATH}"
825 trim "${line#MANLOCALE}"
829 trim "${line#MANCONFIG}"
833 trim "${line#MANSECT}"
838 trim "${line#$var}"
871 if [ -z "$manpath" ]; then
892 opt="-w"
899 if [ \! -d "$path" ]; then
900 decho "Skipping non-existent path: $path" 2
904 if [ -f "$path/$f" -a -r "$path/$f" ]; then
910 if [ -f "$path/$loc/$f" -a -r "$path/$loc/$f" ]; then
918 if [ -z "$wlist" ]; then
925 out=$(grep -Ehi $opt -- "$key" $wlist)
926 if [ -n "$out" ]; then
938 if [ -n "$good" ]; then
942 if [ -n "$bad" ]; then
959 *) cattool='/usr/bin/zcat -f' ;;
967 if [ -z "$MANPAGER" ]; then
968 if [ -n "$MANCOLOR" ]; then
969 MANPAGER="less -sR"
971 if [ -n "$PAGER" ]; then
974 MANPAGER="less -s"
981 # Usage: trim string
983 trim() { function
1006 shift $(( $OPTIND - 1 ))
1014 echo "usage: $cmd [-d] keyword [...]"
1022 [ $(stat -f %i /usr/bin/man) -ne $(stat -f %i /usr/bin/apropos) ] && \
1035 gflags="-H"
1037 # wflag implies -l for grep(1)
1038 if [ -n "$wflag" ]; then
1039 gflags="${gflags} -l"
1042 gflags="${gflags} --label"
1049 grep -E ${gflags} "${manfile}" -e "${re}"
1053 set -f
1062 shift $(( $OPTIND - 1 ))
1075 if [ -z "$pages" -a -z "${Kflag}" ]; then
1080 if [ ! -z "${Kflag}" ]; then
1081 # Short circuit because -K flag does a sufficiently
1095 if [ ${ret:-0} -gt 128 ]; then
1096 if [ "$(kill -l "${ret}")" = "PIPE" ]; then
1101 exit ${ret:-0}
1106 if [ -z "$qflag" ]; then
1109 if [ -n "$Lflag" ]; then
1120 [ $(stat -f %i /usr/bin/man) -ne $(stat -f %i /usr/bin/whatis) ] && \
1125 # User's PATH setting decides on the groff-suite to pick up.
1127 NROFF='groff -S -P-h -Wall -mtty-char -mandoc'
1131 TROFF='groff -S -mandoc'
1141 cattool='/usr/bin/zcat -f'
1149 set -f