diff options
author | ptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-06-22 02:51:18 +0800 |
---|---|---|
committer | ptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-06-22 02:51:18 +0800 |
commit | 8851f4172fc5c7c0918b7f59f5ccebbbf9e97e51 (patch) | |
tree | 40c3eca83f8250485c3fcb0173d18fad4bca3d6f /util | |
parent | 53556444f0835990d703e290799af36609c90656 (diff) | |
download | pttbbs-8851f4172fc5c7c0918b7f59f5ccebbbf9e97e51.tar pttbbs-8851f4172fc5c7c0918b7f59f5ccebbbf9e97e51.tar.gz pttbbs-8851f4172fc5c7c0918b7f59f5ccebbbf9e97e51.tar.bz2 pttbbs-8851f4172fc5c7c0918b7f59f5ccebbbf9e97e51.tar.lz pttbbs-8851f4172fc5c7c0918b7f59f5ccebbbf9e97e51.tar.xz pttbbs-8851f4172fc5c7c0918b7f59f5ccebbbf9e97e51.tar.zst pttbbs-8851f4172fc5c7c0918b7f59f5ccebbbf9e97e51.zip |
A util to produce (G)ivemoney format file from gamble result
whis is used for fixing the controversial gamble.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2075 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util')
-rw-r--r-- | util/Makefile | 2 | ||||
-rw-r--r-- | util/gamblegive.c | 29 |
2 files changed, 30 insertions, 1 deletions
diff --git a/util/Makefile b/util/Makefile index d4d1def3..2fd805e3 100644 --- a/util/Makefile +++ b/util/Makefile @@ -23,7 +23,7 @@ CPROG_WITH_UTIL= \ indexuser yearsold toplazyBM toplazyBBM \ reaper buildAnnounce inndBM shmctl \ outmail chkhbf checkmoney merge_dir \ - transman angel + transman angel gamblegive # 下面這些程式, 會直接被 compile CPROG_WITHOUT_UTIL= \ diff --git a/util/gamblegive.c b/util/gamblegive.c new file mode 100644 index 00000000..8bc8d441 --- /dev/null +++ b/util/gamblegive.c @@ -0,0 +1,29 @@ +/* $Id: gamblegive.c 1096 2003-08-15 06:13:29Z Ptt $ */ +/* 爭議賭盤 產生紅包機格式 */ +#define _UTIL_C_ +#include "bbs.h" + +int main(int argc, char **argv) +{ + int money = 12, num; + char buf[512], *userid,*p; + FILE *fp; + + if(argc<3 || + !(num=atoi(argv[1])) || + !(fp = fopen (argv[2], "r")) ) + { + printf("%s <tickey-price> <result-file>", argv[0]); + return 0; + } + + while (fgets(buf,512,fp) ) + { + if(strncmp(buf, "恭喜", 4)) continue; + userid = strtok(buf+5," "); + p = strtok(NULL, " "); + num = atoi(p+4); + printf("%s:%d\n", userid, num*money); + } + return 0; +} |