diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-06-19 01:14:32 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-06-19 01:14:32 +0800 |
commit | f5649a5aed5a9fc3b31b7964087252525fca5e60 (patch) | |
tree | b9ed59307e2eda718c057f1aa0ce016619b44f1d /mbbsd/gamble.c | |
parent | 2edb2692f086fee13c46311bfcdab4eae847447c (diff) | |
download | pttbbs-f5649a5aed5a9fc3b31b7964087252525fca5e60.tar pttbbs-f5649a5aed5a9fc3b31b7964087252525fca5e60.tar.gz pttbbs-f5649a5aed5a9fc3b31b7964087252525fca5e60.tar.bz2 pttbbs-f5649a5aed5a9fc3b31b7964087252525fca5e60.tar.lz pttbbs-f5649a5aed5a9fc3b31b7964087252525fca5e60.tar.xz pttbbs-f5649a5aed5a9fc3b31b7964087252525fca5e60.tar.zst pttbbs-f5649a5aed5a9fc3b31b7964087252525fca5e60.zip |
* 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
Diffstat (limited to 'mbbsd/gamble.c')
-rw-r--r-- | mbbsd/gamble.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mbbsd/gamble.c b/mbbsd/gamble.c index 69c93d6d..79cb5be8 100644 --- a/mbbsd/gamble.c +++ b/mbbsd/gamble.c @@ -49,8 +49,10 @@ show_ticket_data(char betname[MAX_ITEM][MAX_ITEM_LEN],const char *direct, int *p } fgets(genbuf, MAX_ITEM_LEN, fp); *price = atoi(genbuf); - for (count = 0; fgets(betname[count], MAX_ITEM_LEN, fp) && count < MAX_ITEM; count++) - strtok(betname[count], "\r\n"); + for (count = 0; fgets(betname[count], MAX_ITEM_LEN, fp) && count < MAX_ITEM; count++) { + char *newline = strpbrk(betname[count], "\r\n"); + if (newline) *newline = '\0'; + } fclose(fp); prints(ANSI_COLOR(32) "站規:" ANSI_RESET " 1.可購買以下不同類型的彩票。每張要花 " ANSI_COLOR(32) "%d" ANSI_RESET " 元。\n" |