diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2018-12-27 02:00:31 (EST) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2018-12-27 02:00:31 (EST) |
commit | 3aa9f6158e548f127ee8e4299f67c2275f7d693d (patch) | |
tree | 8e540f6cebf00b360b638fb3d64071fdab335a7b | |
parent | a04f90fbb307d45da443e5d58b7c116782852581 (diff) |
tools/shman.sh: Open/close tags file only once
Otherwise, only the symbols from the last input file would remain in the
file.
-rw-r--r-- | tools/shman.sh | 19 |
1 files changed, 8 insertions, 11 deletions
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 "${@}" |