mirror of https://github.com/getdnsapi/getdns.git
Improve manpage processing robustness.
Fix regex to expressly check for starting ., and switch to regex match for SH lines to stop any potential problems with training spaces or multiple spaces before section name.
This commit is contained in:
parent
ea1111d899
commit
165078a50d
|
@ -567,15 +567,15 @@ foreach (man ${mans})
|
|||
# defined in that page. Defined means listed in a line ".B <name>"
|
||||
# between lines ".SH NAME" and ".SH LIBRARY". Ignore terminating ","
|
||||
# or spaces in .B line.
|
||||
file(STRINGS ${man} manpage REGEX "^.(SH|B) ")
|
||||
file(STRINGS ${man} manpage REGEX "^\\.(SH +NAME|SH +LIBRARY|B )")
|
||||
set(in_list 0)
|
||||
foreach (line ${manpage})
|
||||
if ("${line}" STREQUAL ".SH NAME")
|
||||
if ("${line}" MATCHES "^\\.SH +NAME")
|
||||
set(in_list 1)
|
||||
elseif ("${line}" STREQUAL ".SH LIBRARY")
|
||||
elseif ("${line}" MATCHES "^\\.SH +LIBRARY")
|
||||
set(in_list 0)
|
||||
elseif (${in_list})
|
||||
string(REGEX REPLACE ".B *([^ ,]+).*" "\\1" alt "${line}")
|
||||
string(REGEX REPLACE ".B +([^ ,]+).*" "\\1" alt "${line}")
|
||||
configure_file(${man} man3/${alt}.3 @ONLY)
|
||||
endif ()
|
||||
endforeach()
|
||||
|
|
Loading…
Reference in New Issue