summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2014-02-08 01:10:34 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2014-02-08 01:10:34 +0800
commita2c012a69a8492b791134a2958bd33f0cd6e04b1 (patch)
tree4e6a7521bbb01b84aa1bf8f9c51925b45c3e97e2
parent65d41b33aced6988791d2d9a87f305beecf0d3da (diff)
downloadpttbbs-a2c012a69a8492b791134a2958bd33f0cd6e04b1.tar
pttbbs-a2c012a69a8492b791134a2958bd33f0cd6e04b1.tar.gz
pttbbs-a2c012a69a8492b791134a2958bd33f0cd6e04b1.tar.bz2
pttbbs-a2c012a69a8492b791134a2958bd33f0cd6e04b1.tar.lz
pttbbs-a2c012a69a8492b791134a2958bd33f0cd6e04b1.tar.xz
pttbbs-a2c012a69a8492b791134a2958bd33f0cd6e04b1.tar.zst
pttbbs-a2c012a69a8492b791134a2958bd33f0cd6e04b1.zip
Strip ANSI codes from text when doing mask_content.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5919 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/mbbsd/bbs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c
index 2067eae0..ddafd574 100644
--- a/pttbbs/mbbsd/bbs.c
+++ b/pttbbs/mbbsd/bbs.c
@@ -4358,7 +4358,7 @@ mask_post_content(int ent, fileheader_t * fhdr, const char *direct) {
#else
char pattern[STRLEN];
char reason[15];
- char buf[ANSILINELEN];
+ char buf[ANSILINELEN], buf2[ANSILINELEN];
char fpath[PATHLEN], revpath[PATHLEN];
char ans[3];
FILE *fp, *fpw;
@@ -4393,6 +4393,7 @@ mask_post_content(int ent, fileheader_t * fhdr, const char *direct) {
mvouts(3, 0, ANSI_COLOR(1;31) "將刪除下列文字:" ANSI_RESET "\n");
i = 4;
while (fgets(buf, sizeof(buf), fp)) {
+ strip_ansi(buf, buf, STRIP_ALL);
if (strstr(buf, pattern)) {
found++;
mvouts(i, 0, ANSI_RESET);
@@ -4434,7 +4435,8 @@ mask_post_content(int ent, fileheader_t * fhdr, const char *direct) {
fp = fopen(revpath, "rt");
fpw = fopen(fpath, "wt");
while (fgets(buf, sizeof(buf), fp)) {
- if (strstr(buf, pattern)) {
+ strip_ansi(buf2, buf, STRIP_ALL);
+ if (strstr(buf2, pattern)) {
fputs("※ [部份違規文字已刪除]\n", fpw);
continue;
}