apply patches

This commit is contained in:
openKylinBot 2022-05-16 15:10:15 +08:00
commit b2b0ef2f26
3 changed files with 12 additions and 1 deletions

View File

@ -8,4 +8,4 @@ man_MANS = textwrap.3 dotextwrap.1
bin_PROGRAMS = dotextwrap
dotextwrap_SOURCES = dotextwrap.c
dotextwrap_LDADD = -ltextwrap
dotextwrap_LDADD = libtextwrap.la

View File

@ -78,6 +78,9 @@ proper number of space code (0x20) by \fBtextwrap\fR.
.SH RETURN VALUE
\fBtextwrap()\fR returns the line-folded text.
You can free(3) the given value.
In case of any error while processing the string, the text <ERR> will be
appended to the output and processing will be aborted.
.\" ********************************************************************
.SH EXAMPLE
.nf

View File

@ -300,6 +300,14 @@ textwrap(const textwrap_t *prop, const char *text)
now = p; /* current character */
ml = mblen(p, MB_CUR_MAX);
if (ml<0) {
/*
* stringt_addstr will take care about enough
* memory for out
*/
stringt_addstr(out, " <ERR>");
return stringt_destroy_extract(out);
}
w = mbwidth(p, ml);
b = breakable(p, ml, encoding_type);
p += ml;