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 575-582
Link Here
|
575 |
esac |
575 |
esac |
576 |
done >&2 |
576 |
done >&2 |
577 |
|
577 |
|
578 |
shift $(( $OPTIND - 1 )) |
|
|
579 |
|
580 |
# Check the args for incompatible options. |
578 |
# Check the args for incompatible options. |
581 |
|
579 |
|
582 |
case "${Kflag}${fflag}${kflag}${tflag}${wflag}" in |
580 |
case "${Kflag}${fflag}${kflag}${tflag}${wflag}" in |
Lines 601-619
Link Here
|
601 |
do_apropos "$@" |
599 |
do_apropos "$@" |
602 |
exit |
600 |
exit |
603 |
fi |
601 |
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 |
} |
602 |
} |
618 |
|
603 |
|
619 |
# Usage: man_setup |
604 |
# Usage: man_setup |
Lines 634-645
Link Here
|
634 |
|
619 |
|
635 |
setup_pager |
620 |
setup_pager |
636 |
|
621 |
|
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 |
622 |
build_manpath |
644 |
man_setup_locale |
623 |
man_setup_locale |
645 |
man_setup_width |
624 |
man_setup_width |
Lines 787-792
Link Here
|
787 |
trim "${line#MANCONFIG}" |
766 |
trim "${line#MANCONFIG}" |
788 |
config_local="$tstr" |
767 |
config_local="$tstr" |
789 |
;; |
768 |
;; |
|
|
769 |
MANSECT*) decho " MANSECT" 3 |
770 |
trim "${line#MANSECT}" |
771 |
if [ -z "$MANSECT" ]; then MANSECT="$tstr"; fi |
772 |
;; |
790 |
# Set variables in the form of FOO_BAR |
773 |
# Set variables in the form of FOO_BAR |
791 |
*_*[\ \ ]*) var="${line%%[\ \ ]*}" |
774 |
*_*[\ \ ]*) var="${line%%[\ \ ]*}" |
792 |
trim "${line#$var}" |
775 |
trim "${line#$var}" |
Lines 1008-1019
Link Here
|
1008 |
} |
991 |
} |
1009 |
|
992 |
|
1010 |
do_man() { |
993 |
do_man() { |
1011 |
man_parse_args "$@" |
994 |
man_parse_opts "$@" |
|
|
995 |
shift $(( $OPTIND - 1 )) |
996 |
|
997 |
man_setup |
998 |
|
999 |
if [ -z "$MANSECT" ]; then |
1000 |
MANSECT=$man_default_sections |
1001 |
fi |
1002 |
|
1003 |
decho "Using manual sections: $MANSECT" |
1004 |
|
1005 |
IFS=: |
1006 |
for sect in $MANSECT; do |
1007 |
if [ "$sect" = "$1" ]; then |
1008 |
decho "Detected manual section as first arg: $1" |
1009 |
MANSECT="$1" |
1010 |
shift |
1011 |
break |
1012 |
fi |
1013 |
done |
1014 |
unset IFS |
1015 |
|
1016 |
pages="$*" |
1017 |
|
1012 |
if [ -z "$pages" -a -z "${Kflag}" ]; then |
1018 |
if [ -z "$pages" -a -z "${Kflag}" ]; then |
1013 |
echo 'What manual page do you want?' >&2 |
1019 |
echo 'What manual page do you want?' >&2 |
1014 |
exit 1 |
1020 |
exit 1 |
1015 |
fi |
1021 |
fi |
1016 |
man_setup |
|
|
1017 |
|
1022 |
|
1018 |
if [ ! -z "${Kflag}" ]; then |
1023 |
if [ ! -z "${Kflag}" ]; then |
1019 |
# Short circuit because -K flag does a sufficiently |
1024 |
# Short circuit because -K flag does a sufficiently |