summaryrefslogtreecommitdiffstats
path: root/contrib/groff/src/roff/grog
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/groff/src/roff/grog')
-rw-r--r--contrib/groff/src/roff/grog/Makefile.sub1
-rw-r--r--contrib/groff/src/roff/grog/grog.man8
-rw-r--r--contrib/groff/src/roff/grog/grog.pl27
-rw-r--r--contrib/groff/src/roff/grog/grog.sh23
4 files changed, 52 insertions, 7 deletions
diff --git a/contrib/groff/src/roff/grog/Makefile.sub b/contrib/groff/src/roff/grog/Makefile.sub
index 054d06e..85e2ad5 100644
--- a/contrib/groff/src/roff/grog/Makefile.sub
+++ b/contrib/groff/src/roff/grog/Makefile.sub
@@ -1,6 +1,5 @@
MAN1=grog.n
CLEANADD=grog
-NAMEPREFIX=$(g)
all: grog
diff --git a/contrib/groff/src/roff/grog/grog.man b/contrib/groff/src/roff/grog/grog.man
index 4a2d311..8cd0bb2 100644
--- a/contrib/groff/src/roff/grog/grog.man
+++ b/contrib/groff/src/roff/grog/grog.man
@@ -1,5 +1,5 @@
-.ig \"-*- nroff -*-
-Copyright (C) 1989-2000 Free Software Foundation, Inc.
+.ig
+Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -84,3 +84,7 @@ option.
.BR @g@grn (@MAN1EXT@),
.BR grap (1),
.BR @g@soelim (@MAN1EXT@)
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/roff/grog/grog.pl b/contrib/groff/src/roff/grog/grog.pl
index 57cd159..a61106c 100644
--- a/contrib/groff/src/roff/grog/grog.pl
+++ b/contrib/groff/src/roff/grog/grog.pl
@@ -113,9 +113,36 @@ sub process {
# closed by `Oc'.
elsif (/^\.Oo$sp/) {
$Oo++;
+ s/^\.Oo/\. /;
+ redo;
+ }
+ # The test for `Oo' and `Oc' not starting a line (as allowed by the
+ # new implementation of -mdoc) is not complete; it assumes that
+ # macro arguments are well behaved, i.e., "" is used within "..." to
+ # indicate a doublequote as a string element, and weird features
+ # like `.foo a"b' are not used.
+ elsif (/^\..* Oo( |$)/) {
+ s/\\\".*//;
+ s/\"[^\"]*\"//g;
+ s/\".*//;
+ if (s/ Oo( |$)/ /) {
+ $Oo++;
+ }
+ redo;
}
elsif (/^\.Oc$sp/) {
$Oo--;
+ s/^\.Oc/\. /;
+ redo;
+ }
+ elsif (/^\..* Oc( |$)/) {
+ s/\\\".*//;
+ s/\"[^\"]*\"//g;
+ s/\".*//;
+ if (s/ Oc( |$)/ /) {
+ $Oo--;
+ }
+ redo;
}
if (/^\.so$sp/) {
chop;
diff --git a/contrib/groff/src/roff/grog/grog.sh b/contrib/groff/src/roff/grog/grog.sh
index 7919dbf..ae269af 100644
--- a/contrib/groff/src/roff/grog/grog.sh
+++ b/contrib/groff/src/roff/grog/grog.sh
@@ -29,12 +29,12 @@ do
esac
done
-egrep -h "^\.(P|PS|[PLI]P|[pnil]p|sh|Dd|Tp|Dp|De|Cx|Cl|Oo|Oc|TS|EQ|TH|SH|so|\[|R1|GS|G1|PH|SA)$sp" $* \
+egrep -h "^\.(P|PS|[PLI]P|[pnil]p|sh|Dd|Tp|Dp|De|Cx|Cl|Oo|.* Oo|Oc|.* Oc|TS|EQ|TH|SH|so|\[|R1|GS|G1|PH|SA)$sp" $* \
| sed -e '/^\.so/s/^.*$/.SO_START\
&\
.SO_END/' \
| $soelim \
-| egrep '^\.(P|PS|[PLI]P|[pnil]p|sh|Dd|Tp|Dp|De|Cx|Cl|Oo|Oc|TS|EQ|TH|SH|\[|R1|GS|G1|PH|SA|SO_START|SO_END)' \
+| egrep '^\.(P|PS|[PLI]P|[pnil]p|sh|Dd|Tp|Dp|De|Cx|Cl|Oo|.* Oo|Oc|.* Oc|TS|EQ|TH|SH|\[|R1|GS|G1|PH|SA|SO_START|SO_END)' \
| awk '
/^\.SO_START$/ { so = 1 }
/^\.SO_END$/ { so = 0 }
@@ -52,8 +52,23 @@ egrep -h "^\.(P|PS|[PLI]P|[pnil]p|sh|Dd|Tp|Dp|De|Cx|Cl|Oo|Oc|TS|EQ|TH|SH|so|\[|R
/^\.([pnil]p|sh)/ { me++ }
/^\.Dd/ { mdoc++ }
/^\.(Tp|Dp|De|Cx|Cl)/ { mdoc_old++ }
-/^\.Oo/ { Oo++ }
-/^\.Oc/ { Oo-- }
+/^\.(O[oc]|.* O[oc]( |$))/ {
+ sub(/\\\".*/, "")
+ gsub(/\"[^\"]*\"/, "")
+ sub(/\".*/, "")
+ sub(/^\.Oo/, " Oo ")
+ sub(/^\.Oc/, " Oc ")
+ sub(/ Oo$/, " Oo ")
+ sub(/ Oc$/, " Oc ")
+ while (/ Oo /) {
+ sub(/ Oo /, " ")
+ Oo++
+ }
+ while (/ Oc /) {
+ sub(/ Oc /, " ")
+ Oo--
+ }
+}
END {
if (files ~ /^-/)
OpenPOWER on IntegriCloud