aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2024-12-31 11:03:33 +0100
committerPřemysl Eric Janouch <p@janouch.name>2024-12-31 20:25:51 +0100
commitb01df19b80f72b6c8458d7cd04207c84ebbd72fc (patch)
treee75677f817c228933a6f2057b8caaa26b1c44881 /tools
parent09e635cf97a1cc84d2d3110d7a5e2d9d45f37e32 (diff)
downloadliberty-b01df19b80f72b6c8458d7cd04207c84ebbd72fc.tar.gz
liberty-b01df19b80f72b6c8458d7cd04207c84ebbd72fc.tar.xz
liberty-b01df19b80f72b6c8458d7cd04207c84ebbd72fc.zip
asciiman: have fewer "unexpected EOF" situations
Easily caused by the new help2adoc.
Diffstat (limited to 'tools')
-rw-r--r--tools/asciiman.awk18
1 files changed, 11 insertions, 7 deletions
diff --git a/tools/asciiman.awk b/tools/asciiman.awk
index 7483aa4..3201849 100644
--- a/tools/asciiman.awk
+++ b/tools/asciiman.awk
@@ -200,7 +200,7 @@ function inline(line) {
}
# Returns 1 iff the left-over $0 should be processed further.
-function process(firstline, posattrs, namedattrs) {
+function process(firstline, posattrs, namedattrs, ok) {
if (readattribute(firstline))
return 0
if (getline <= 0) {
@@ -281,9 +281,11 @@ function process(firstline, posattrs, namedattrs) {
while ($0) {
sub(/^[[:space:]]+/, "")
sub(/^[+]$/, "")
- if (!process($0) && getline <= 0)
- fatal("unexpected EOF")
- if (match($0, /^[[:space:]]*[*][[:space:]]+/))
+ if (!process($0) && (ok = getline) <= 0) {
+ if (ok < 0)
+ fatal("getline failed")
+ $0 = ""
+ } else if (match($0, /^[[:space:]]*[*][[:space:]]+/))
break
}
print ".RE"
@@ -318,9 +320,11 @@ function process(firstline, posattrs, namedattrs) {
while ($0) {
sub(/^[[:space:]]+/, "")
sub(/^[+]$/, "")
- if (!process($0) && getline <= 0)
- fatal("unexpected EOF")
- if (match($0, /::$/))
+ if (!process($0) && (ok = getline) <= 0) {
+ if (ok < 0)
+ fatal("getline failed")
+ $0 = ""
+ } else if (match($0, /::$/))
break
}
print ".RE"