diff options
author | wl <wl> | 2006-09-09 15:11:24 +0000 |
---|---|---|
committer | wl <wl> | 2006-09-09 15:11:24 +0000 |
commit | ed71946c66941b03020437471c7f3cbcc35382db (patch) | |
tree | 3743940151d6244de901e9aea86d598aae38f00d /src/roff/troff/input.cpp | |
parent | d24668785067388288a9a1ce61c814bacc54e7f5 (diff) | |
download | groff-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/input.cpp')
-rw-r--r-- | src/roff/troff/input.cpp | 18 |
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; |