summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--util/Makefile2
-rw-r--r--util/gamblegive.c29
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;
+}