Lines 548-556
Link Here
|
548 |
fi |
548 |
fi |
549 |
} |
549 |
} |
550 |
|
550 |
|
551 |
# Usage: man_parse_args "$@" |
551 |
# Usage: man_parse_opts "$@" |
552 |
# Parses commandline options for man. |
552 |
# Parses commandline options for man. |
553 |
man_parse_args() { |
553 |
man_parse_opts() { |
554 |
local IFS cmd_arg |
554 |
local IFS cmd_arg |
555 |
|
555 |
|
556 |
OPTIND=1 |
556 |
OPTIND=1 |
Lines 601-619
Link Here
|
601 |
do_apropos "$@" |
601 |
do_apropos "$@" |
602 |
exit |
602 |
exit |
603 |
fi |
603 |
fi |
604 |
|
|
|
605 |
IFS=: |
606 |
for sect in $man_default_sections; do |
607 |
if [ "$sect" = "$1" ]; then |
608 |
decho "Detected manual section as first arg: $1" |
609 |
MANSECT="$1" |
610 |
shift |
611 |
break |
612 |
fi |
613 |
done |
614 |
unset IFS |
615 |
|
616 |
pages="$*" |
617 |
} |
604 |
} |
618 |
|
605 |
|
619 |
# Usage: man_setup |
606 |
# Usage: man_setup |
Lines 634-645
Link Here
|
634 |
|
621 |
|
635 |
setup_pager |
622 |
setup_pager |
636 |
|
623 |
|
637 |
# Setup manual sections to search. |
|
|
638 |
if [ -z "$MANSECT" ]; then |
639 |
MANSECT=$man_default_sections |
640 |
fi |
641 |
decho "Using manual sections: $MANSECT" |
642 |
|
643 |
build_manpath |
624 |
build_manpath |
644 |
man_setup_locale |
625 |
man_setup_locale |
645 |
man_setup_width |
626 |
man_setup_width |
Lines 787-792
Link Here
|
787 |
trim "${line#MANCONFIG}" |
768 |
trim "${line#MANCONFIG}" |
788 |
config_local="$tstr" |
769 |
config_local="$tstr" |
789 |
;; |
770 |
;; |
|
|
771 |
MANSECT*) decho " MANSECT" 3 |
772 |
trim "${line#MANSECT}" |
773 |
if [ -z "$MANSECT" ]; then MANSECT="$tstr"; fi |
774 |
;; |
790 |
# Set variables in the form of FOO_BAR |
775 |
# Set variables in the form of FOO_BAR |
791 |
*_*[\ \ ]*) var="${line%%[\ \ ]*}" |
776 |
*_*[\ \ ]*) var="${line%%[\ \ ]*}" |
792 |
trim "${line#$var}" |
777 |
trim "${line#$var}" |
Lines 1008-1019
Link Here
|
1008 |
} |
993 |
} |
1009 |
|
994 |
|
1010 |
do_man() { |
995 |
do_man() { |
1011 |
man_parse_args "$@" |
996 |
man_parse_opts "$@" |
|
|
997 |
shift $(( $OPTIND - 1 )) |
998 |
|
999 |
man_setup |
1000 |
|
1001 |
if [ -z "$MANSECT" ]; then |
1002 |
MANSECT=$man_default_sections |
1003 |
fi |
1004 |
|
1005 |
decho "Using manual sections: $MANSECT" |
1006 |
|
1007 |
IFS=: |
1008 |
for sect in $MANSECT; do |
1009 |
if [ "$sect" = "$1" ]; then |
1010 |
decho "Detected manual section as first arg: $1" |
1011 |
MANSECT="$1" |
1012 |
shift |
1013 |
break |
1014 |
fi |
1015 |
done |
1016 |
unset IFS |
1017 |
|
1018 |
pages="$*" |
1019 |
|
1012 |
if [ -z "$pages" -a -z "${Kflag}" ]; then |
1020 |
if [ -z "$pages" -a -z "${Kflag}" ]; then |
1013 |
echo 'What manual page do you want?' >&2 |
1021 |
echo 'What manual page do you want?' >&2 |
1014 |
exit 1 |
1022 |
exit 1 |
1015 |
fi |
1023 |
fi |
1016 |
man_setup |
|
|
1017 |
|
1024 |
|
1018 |
if [ ! -z "${Kflag}" ]; then |
1025 |
if [ ! -z "${Kflag}" ]; then |
1019 |
# Short circuit because -K flag does a sufficiently |
1026 |
# Short circuit because -K flag does a sufficiently |