man: support special characters in filenames

man.sh needs to handle double quotes and sub shell character
as '`' '$' etc.

PR:		275967
Reviewed by:	bapt

MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D43453
This commit is contained in:
Wolfram Schneider 2024-01-25 07:14:06 +00:00
parent fbd156d78f
commit b8a484ec34

View file

@ -349,7 +349,7 @@ man_display_page() {
decho "Command: $cattool \"$catpage\" | $MANPAGER" decho "Command: $cattool \"$catpage\" | $MANPAGER"
ret=0 ret=0
else else
eval "$cattool \"$catpage\" | $MANPAGER" $cattool "$catpage" | $MANPAGER
ret=$? ret=$?
fi fi
fi fi
@ -374,7 +374,7 @@ man_display_page() {
pipeline="mandoc $mandoc_args | $MANPAGER" pipeline="mandoc $mandoc_args | $MANPAGER"
fi fi
if ! eval "$cattool \"$manpage\" | $testline" ;then if ! $cattool "$manpage" | eval "$testline"; then
if which -s groff; then if which -s groff; then
man_display_page_groff man_display_page_groff
else else
@ -387,10 +387,10 @@ man_display_page() {
fi fi
if [ $debug -gt 0 ]; then if [ $debug -gt 0 ]; then
decho "Command: $cattool \"$manpage\" | $pipeline" decho "Command: $cattool \"$manpage\" | eval \"$pipeline\""
ret=0 ret=0
else else
eval "$cattool \"$manpage\" | $pipeline" $cattool "$manpage" | eval "$pipeline"
ret=$? ret=$?
fi fi
} }
@ -480,10 +480,10 @@ man_display_page_groff() {
fi fi
if [ $debug -gt 0 ]; then if [ $debug -gt 0 ]; then
decho "Command: $cattool \"$manpage\" | $pipeline" decho "Command: $cattool \"$manpage\" | eval \"$pipeline\""
ret=0 ret=0
else else
eval "$cattool \"$manpage\" | $pipeline" $cattool "$manpage" | eval "$pipeline"
ret=$? ret=$?
fi fi
} }