From f5649a5aed5a9fc3b31b7964087252525fca5e60 Mon Sep 17 00:00:00 2001 From: kcwu Date: Mon, 18 Jun 2007 17:14:32 +0000 Subject: * use strtok_r() instead of strtok(). fix bad strtok() usages. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3545 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/vote.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mbbsd/vote.c') diff --git a/mbbsd/vote.c b/mbbsd/vote.c index 5aa6fda6..917865e8 100644 --- a/mbbsd/vote.c +++ b/mbbsd/vote.c @@ -966,9 +966,11 @@ user_vote_one(vote_buffer_t *vbuf, const char *bname, int ind) count = 0; for (i = 0; i < ITEM_PER_PAGE && fgets(inbuf, sizeof(inbuf), cfp); i++) { + char *newline = strpbrk(inbuf, "\r\n"); + if (newline) *newline = '\0'; move((count % 15) + 5, (count / 15) * 40); prints("%c%s", chosen[curr_page * ITEM_PER_PAGE + i] ? '*' : ' ', - strtok(inbuf, "\n\0")); + inbuf); choices[count % ITEM_PER_PAGE] = inbuf[0]; count++; } -- cgit v1.2.3