gbranden pushed a commit to branch master
in repository groff.
commit 3962a9ce789b6615773d5074260b9cef77baf3fb
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Oct 14 10:50:24 2024 -0500
[grops]: Fix erroneous line number in diagnostic.
* src/devices/grops/ps.cpp (ps_printer::special): Fix off-by-one error
in diagnostic message's line number report.
Line numbers do not appear to be generally off; I damaged the input file
in varying ways to see.
Exhibit:
$ cat -n minimal.grout | grep -C3 pdf:
115 H226000
116 V138474
117 H226000
118 x X pdf: pdfpic IMG_4025.pdf -L 160000z 120000z
119 n16158 0
120 x font 40 TI
121 f40
Before (going back to groff 1.22.4 at least):
$ /usr/bin/grops minimal.grout >/dev/null
/usr/bin/grops:minimal.grout:119: X command without 'ps:' tag ignored
Now:
$ ./build/grops minimal.grout >/dev/null
./build/grops:minimal.grout:118: error: X command without 'ps:' tag ignored
---
ChangeLog | 5 +++++
src/devices/grops/ps.cpp | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 2e210c821..37ad37e60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-10-14 G. Branden Robinson <[email protected]>
+
+ * src/devices/grops/ps.cpp (ps_printer::special): Fix off-by-one
+ error in diagnostic message's line number report.
+
2024-10-15 Deri James <[email protected]>
Work around debian's ImageMagick policy.
diff --git a/src/devices/grops/ps.cpp b/src/devices/grops/ps.cpp
index f553f0f61..053bb6045 100644
--- a/src/devices/grops/ps.cpp
+++ b/src/devices/grops/ps.cpp
@@ -1551,7 +1551,8 @@ void ps_printer::special(char *arg, const environment
*env, char type)
for (; *p != '\0' && *p != ':' && *p != ' ' && *p != '\n'; p++)
;
if (*p == '\0' || strncmp(tag, "ps", p - tag) != 0) {
- error("X command without 'ps:' tag ignored");
+ error_with_file_and_line(current_filename, (current_lineno - 1),
+ "X command without 'ps:' tag ignored");
return;
}
p++;
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit