summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/proto.h14
-rw-r--r--mbbsd/edit.c5
-rw-r--r--mbbsd/gamble.c11
-rw-r--r--mbbsd/guess.c14
-rw-r--r--mbbsd/user.c4
5 files changed, 27 insertions, 21 deletions
diff --git a/include/proto.h b/include/proto.h
index 1c72178c..a340a943 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -1,7 +1,13 @@
-/* $Id: proto.h,v 1.30 2002/11/06 16:25:14 in2 Exp $ */
+/* $Id: proto.h,v 1.31 2002/12/26 09:46:03 kcwu Exp $ */
#ifndef INCLUDE_PROTO_H
#define INCLUDE_PROTO_H
+#ifdef __GNUC__
+#define GCC_CHECK_FORMAT(a,b) __attribute__ ((format (printf, a, b)))
+#else
+#define GCC_CHECK_FORMAT(a,b)
+#endif
+
/* admin */
int m_mod_board(char *bname);
int m_newbrd(int recover);
@@ -23,7 +29,7 @@ void gem(char* maintitle, item_t* path, int update);
/* args */
void initsetproctitle(int argc, char **argv, char **envp);
-void setproctitle(const char* format, ...);
+void setproctitle(const char* format, ...) GCC_CHECK_FORMAT(1,2);
/* bbcall */
int main_bbcall();
@@ -348,7 +354,7 @@ void UnTagger (int locus);
int substitute_record(char *fpath, void *rptr, int size, int id);
int lock_substitute_record(char *fpath, void *rptr, int size, int id, int);
int get_record(char *fpath, void *rptr, int size, int id);
-void prints(char *fmt, ...);
+void prints(char *fmt, ...) GCC_CHECK_FORMAT(1,2);
int append_record(char *fpath, fileheader_t *record, int size);
int stampfile(char *fpath, fileheader_t *fh);
void stampdir(char *fpath, fileheader_t *fh);
@@ -400,7 +406,7 @@ time_t gettime(int line, time_t dt);
void setcalfile(char *buf, char *userid);
void stand_title(char *title);
void pressanykey();
-int vmsg (const char *fmt,...);
+int vmsg (const char *fmt,...) GCC_CHECK_FORMAT(1,2);
void trim(char *buf);
void bell();
void setbpath(char *buf, char *boardname);
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index 0d77f9a8..1107a6f1 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -1,4 +1,4 @@
-/* $Id: edit.c,v 1.22 2002/11/23 04:15:30 ptt Exp $ */
+/* $Id: edit.c,v 1.23 2002/12/26 09:46:04 kcwu Exp $ */
#include "bbs.h"
typedef struct textline_t {
struct textline_t *prev;
@@ -1575,7 +1575,7 @@ int
vedit(char *fpath, int saveheader, int *islocal)
{
FILE *fp1;
- char last = 0, buf[200]; /* the last key you press */
+ char last = 0; /* the last key you press */
int ch, foo;
int lastindent = -1;
int last_margin;
@@ -1649,6 +1649,7 @@ vedit(char *fpath, int saveheader, int *islocal)
}
/* 連續240個interval一樣 , 分明是在斂財
if (count >= 240) {
+ char buf[200];
snprintf(buf, sizeof(buf), "\033[1;33;46m%s\033[37m在\033[37;45m%s"
"\033[37m板違法賺錢 , %s\033[m", cuser.userid,
currboard, ctime(&now));
diff --git a/mbbsd/gamble.c b/mbbsd/gamble.c
index 836dbc25..8ade3999 100644
--- a/mbbsd/gamble.c
+++ b/mbbsd/gamble.c
@@ -1,4 +1,4 @@
-/* $Id: gamble.c,v 1.28 2002/07/22 19:02:00 in2 Exp $ */
+/* $Id: gamble.c,v 1.29 2002/12/26 09:46:04 kcwu Exp $ */
#include "bbs.h"
#ifndef _BBS_UTIL_C_
@@ -113,12 +113,11 @@ show_ticket_data(char *direct, int *price, boardheader_t * bh)
prints("\033[32m站規:\033[m 1.可購買以下不同類型的彩票。每張要花 \033[32m%d\033[m 元。\n"
" 2.%s\n"
- " 3.開獎時只有一種彩票中獎, 有購買該彩票者, 則可依購買的張數均分"
- "總賭金。\n"
- " 4.每筆獎金由系統抽取 5% 之稅金%s。\n\n"
+ " 3.開獎時只有一種彩票中獎, 有購買該彩票者, 則可依購買的張數均分總賭金。\n"
+ " 4.每筆獎金由系統抽取 5%% 之稅金%s。\n\n"
"\033[32m%s:\033[m", *price,
- bh ? "此賭盤由板主負責舉辦並且決定開獎時間結果, 站長不管, 願賭服輸。" :
- "系統每天 2:00 11:00 16:00 21:00 開獎。",
+ bh ? "此賭盤由板主負責舉辦並且決定開獎時間結果, 站長不管, 願賭服輸。" :
+ "系統每天 2:00 11:00 16:00 21:00 開獎。",
bh ? ", 其中 2% 分給開獎板主" : "",
bh ? "板主自訂規則及說明" : "前幾次開獎結果");
diff --git a/mbbsd/guess.c b/mbbsd/guess.c
index 0d655108..bd32450c 100644
--- a/mbbsd/guess.c
+++ b/mbbsd/guess.c
@@ -1,4 +1,4 @@
-/* $Id: guess.c,v 1.6 2002/07/22 19:02:00 in2 Exp $ */
+/* $Id: guess.c,v 1.7 2002/12/26 09:46:04 kcwu Exp $ */
#include "bbs.h"
#define LOGPASS BBSHOME "/etc/winguess.log"
@@ -246,7 +246,7 @@ guess_main()
Diff_Random(answer);
move(2, 0);
clrtoeol();
- prints("您下注 :%d Ptt$", money);
+ prints("您下注 :%lu Ptt$", money);
getdata_str(4, 0, "您要和電腦比賽嗎? <y/n>[y]:",
ifcomputer, sizeof(ifcomputer), LCECHO, "y");
@@ -292,7 +292,7 @@ guess_main()
if (count > c_count) {
prints("你輸給電腦了");
move(18, 35);
- prints("你賠了 %d ", money);
+ prints("你賠了 %lu ", money);
if ((file = fopen(LOGPASS, "a"))) {
fprintf(file, "電腦第%d次猜中, ", c_count);
if (youwin)
@@ -308,7 +308,7 @@ guess_main()
} else if (count < c_count) {
prints("真厲害, 讓你賺到囉");
move(18, 35);
- prints("你賺走了 %d ", money * 2);
+ prints("你賺走了 %lu ", money * 2);
demoney(money * 2);
if ((file = fopen(LOGPASS, "a"))) {
fprintf(file, "id: %s, 第%d次猜中, 電腦第%d次猜中, "
@@ -320,7 +320,7 @@ guess_main()
pressanykey();
return 1;
} else {
- prints("真厲害, 和電腦打成平手了, 拿回本錢%d\n", money);
+ prints("真厲害, 和電腦打成平手了, 拿回本錢%lu\n", money);
demoney(money);
if ((file = fopen(LOGPASS, "a"))) {
fprintf(file, "id: %s 和電腦打成了平手\n", cuser.userid);
@@ -351,9 +351,9 @@ guess_main()
prints("五次猜出來, 還你本錢吧");
move(18, 35);
clrtoeol();
- prints("你拿回了%d Ptt$\n", money);
+ prints("你拿回了%lu Ptt$\n", money);
if ((file = fopen(LOGPASS, "a"))) {
- fprintf(file, "id: %s, 第%d次猜中, 拿回了本錢 %ld Ptt$\n",
+ fprintf(file, "id: %s, 第%d次猜中, 拿回了本錢 %lu Ptt$\n",
cuser.userid, count, money);
fclose(file);
}
diff --git a/mbbsd/user.c b/mbbsd/user.c
index d3501822..5de29e36 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -1,4 +1,4 @@
-/* $Id: user.c,v 1.42 2002/12/14 08:02:18 in2 Exp $ */
+/* $Id: user.c,v 1.43 2002/12/26 09:46:04 kcwu Exp $ */
#include "bbs.h"
static char *sex[8] = {
@@ -55,7 +55,7 @@ user_display(userec_t * u, int real)
" 居住住址: %s\n"
" 電子信箱: %s\n"
" 性 別: %s\n"
- " 銀行帳戶: %ld 銀兩\n",
+ " 銀行帳戶: %d 銀兩\n",
u->userid, u->username, u->realname, u->address, u->email,
sex[u->sex % 8], u->money);