summaryrefslogtreecommitdiff
path: root/src/roff/troff
diff options
context:
space:
mode:
authorwl <wl>2006-09-09 15:11:24 +0000
committerwl <wl>2006-09-09 15:11:24 +0000
commited71946c66941b03020437471c7f3cbcc35382db (patch)
tree3743940151d6244de901e9aea86d598aae38f00d /src/roff/troff
parentd24668785067388288a9a1ce61c814bacc54e7f5 (diff)
downloadgroff-ed71946c66941b03020437471c7f3cbcc35382db.tar.gz
* src/roff/troff/input.cpp (read_size): Fix `\s[-\n[.s]]' so that it
behave the same as `\s-[\n[.s]]' (this is, emit a warning and set point size to 1). Reported by Gunnar Ritter. Also catch `\s-[-...]' and friends (causing an error).
Diffstat (limited to 'src/roff/troff')
-rw-r--r--src/roff/troff/input.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 68239c59..2989f827 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -4902,9 +4902,19 @@ static int read_size(int *x)
else {
token start(tok);
tok.next();
- if (!(inc
- ? get_number(&val, 'z')
- : get_number(&val, 'z', curenv->get_requested_point_size())))
+ // catch `\s-[-...]' and friends
+ c = tok.ch();
+ if (c == '-' || c == '+') {
+ if (inc) {
+ error("two relative changes not allowed in \\s escape");
+ return 0;
+ }
+ else {
+ inc = c == '+' ? 1 : -1;
+ tok.next();
+ }
+ }
+ if (!get_number(&val, 'z'))
return 0;
if (!(start.ch() == '[' && tok.ch() == ']') && start != tok) {
if (start.ch() == '[')
@@ -4935,7 +4945,7 @@ static int read_size(int *x)
}
if (*x <= 0) {
warning(WARN_RANGE,
- "\\s request results in non-positive point size; set to 1");
+ "\\s escape results in non-positive point size; set to 1");
*x = 1;
}
return 1;