It’s implementation-defined whether \+ behaves like literal + or like
\{1,\}. (The same applies to \? and \|; I didn’t find uses of those.)
As it happens, OpenBSD treats it as literal +.
Found it through a failure of html-device-smoke-test.sh.
Link:
https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/basedefs/V1_chap09.html#tag_09_03_02
---
m4/groff.m4 | 8 ++++----
makevarescape.sed | 2 +-
src/libs/libgroff/make-uniuni | 2 +-
src/roff/groff/tests/html-device-smoke-test.sh | 4 ++--
src/utils/afmtodit/make-afmtodit-tables | 2 +-
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/m4/groff.m4 b/m4/groff.m4
index 142820737..b79363b8d 100644
--- a/m4/groff.m4
+++ b/m4/groff.m4
@@ -942,7 +942,7 @@ AC_DEFUN([GROFF_PAGE], [
papersize=/etc/papersize
if test -z "$PAGE" && test -r "$papersize"
then
- sedexpr='s/#.*//;s/[ \t]\+/ /;s/ \+$//;s/^ \+//;/^$/d;p'
+ sedexpr='s/#.*//;s/[ \t]\{1,\}/ /;s/ *$//;s/^ *//;/^$/d;p'
PAGE=`sed -n "$sedexpr" "$papersize"`
test -n "$PAGE" && whence=$papersize
fi
@@ -969,10 +969,10 @@ AC_DEFUN([GROFF_PAGE], [
if test -n "$descfile"
then
- if grep -q ['^paperlength[ ]\+841890'] "$descfile"
+ if grep -q ['^paperlength[ ]\{1,\}841890'] "$descfile"
then
PAGE=A4
- elif grep -q ['^papersize[ ]\+[aA]4'] "$descfile"
+ elif grep -q ['^papersize[ ]\{1,\}[aA]4'] "$descfile"
then
PAGE=A4
fi
@@ -986,7 +986,7 @@ AC_DEFUN([GROFF_PAGE], [
domains=
if test -r "$resolvconf"
then
- sedexpr='s/#.*//;s/[ \t]\+/ /;s/ \+$//;s/^ \+//;/^$/d;
+ sedexpr='s/#.*//;s/[ \t]\{1,\}/ /;s/ *$//;s/^ *//;/^$/d;
/^\(domain\|search\)/!d;s/\(domain\|search\) //;p'
domains=`sed -n "$sedexpr" "$resolvconf"`
fi
diff --git a/makevarescape.sed b/makevarescape.sed
index 2baa50c2d..a81f29a88 100644
--- a/makevarescape.sed
+++ b/makevarescape.sed
@@ -6,4 +6,4 @@ s/-/\\\\&/g
s/\^/\\\\[ha]/g
s/`/\\\\[ga]/g
s/~/\\\\[ti]/g
-s|[^ ]/\+|&\\\\:\\\\%|g
+s|[^ ]//*|&\\\\:\\\\%|g
diff --git a/src/libs/libgroff/make-uniuni b/src/libs/libgroff/make-uniuni
index 8d12d6104..c14ca170e 100755
--- a/src/libs/libgroff/make-uniuni
+++ b/src/libs/libgroff/make-uniuni
@@ -60,7 +60,7 @@ cat $$1 \
cat $$3 \
| sed -e '/#/d' \
-e '/^$/d' \
- -e 's/ \+/ /g' \
+ -e 's/ */ /g' \
-e 's/ *$//' \
-e 's/u//g' \
-e 's/^\([^ ]*\) /\1;/' > $$4
diff --git a/src/roff/groff/tests/html-device-smoke-test.sh
b/src/roff/groff/tests/html-device-smoke-test.sh
index cecafbe3a..8d2aad7fd 100755
--- a/src/roff/groff/tests/html-device-smoke-test.sh
+++ b/src/roff/groff/tests/html-device-smoke-test.sh
@@ -55,7 +55,7 @@ foobar
echo "checking production of inline image for tbl(1) table" >&2
output=$(echo "$input" | "$groff" -t -Thtml)
-echo "$output" | grep -q '<img src="grohtml-[0-9]\+-1.png"' || wail
+echo "$output" | grep -q '<img src="grohtml-[0-9]\{1,\}-1.png"' || wail
input='.EQ
x sup 2 + y sup 2 = z sup 2
@@ -63,7 +63,7 @@ x sup 2 + y sup 2 = z sup 2
echo "checking production of inline image for eqn(1) equation" >&2
output=$(echo "$input" | "$groff" -e -Thtml)
-echo "$output" | grep -q '<img src="grohtml-[0-9]\+-2.png"' || wail
+echo "$output" | grep -q '<img src="grohtml-[0-9]\{1,\}-2.png"' || wail
cleanup
diff --git a/src/utils/afmtodit/make-afmtodit-tables
b/src/utils/afmtodit/make-afmtodit-tables
index 38ab83c7e..6158f6726 100755
--- a/src/utils/afmtodit/make-afmtodit-tables
+++ b/src/utils/afmtodit/make-afmtodit-tables
@@ -74,7 +74,7 @@ cat $$1 \
cat $$3 \
| sed -e '/#/d' \
-e '/^$/d' \
- -e 's/ \+/ /g' \
+ -e 's/ */ /g' \
-e 's/ *$//' \
-e 's/u//g' \
-e 's/^\([^ ]*\) /\1;/' > $$4
--
2.48.1