From 3aa9f6158e548f127ee8e4299f67c2275f7d693d Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Thu, 27 Dec 2018 02:00:31 -0500 Subject: tools/shman.sh: Open/close tags file only once Otherwise, only the symbols from the last input file would remain in the file. --- (limited to 'tools') diff --git a/tools/shman.sh b/tools/shman.sh index 5b1a254..70d56c0 100644 --- a/tools/shman.sh +++ b/tools/shman.sh @@ -201,8 +201,7 @@ parse_docs() local source="${2}" local manual="${3}" local out_dir="${4}" - local tags="${5}" - shift 5 + shift 4 local date= local line= local doc='' @@ -211,10 +210,6 @@ parse_docs() date="$(get_mtime "${file}")" - if [ -n "${tags}" ]; then - exec 3>"${tags}" - fi - while IFS='' read -r line; do case "${line}" in '##'*) @@ -250,10 +245,6 @@ parse_docs() warn 'Undocumented function "%s"' "${line}" fi done <"${file}" - - if [ -n "${tags}" ]; then - exec 3>&- - fi } usage() @@ -328,9 +319,15 @@ main() exit 1 fi + if [ -n "${tags}" ]; then + exec 3>"${tags}" + fi for f in "${@}"; do - parse_docs "${f}" "${source}" "${manual}" "${out_dir}" "${tags}" + parse_docs "${f}" "${source}" "${manual}" "${out_dir}" done + if [ -n "${tags}" ]; then + exec 3>&- + fi } main "${@}" -- cgit v0.9.1