You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
man2html/SOURCES/man2html-double-quotes.patch

33 lines
1.0 KiB

Properly decode double quotes inside the quoted text (closes: #406098).
diff -ruN -x '*.rej' -x '*.orig' man-1.6e-old/man2html/man2html.c man-1.6e/man2html/man2html.c
--- man-1.6e-old/man2html/man2html.c 2007-04-20 10:55:11.000000000 +0200
+++ man-1.6e/man2html/man2html.c 2007-04-20 11:03:54.000000000 +0200
@@ -1307,7 +1307,7 @@
*/
static char *
fill_words(char *str, char *words[], int maxn, int *n, char eow) {
- char *s = str;
+ char *s = str, *t;
int backslash = 0;
int skipspace = 0; /* 1 if space is not end-of-word */
@@ -1316,8 +1316,15 @@
while (*s && (*s != '\n' || backslash)) {
if (!backslash) {
if (*s == '"') {
- *s = '\a';
- skipspace = !skipspace;
+ if (skipspace && *(s+1) == '"') {
+ /* "" inside the quoted text means " */
+ for (t = s++; t > words[*n]; t--)
+ *t = *(t-1);
+ words[*n]++;
+ } else {
+ *s = '\a';
+ skipspace = !skipspace;
+ }
} else if (*s == escapesym) {
backslash = 1;
} else if ((*s == ' ' || *s == '\t') && !skipspace) {