summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-09-14 07:59:15 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-09-14 07:59:15 -0700
commit750cc25f32f27eacc90177fbacd064bac05ac4d9 (patch)
tree6d86c46421726d6acc9449bd64117fffdc2be308
parentddf03b6151931ec010d247443df9f86663431afe (diff)
downloadman-750cc25f32f27eacc90177fbacd064bac05ac4d9.tar.gz
man-750cc25f32f27eacc90177fbacd064bac05ac4d9.tar.bz2
man-750cc25f32f27eacc90177fbacd064bac05ac4d9.zip
Fix broken one-letter commands.
In this idiotic program, one-letter commands like .B arg or .B are blindly encoded as a two byte code and so they have two codes, based on whether the name is followed by a space or newline. We must preserve this behavior in the str_to_code function, or else fix numerous places.
-rw-r--r--man2html/man2html.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/man2html/man2html.c b/man2html/man2html.c
index 98f7993..ca014c0 100644
--- a/man2html/man2html.c
+++ b/man2html/man2html.c
@@ -105,11 +105,19 @@ expand_string(int nr)
static int str_to_code(char *str)
{
- int code = 0;
+ int code = 0, count = 0;
+
while (*str && !isspace(*str)) {
code *= 256;
code += *str++;
+ count++;
}
+
+ if (count == 1) {
+ code *= 256;
+ code += ' ';
+ }
+
return code;
}