diff options
-rw-r--r-- | pttbbs/include/proto.h | 1 | ||||
-rw-r--r-- | pttbbs/mbbsd/edit.c | 1 | ||||
-rw-r--r-- | pttbbs/mbbsd/kaede.c | 22 |
3 files changed, 24 insertions, 0 deletions
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h index 472008d4..c3ae6878 100644 --- a/pttbbs/include/proto.h +++ b/pttbbs/include/proto.h @@ -335,6 +335,7 @@ void out_lines(const char *str, int line, int col); #define HAVE_EXPAND_ESC_STAR int expand_esc_star(char *buf, const char *src, int szbuf); void strip_ansi_movecmd(char *s); +void strip_esc_star(char *s); /* lovepaper */ int x_love(void); diff --git a/pttbbs/mbbsd/edit.c b/pttbbs/mbbsd/edit.c index 76e96464..5b14d31e 100644 --- a/pttbbs/mbbsd/edit.c +++ b/pttbbs/mbbsd/edit.c @@ -1797,6 +1797,7 @@ browse_sigs: for (i = 0; i < MAX_SIGLINES && fgets(buf, sizeof(buf), fs); i++) { strip_ansi_movecmd(buf); + strip_esc_star(buf); fputs(buf, fp); } fclose(fs); diff --git a/pttbbs/mbbsd/kaede.c b/pttbbs/mbbsd/kaede.c index 446a5303..c692b282 100644 --- a/pttbbs/mbbsd/kaede.c +++ b/pttbbs/mbbsd/kaede.c @@ -54,6 +54,28 @@ strip_ansi_movecmd(char *s) { } } +void +strip_esc_star(char *s) { + int len; + while (*s) { + char *esc = strstr(s, ESC_STR "*"); + if (!esc) + return; + len = strlen(esc); + // 3: ESC * [a-z] + if (len < 3) { + *esc = 0; + return; + } + if (isalpha(esc[2])) { + memmove(esc, esc + 3, len - 3 + 1); + } else { + // Invalid esc_star. Remove esc instead. + memmove(esc, esc + 1, len - 1 + 1); + } + } +} + char * Ptt_prints(char *str, size_t size, int mode) { |