From e6843a795b4572ae7dbe75d60b04cea43dae9c48 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 10 Jun 2024 15:25:23 +0000 Subject: Make installManPage more robust against newlines. Backported from 8.7 --- unix/installManPage | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/unix/installManPage b/unix/installManPage index 1e29bb0..3d5fa7b 100755 --- a/unix/installManPage +++ b/unix/installManPage @@ -61,20 +61,35 @@ test -z "$Sym" && Loc="$Dir/" # Names=`sed -n ' # Look for a line that starts with .SH NAME - /^\.SH NAME/{ -# Read next line - n -# Remove all commas ... - s/,//g -# ... and backslash-escaped spaces. - s/\\\ //g -# Delete from \- to the end of line - s/ \\\-.*// -# Convert all non-space non-alphanum sequences -# to single underscores. - s/[^ A-Za-z0-9][^ A-Za-z0-9]*/_/g -# print the result and exit - p;q + /^\.SH NAME/,/^\./{ + + + /^\./!{ + + # Remove all commas... + s/,//g + + # ... and backslash-escaped spaces. + s/\\\ //g + + /\\\-.*/{ + # Delete from \- to the end of line + s/ \\\-.*// + h + s/.*/./ + x + } + + # Convert all non-space non-alphanum sequences + # to single underscores. + s/[^ A-Za-z0-9][^ A-Za-z0-9]*/_/g + p + g + /^\./{ + q + } + } + }' $ManPage` if test -z "$Names" ; then -- cgit v0.12