summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-05-08 15:59:32 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-05-08 15:59:32 +0800
commit133c8925067a703dfef58607fd2ca636fa3b2922 (patch)
treedeb7f25fdecaaba2f7dc6c57023fb97a79325ca8
parentba4849655123ccf17feb52aea447a4b52a114928 (diff)
downloadpttbbs-133c8925067a703dfef58607fd2ca636fa3b2922.tar
pttbbs-133c8925067a703dfef58607fd2ca636fa3b2922.tar.gz
pttbbs-133c8925067a703dfef58607fd2ca636fa3b2922.tar.bz2
pttbbs-133c8925067a703dfef58607fd2ca636fa3b2922.tar.lz
pttbbs-133c8925067a703dfef58607fd2ca636fa3b2922.tar.xz
pttbbs-133c8925067a703dfef58607fd2ca636fa3b2922.tar.zst
pttbbs-133c8925067a703dfef58607fd2ca636fa3b2922.zip
- (internal) replace ctime4 by Cdate, prevent developer confused by the the trailing '\n'.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4278 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/angel.c5
-rw-r--r--mbbsd/bbs.c36
-rw-r--r--mbbsd/cal.c6
-rw-r--r--mbbsd/chicken.c12
-rw-r--r--mbbsd/edit.c2
-rw-r--r--mbbsd/more.c4
-rw-r--r--mbbsd/user.c10
-rw-r--r--mbbsd/vote.c14
-rw-r--r--mbbsd/voteboard.c6
9 files changed, 38 insertions, 57 deletions
diff --git a/mbbsd/angel.c b/mbbsd/angel.c
index f9c33617..fa53240f 100644
--- a/mbbsd/angel.c
+++ b/mbbsd/angel.c
@@ -136,9 +136,8 @@ t_changeangel(){
buf, 3, LCECHO);
if (buf[0] == 'y' || buf[0] == 'Y') {
char buf[100];
- snprintf(buf, sizeof(buf), "%s小主人 %s 換掉 %s 小天使\n",
- ctime4(&now), cuser.userid, cuser.myangel);
- buf[24] = ' '; // replace '\n'
+ snprintf(buf, sizeof(buf), "%s 小主人 %s 換掉 %s 小天使\n",
+ Cdatelite(&now), cuser.userid, cuser.myangel);
log_file(BBSHOME "/log/changeangel.log", LOG_CREAT, buf);
cuser.myangel[0] = 0;
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 8b7ba24e..7e6d3f3e 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -152,7 +152,7 @@ anticrosspost(void)
ANSI_COLOR(1;33;46) "%s "
ANSI_COLOR(37;45) "cross post 文章 "
ANSI_COLOR(37) " %s" ANSI_RESET "\n",
- cuser.userid, ctime4(&now));
+ cuser.userid, Cdatelite(&now));
post_violatelaw(cuser.userid, BBSMNAME "系統警察",
"Cross-post", "罰單處份");
cuser.userlevel |= PERM_VIOLATELAW;
@@ -221,8 +221,8 @@ save_violatelaw(void)
if (cuser.money < (int)cuser.vl_count * 1000)
{
log_filef("log/violation", LOG_CREAT,
- "%24.24s %s pay-violation error: race-conditionn hack?\n",
- ctime4(&now), cuser.userid);
+ "%s %s pay-violation error: race-conditionn hack?\n",
+ Cdate(&now), cuser.userid);
vmsg("錢怎麼忽然不夠了? 試圖欺騙系統被查到將砍帳號!");
return 0;
}
@@ -235,8 +235,8 @@ save_violatelaw(void)
passwd_update(usernum, &cuser);
sendalert(cuser.userid, ALERT_PWD_PERM);
log_filef("log/violation", LOG_CREAT,
- "%24.24s %s pay-violation: $%d complete.\n",
- ctime4(&now), cuser.userid, (int)cuser.vl_count*1000);
+ "%s %s pay-violation: $%d complete.\n",
+ Cdate(&now), cuser.userid, (int)cuser.vl_count*1000);
vmsg("罰單已付,請盡速重新登入。");
return 0;
@@ -1516,8 +1516,8 @@ edit_post(int ent, fileheader_t * fhdr, const char *direct)
// admin edit!
log_filef("log/security", LOG_CREAT,
- "%d %24.24s %d %s admin edit (board) file=%s\n",
- (int)now, ctime4(&now), getpid(), cuser.userid, fpath);
+ "%d %s %d %s admin edit (board) file=%s\n",
+ (int)now, Cdate(&now), getpid(), cuser.userid, fpath);
}
edflags = EDITFLAG_ALLOWTITLE;
@@ -2019,12 +2019,12 @@ read_post(int ent, fileheader_t * fhdr, const char *direct)
// kcwu: log crawler
static int read_count = 0;
extern Fnv32_t client_code;
- read_count++;
+ ++read_count;
if (read_count % 1000 == 0) {
time4_t t = time4(NULL);
log_filef("log/read_alot", LOG_CREAT,
- "%d %s %d %s %08x %d\n", t, ctime4(&t), getpid(),
+ "%d %s %d %s %08x %d\n", t, Cdate(&t), getpid(),
cuser.userid, client_code, read_count);
}
}
@@ -4013,9 +4013,6 @@ Read(void)
int mode0 = currutmp->mode;
int stat0 = currstat, tmpbid = currutmp->brc_id;
char buf[PATHLEN];
-#ifdef LOG_BOARD
- time4_t usetime = now;
-#endif
const char *bname = currboard[0] ? currboard : DEFAULT_BOARD;
if (enter_board(bname) < 0)
@@ -4038,9 +4035,6 @@ Read(void)
i_read(READING, currdirect, readtitle, readdoent, read_comms,
currbid);
currmode &= ~MODE_POSTCHECKED;
-#ifdef LOG_BOARD
- log_board(currboard, now - usetime);
-#endif
brc_update();
setutmpbid(tmpbid);
currutmp->mode = mode0;
@@ -4072,18 +4066,6 @@ ReadSelect(void)
return changed;
}
-#ifdef LOG_BOARD
-static void
-log_board(iconst char *mode, time4_t usetime)
-{
- if (usetime > 30) {
- log_file(FN_USEBOARD, LOG_CREAT | LOG_VF,
- "USE %-20.20s Stay: %5ld (%s) %s\n",
- mode, usetime, cuser.userid, ctime4(&now));
- }
-}
-#endif
-
int
Select(void)
{
diff --git a/mbbsd/cal.c b/mbbsd/cal.c
index 5e75e85d..4cacb91a 100644
--- a/mbbsd/cal.c
+++ b/mbbsd/cal.c
@@ -389,8 +389,8 @@ int do_give_money(char *id, int uid, int money)
// 實際給予金錢。
deumoney(uid, money - tax);
demoney(-money);
- log_filef(FN_MONEY, LOG_CREAT, "%-12s 給 %-12s %d\t(稅後 %d)\t%s",
- cuser.userid, id, money, money - tax, ctime4(&now));
+ log_filef(FN_MONEY, LOG_CREAT, "%-12s 給 %-12s %d\t(稅後 %d)\t%s\n",
+ cuser.userid, id, money, money - tax, Cdate(&now));
// penalty
if (money < 50) {
@@ -610,7 +610,7 @@ p_sysinfo(void)
#ifdef DETECT_CLIENT
client_code,
#endif
- compile_time, ctime4(&start_time));
+ compile_time, Cdatelite(&start_time));
#ifdef REPORT_PIAIP_MODULES
outs("\n" ANSI_COLOR(1;30)
diff --git a/mbbsd/chicken.c b/mbbsd/chicken.c
index d689d5f0..da6cfc90 100644
--- a/mbbsd/chicken.c
+++ b/mbbsd/chicken.c
@@ -254,7 +254,7 @@ new_chicken(void)
log_filef(CHICKENLOG, LOG_CREAT,
ANSI_COLOR(31) "%s " ANSI_RESET "養了一隻叫" ANSI_COLOR(33) " %s " ANSI_RESET "的 "
ANSI_COLOR(32) "%s" ANSI_RESET " 於 %s\n", cuser.userid,
- mychicken.name, chicken_type[(int)mychicken.type], ctime4(&now));
+ mychicken.name, chicken_type[(int)mychicken.type], Cdate(&now));
return 1;
}
@@ -530,7 +530,7 @@ ch_kill(chicken_t *mychicken)
log_filef(CHICKENLOG, LOG_CREAT,
ANSI_COLOR(31) "%s " ANSI_RESET "把 " ANSI_COLOR(33) "%s" ANSI_RESET ANSI_COLOR(32) " %s "
ANSI_RESET "宰了 於 %s\n", cuser.userid, mychicken->name,
- chicken_type[(int)mychicken->type], ctime4(&now));
+ chicken_type[(int)mychicken->type], Cdate(&now));
mychicken->name[0] = 0;
}
}
@@ -679,7 +679,7 @@ deadtype(const chicken_t * thechicken, chicken_t *mychicken)
log_filef(CHICKENLOG, LOG_CREAT,
ANSI_COLOR(31) "%s" ANSI_RESET " 所疼愛的" ANSI_COLOR(33) " %s" ANSI_COLOR(32) " %s "
ANSI_RESET "掛了 於 %s\n", cuser.userid, thechicken->name,
- chicken_type[(int)thechicken->type], ctime4(&now));
+ chicken_type[(int)thechicken->type], Cdate(&now));
mychicken->name[0] = 0;
}
return i;
@@ -735,7 +735,7 @@ ch_changename(chicken_t *mychicken)
ANSI_COLOR(31) "%s" ANSI_RESET " 把疼愛的" ANSI_COLOR(33) " %s" ANSI_COLOR(32) " %s "
ANSI_RESET "改名為" ANSI_COLOR(33) " %s" ANSI_RESET " 於 %s\n",
cuser.userid, mychicken->name,
- chicken_type[(int)mychicken->type], newname, ctime4(&now));
+ chicken_type[(int)mychicken->type], newname, Cdate(&now));
}
}
@@ -947,8 +947,8 @@ chicken_live_upgrade()
fclose(fp);
#if 0 // enable if you want logs
log_filef("log/chicken_live_upgrade", LOG_CREAT,
- "%s upgrade chicken at %s",
- cuser.userid, ctime4(&now));
+ "%s upgrade chicken at %s\n",
+ cuser.userid, Cdate(&now));
#endif
}
#endif // CHICKEN_LIVE_UPGRADE
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index 965c9dbd..7c554e03 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -3326,7 +3326,7 @@ vedit2(const char *fpath, int saveheader, int *islocal, int flags)
/*
log_file("etc/illegal_money", LOG_CREAT | LOG_VF,
ANSI_COLOR(1;33;46) "%s " ANSI_COLOR(37;45) " 用機器人發表文章 " ANSI_COLOR(37) " %s" ANSI_RESET "\n",
- cuser.userid, ctime4(&now));
+ cuser.userid, Cdate(&now));
post_violatelaw(cuser.userid, BBSMNAME "系統警察",
"用機器人發表文章", "強制離站");
abort_bbs(0);
diff --git a/mbbsd/more.c b/mbbsd/more.c
index 5422c0bd..e758c82c 100644
--- a/mbbsd/more.c
+++ b/mbbsd/more.c
@@ -42,8 +42,8 @@ int more(const char *fpath, int promptend)
#endif // BN_SECURITY
log_filef("log/security", LOG_CREAT,
- "%u %24.24s %d %s admin edit file=%s\n",
- (int)now, ctime4(&now), getpid(), cuser.userid, fpath);
+ "%u %s %d %s admin edit file=%s\n",
+ (int)now, Cdate(&now), getpid(), cuser.userid, fpath);
// no need to allow anything...
// at least, no need to change title.
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 9f146639..b766d36c 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -153,9 +153,8 @@ user_display(const userec_t * u, int adminmode)
u->year + 1900, u->month, u->day,
resolve_over18_user(u) ? "已" : "未");
- prints("\t\t註冊日期: (已滿%d天) %s",
- (int)((now - u->firstlogin)/86400),
- ctime4(&u->firstlogin));
+ prints("\t\t註冊日期: %s (已滿%d天)\n",
+ Cdate(&u->firstlogin), (int)((now - u->firstlogin)/86400));
prints("\t\t上次上站: %s (%s)\n",
u->lasthost, Cdate(&u->lastlogin));
@@ -256,14 +255,15 @@ mail_violatelaw(const char *crime, const char *police, const char *reason, const
return;
fprintf(fp, "作者: [" BBSMNAME "警察局]\n"
"標題: [報告] 違法報告\n"
- "時間: %s\n"
+ "時間: %s\n", ctime4(&now));
+ fprintf(fp,
ANSI_COLOR(1;32) "%s" ANSI_RESET "判決:\n " ANSI_COLOR(1;32) "%s" ANSI_RESET
"因" ANSI_COLOR(1;35) "%s" ANSI_RESET "行為,\n"
"違反本站站規,處以" ANSI_COLOR(1;35) "%s" ANSI_RESET ",特此通知\n\n"
"請到 " BN_LAW " 查詢相關法規資訊,並從主選單進入:\n"
"(P)lay【娛樂與休閒】=>(P)ay【Ptt量販店 】=> (1)ViolateLaw 繳罰單\n"
"以繳交罰單。\n",
- ctime4(&now), police, crime, reason, result);
+ police, crime, reason, result);
fclose(fp);
strcpy(fhdr.title, "[報告] 違法判決報告");
strcpy(fhdr.owner, "[" BBSMNAME "警察局]");
diff --git a/mbbsd/vote.c b/mbbsd/vote.c
index 79a02246..323b0647 100644
--- a/mbbsd/vote.c
+++ b/mbbsd/vote.c
@@ -226,8 +226,8 @@ b_result_one(vote_buffer_t *vbuf, boardheader_t * fh, int ind, int *total)
fprintf(tfp, "%s\n◆ 投票名稱: %s\n\n", msg_seperator, inbuf);
fclose(xfp);
}
- fprintf(tfp, "%s\n◆ 投票中止於: %s\n\n◆ 票選題目描述:\n\n",
- msg_seperator, ctime4(&closetime));
+ fprintf(tfp, "%s\n◆ 投票中止於: %s\n\n\n◆ 票選題目描述:\n\n",
+ msg_seperator, Cdate(&closetime));
fh->vtime = now;
setbfile(buf, bname, vbuf->desc);
@@ -334,7 +334,7 @@ b_closepolls(void)
}
if ((cfp = fopen(fn_vote_polling, "w")) == NULL)
return 0;
- fprintf(cfp, "%d\n%s\n", now, ctime4(&now));
+ fprintf(cfp, "%d\n%s\n\n", now, Cdate(&now));
fclose(cfp);
#endif
@@ -400,8 +400,8 @@ vote_view(vote_buffer_t *vbuf, const char *bname, int vote_index)
counts = (int *)malloc(item_num * sizeof(int));
prints("\n◆ 預知投票紀事: 每人最多可投 %d 票,目前共有 %d 票,\n"
- "本次投票將結束於 %s", atoi(inbuf), (int)(num / sizeof(short)),
- ctime4(&closetime));
+ "本次投票將結束於 %s\n", atoi(inbuf), (int)(num / sizeof(short)),
+ Cdate(&closetime));
/* Thor: 開放 票數 預知 */
setbfile(buf, bname, vbuf->flags);
@@ -837,8 +837,8 @@ user_vote_one(vote_buffer_t *vbuf, const char *bname, int ind)
outs("投票方式:確定好您的選擇後,輸入其代碼(A, B, C...)即可。\n");
prints("此次投票你可以投 %1hd 票。按 0 取消投票, 1 完成投票, "
- "> 下一頁, < 上一頁\n此次投票將結束於:%s \n",
- tickets, ctime4(&closetime));
+ "> 下一頁, < 上一頁\n此次投票將結束於:%s \n\n",
+ tickets, Cdate(&closetime));
#define REDO_DRAW 1
#define REDO_SCAN 2
diff --git a/mbbsd/voteboard.c b/mbbsd/voteboard.c
index a247095e..096ecebf 100644
--- a/mbbsd/voteboard.c
+++ b/mbbsd/voteboard.c
@@ -152,7 +152,7 @@ do_voteboardreply(const fileheader_t * fhdr)
}
if (!endtime) {
now += 14 * 24 * 60 * 60;
- fprintf(fo, "連署結束時間: (%d)%s\n", now, ctime4(&now));
+ fprintf(fo, "連署結束時間: (%d)%s\n\n", now, Cdate(&now));
now -= 14 * 24 * 60 * 60;
}
fputs(genbuf, fo);
@@ -364,8 +364,8 @@ do_voteboard(int type)
now += 14 * 24 * 60 * 60;
snprintf(topic, sizeof(topic), "(%d)", now);
strcat(genbuf, topic);
- strcat(genbuf, ctime4(&now));
- strcat(genbuf, "\n");
+ strcat(genbuf, Cdate(&now));
+ strcat(genbuf, "\n\n");
now -= 14 * 24 * 60 * 60;
strcat(genbuf, "----------支持----------\n");
strcat(genbuf, "----------反對----------\n");