diff options
author | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-02-12 20:11:01 +0800 |
---|---|---|
committer | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-02-12 20:11:01 +0800 |
commit | 0c2af16a2d261a1331edd8a529776ef1dd5e202c (patch) | |
tree | 2ebef84647c14a30d8087132bc1a8e1ee5e49cc9 | |
parent | 151751149b28f439cade47a22042be91781019d2 (diff) | |
download | pttbbs-0c2af16a2d261a1331edd8a529776ef1dd5e202c.tar pttbbs-0c2af16a2d261a1331edd8a529776ef1dd5e202c.tar.gz pttbbs-0c2af16a2d261a1331edd8a529776ef1dd5e202c.tar.bz2 pttbbs-0c2af16a2d261a1331edd8a529776ef1dd5e202c.tar.lz pttbbs-0c2af16a2d261a1331edd8a529776ef1dd5e202c.tar.xz pttbbs-0c2af16a2d261a1331edd8a529776ef1dd5e202c.tar.zst pttbbs-0c2af16a2d261a1331edd8a529776ef1dd5e202c.zip |
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
-rw-r--r-- | mbbsd/gomo.c | 20 |
1 files changed, 18 insertions, 2 deletions
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*/ |