1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-18 02:19:39 +00:00
freebsd/usr.bin/man
Kyle Evans 0760a2e9a4 man: reset OPTIND before parsing args
From jilles: POSIX requires that a script set `OPTIND=1` before using
different sets of parameters with `getopts`, or the results will be
unspecified.

The specific problem observed here is that we would execute `man -f` or
`man -k` without cleaning up state from man_parse_args()' `getopts`
loop.  FreeBSD's /bin/sh seems to reset OPTIND to 1 after we hit the
second getopts loop, rendering the following shift harmless; other
/bin/sh implementations will leave it at what we came into the loop at
(e.g., bash as /bin/sh), shifting off any keywords that we had.

Input from:	jilles
Reviewed by:	allanjude, bapt, imp
Sponsored by:	Klara, Inc.

(cherry picked from commit f555b39e6b)
2021-10-03 00:14:43 -05:00
..
Makefile
Makefile.depend
man.1 man(1): Bump .Dd 2021-01-09 18:22:08 +01:00
man.conf.5
man.sh man: reset OPTIND before parsing args 2021-10-03 00:14:43 -05:00
manpath.1