ref: 845bbd9aa28e33ce64d3c4d512c8cccb4d14c7df
parent: cefdee951aa523e79a2e3ac1f19cdfbb5080423c
author: Ali Gholami Rudi <ali@rudi.ir>
date: Wed Dec 31 19:15:35 EST 2014
hyph: replace current escape character to backslash
--- a/hyph.c
+++ b/hyph.c
@@ -8,6 +8,7 @@
#define HYPATLEN (NHYPHS * 16) /* hyphenation pattern length */
static void hcode_strcpy(char *d, char *s, int *map, int dots);
+static int hcode_mapchar(char *s);
/* the hyphenation dictionary (.hw) */
@@ -50,7 +51,7 @@
}
/* append character s to d; return the number of characters written */
-static int hy_cput(char *d, char *s)
+int hy_cput(char *d, char *s)
{
if (!s[0] || !s[1] || utf8one(s))
strcpy(d, s);
@@ -103,14 +104,15 @@
void tr_hw(char **args)
{
- char c[GNLEN];
+ char c[ILNLEN];
char word[WORDLEN];
int i;
for (i = 1; i < NARGS && args[i]; i++) {
char *s = args[i];
char *d = word;
- while (d - word < WORDLEN - GNLEN && s[0]) {
- s += hy_cget(c, s);
+ while (d - word < WORDLEN - GNLEN && !escread(&s, c)) {
+ if (strcmp("-", c))
+ hcode_mapchar(c);
d += hy_cput(d, c);
}
hw_add(word);
--- a/roff.h
+++ b/roff.h
@@ -288,6 +288,7 @@
#define HY_FIRST2 0x08 /* do not hyphenate the first two characters */
void hyphenate(char *hyphs, char *word, int flg);
+int hy_cput(char *d, char *s);
void hyph_init(void);
void hyph_done(void);
--- a/wb.c
+++ b/wb.c
@@ -176,8 +176,7 @@
return 1;
if (c_hymark(s))
continue;
- charnext_str(d, s);
- d = strchr(d, '\0');
+ d += hy_cput(d, s);
}
memset(hyph, 0, (d - word) * sizeof(hyph[0]));
hyphenate(hyph, word, flg);