From 0c2af16a2d261a1331edd8a529776ef1dd5e202c Mon Sep 17 00:00:00 2001 From: scw Date: Sat, 12 Feb 2005 12:11:01 +0000 Subject: Strip escape sequences and spaces in country name when playing gomoku. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2502 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/gomo.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/gomo.c b/mbbsd/gomo.c index c313ed98..6f15293b 100644 --- a/mbbsd/gomo.c +++ b/mbbsd/gomo.c @@ -413,11 +413,19 @@ gomoku(int fd) strcpy(country, "µL"); level[0] = 0; } else { + int i, j; for (line = 1; line < 8; ++line) fgets(genbuf, 200, fp); + fgets(genbuf, 200, fp); chomp(genbuf); - strlcpy(country, genbuf + 11, 5); /* two chinese words */ + strip_ansi(genbuf + 11, genbuf + 11, + STRIP_ALL); /* country name may have color */ + for (i = 11, j = 0; genbuf[i] && j < 4; ++i) + if (genbuf[i] != ' ') /* and spaces */ + country[j++] = genbuf[i]; + country[j] = 0; /* two chinese words */ + fgets(genbuf, 200, fp); chomp(genbuf); strlcpy(level, genbuf + 11, 11); /* five chinese words*/ @@ -461,11 +469,19 @@ gomoku(int fd) strcpy(country, "µL"); level[0] = 0; } else { + int i, j; for (line = 1; line < 8; ++line) fgets(genbuf, 200, fp); + fgets(genbuf, 200, fp); chomp(genbuf); - strlcpy(country, genbuf + 11, 5); /* two chinese words */ + strip_ansi(genbuf + 11, genbuf + 11, + STRIP_ALL); /* country name may have color */ + for (i = 11, j = 0; genbuf[i] && j < 4; ++i) + if (genbuf[i] != ' ') /* and spaces */ + country[j++] = genbuf[i]; + country[j] = 0; /* two chinese words */ + fgets(genbuf, 200, fp); chomp(genbuf); strlcpy(level, genbuf + 11, 11); /* five chinese words*/ -- cgit v1.2.3