summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2013-10-04 20:31:50 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2013-10-04 20:31:50 +0800
commitf04713927e074e61b6a33fda15cf787212cd9a7f (patch)
treef3a80e9e38ace3a70e9c364973c9399f241d8270
parent0108d3c86b9afc95bc3128084c80a532a079c27b (diff)
downloadpttbbs-f04713927e074e61b6a33fda15cf787212cd9a7f.tar
pttbbs-f04713927e074e61b6a33fda15cf787212cd9a7f.tar.gz
pttbbs-f04713927e074e61b6a33fda15cf787212cd9a7f.tar.bz2
pttbbs-f04713927e074e61b6a33fda15cf787212cd9a7f.tar.lz
pttbbs-f04713927e074e61b6a33fda15cf787212cd9a7f.tar.xz
pttbbs-f04713927e074e61b6a33fda15cf787212cd9a7f.tar.zst
pttbbs-f04713927e074e61b6a33fda15cf787212cd9a7f.zip
Remove trailing spaces.
Just cleaning up. git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5883 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/mbbsd/acl.c10
-rw-r--r--pttbbs/mbbsd/admin.c34
-rw-r--r--pttbbs/mbbsd/announce.c60
-rw-r--r--pttbbs/mbbsd/assess.c16
-rw-r--r--pttbbs/mbbsd/bbs.c306
-rw-r--r--pttbbs/mbbsd/bbslua.c76
-rw-r--r--pttbbs/mbbsd/board.c174
-rw-r--r--pttbbs/mbbsd/brc.c14
-rw-r--r--pttbbs/mbbsd/cache.c8
-rw-r--r--pttbbs/mbbsd/cal.c174
-rw-r--r--pttbbs/mbbsd/calendar.c22
-rw-r--r--pttbbs/mbbsd/captcha.c12
-rw-r--r--pttbbs/mbbsd/ccw.c50
-rw-r--r--pttbbs/mbbsd/ch_dark.c6
-rw-r--r--pttbbs/mbbsd/ch_go.c10
-rw-r--r--pttbbs/mbbsd/ch_gomo.c4
-rw-r--r--pttbbs/mbbsd/ch_reversi.c10
-rw-r--r--pttbbs/mbbsd/chc.c8
-rw-r--r--pttbbs/mbbsd/chess.c12
-rw-r--r--pttbbs/mbbsd/chicken.c20
-rw-r--r--pttbbs/mbbsd/edit.c140
-rw-r--r--pttbbs/mbbsd/fav.c34
-rw-r--r--pttbbs/mbbsd/friend.c8
-rw-r--r--pttbbs/mbbsd/gamble.c20
-rw-r--r--pttbbs/mbbsd/io.c42
-rw-r--r--pttbbs/mbbsd/kaede.c4
-rw-r--r--pttbbs/mbbsd/mail.c54
-rw-r--r--pttbbs/mbbsd/mbbsd.c68
-rw-r--r--pttbbs/mbbsd/menu.c88
-rw-r--r--pttbbs/mbbsd/more.c88
-rw-r--r--pttbbs/mbbsd/name.c14
-rw-r--r--pttbbs/mbbsd/nios.c28
-rw-r--r--pttbbs/mbbsd/ordersong.c44
-rw-r--r--pttbbs/mbbsd/passwd.c54
-rw-r--r--pttbbs/mbbsd/pfterm.c292
-rw-r--r--pttbbs/mbbsd/pmore.c380
-rw-r--r--pttbbs/mbbsd/psb.c18
-rw-r--r--pttbbs/mbbsd/read.c74
-rw-r--r--pttbbs/mbbsd/record.c142
-rw-r--r--pttbbs/mbbsd/register.c196
-rw-r--r--pttbbs/mbbsd/screen.c24
-rw-r--r--pttbbs/mbbsd/stuff.c14
-rw-r--r--pttbbs/mbbsd/syspost.c4
-rw-r--r--pttbbs/mbbsd/talk.c78
-rw-r--r--pttbbs/mbbsd/telnet.c6
-rw-r--r--pttbbs/mbbsd/timecap.c6
-rw-r--r--pttbbs/mbbsd/user.c68
-rw-r--r--pttbbs/mbbsd/var.c4
-rw-r--r--pttbbs/mbbsd/vote.c4
-rw-r--r--pttbbs/mbbsd/voteboard.c8
-rw-r--r--pttbbs/mbbsd/vtuikit.c54
51 files changed, 1542 insertions, 1542 deletions
diff --git a/pttbbs/mbbsd/acl.c b/pttbbs/mbbsd/acl.c
index c8bbed2a..36bc9ca1 100644
--- a/pttbbs/mbbsd/acl.c
+++ b/pttbbs/mbbsd/acl.c
@@ -247,11 +247,11 @@ ui_ban_user_for_board(const char *uid, const char *board) {
result = ban_user_for_board(uid, board, expire, reason);
log_filef(history_log, LOG_CREAT,
- ANSI_COLOR(1) "%s %s" ANSI_COLOR(33) "%s" ANSI_RESET
- " 限制 " ANSI_COLOR(1;31) "%s" ANSI_RESET
+ ANSI_COLOR(1) "%s %s" ANSI_COLOR(33) "%s" ANSI_RESET
+ " 限制 " ANSI_COLOR(1;31) "%s" ANSI_RESET
" 發言,期限為 %s\n 理由: %s\n",
Cdatelite(&now),
- result ? "" :
+ result ? "" :
ANSI_COLOR(0;31)"[系統錯誤] "ANSI_COLOR(1),
cuser.userid, uid, datebuf, reason);
vmsg(result ? "已將使用者加入禁言名單" : "失敗,請向站長報告");
@@ -310,9 +310,9 @@ ui_unban_user_for_board(const char *uid, const char *board) {
unban_user_for_board(uid, board);
log_filef(history_log, LOG_CREAT,
ANSI_COLOR(1) "%s " ANSI_COLOR(33) "%s" ANSI_RESET
- " 解除 " ANSI_COLOR(1;32) "%s" ANSI_RESET
+ " 解除 " ANSI_COLOR(1;32) "%s" ANSI_RESET
" 的禁言限制 (距原期限尚有 %d 天)\n 理由: %s\n",
- Cdatelite(&now), cuser.userid, uid,
+ Cdatelite(&now), cuser.userid, uid,
(expire - now) / DAY_SECONDS+1, reason);
vmsg("使用者的禁言限制已解除,最晚至該使用者重新上站後生效");
invalid_board_permission_cache(board);
diff --git a/pttbbs/mbbsd/admin.c b/pttbbs/mbbsd/admin.c
index 07ceb6b5..61116126 100644
--- a/pttbbs/mbbsd/admin.c
+++ b/pttbbs/mbbsd/admin.c
@@ -13,7 +13,7 @@ m_loginmsg(void)
outs("目前已經有以下的 進站水球設定請先協調好再設定..");
getmessage(SHM->loginmsg);
}
- getdata(22, 0,
+ getdata(22, 0,
"進站水球:本站活動,不干擾使用者為限,設定者離站自動取消,確定要設?(y/N)",
msg, 3, LCECHO);
@@ -89,7 +89,7 @@ static int retrieve_backup(userec_t *user)
return -1;
}
-int
+int
upgrade_passwd(userec_t *puser)
{
if (puser->version == PASSWD_VERSION)
@@ -175,7 +175,7 @@ search_key_user(const char *passwdfile, int mode)
{
// only verify id
if (!strcasecmp(user.userid, key))
- keymatch = user.userid;
+ keymatch = user.userid;
} else {
// search by keytype
if ((!keytype || keytype == 1) &&
@@ -226,7 +226,7 @@ search_key_user(const char *passwdfile, int mode)
outs(ANSI_COLOR(44) " 空白鍵" \
ANSI_COLOR(37) ":搜尋下一個 " \
ANSI_COLOR(33)" Q" ANSI_COLOR(37)": 離開");
- outs(mode ?
+ outs(mode ?
" A: add to namelist " ANSI_RESET " " :
" S: 取用備份資料 " ANSI_RESET " ");
while (1) {
@@ -284,7 +284,7 @@ search_user_bybakpwd(void)
move(1, 1);
outs("請輸入你要用來尋找備份的檔案 或按 'q' 離開\n");
outs(" [" ANSI_COLOR(1;31) "1" ANSI_RESET "]一天前,"
- " [" ANSI_COLOR(1;31) "2" ANSI_RESET "]兩天前,"
+ " [" ANSI_COLOR(1;31) "2" ANSI_RESET "]兩天前,"
" [" ANSI_COLOR(1;31) "3" ANSI_RESET "]三天前\n");
outs(" [" ANSI_COLOR(1;31) "4" ANSI_RESET "]四天前,"
" [" ANSI_COLOR(1;31) "5" ANSI_RESET "]五天前,"
@@ -427,7 +427,7 @@ void delete_board_link(boardheader_t *bh, int bid)
memset(bh, 0, sizeof(boardheader_t));
substitute_record(fn_board, bh, sizeof(boardheader_t), bid);
reset_board(bid);
- sort_bcache();
+ sort_bcache();
log_usies("DelLink", bh->brdname);
}
@@ -463,7 +463,7 @@ void merge_dir(const char *dir1, const char *dir2, int isoutter)
{
for(i=0; i<sn; i++)
if(fh[pn+i].owner[0])
- strcat(fh[pn+i].owner, ".");
+ strcat(fh[pn+i].owner, ".");
}
qsort(fh, pn+sn, sizeof(fileheader_t), dir_cmp);
snprintf(bakdir, sizeof(bakdir), "%s.bak", dir1);
@@ -481,12 +481,12 @@ void merge_dir(const char *dir1, const char *dir2, int isoutter)
{
strcpy(p2, fh[i-1].filename);
Copy(file2, file1);
- }
+ }
}
else
fh[i].filemode |= fh[i-1].filemode;
}
-
+
free(fh);
}
@@ -604,7 +604,7 @@ m_mod_board(char *bname)
assert(0<=bid-1 && bid-1<MAX_BOARD);
substitute_record(fn_board, &bh, sizeof(bh), bid);
reset_board(bid);
- sort_bcache();
+ sort_bcache();
log_usies("DelBoard", bh.title);
outs("刪板完畢");
}
@@ -773,7 +773,7 @@ m_mod_board(char *bname)
assert(0<=bid-1 && bid-1<MAX_BOARD);
substitute_record(fn_board, &newbh, sizeof(newbh), bid);
reset_board(bid);
- sort_bcache();
+ sort_bcache();
log_usies("SetBoard", newbh.brdname);
snprintf(buf, sizeof(buf), "[看板變更] %s (by %s)", bh.brdname, cuser.userid);
@@ -815,7 +815,7 @@ static int add_board_record(const boardheader_t *board)
assert(0<=bid-1 && bid-1<MAX_BOARD);
substitute_record(fn_board, board, sizeof(boardheader_t), bid);
reset_board(bid);
- sort_bcache();
+ sort_bcache();
} else if (SHM->Bnumber >= MAX_BOARD) {
return -1;
} else if (append_record(fn_board, (fileheader_t *)board, sizeof(boardheader_t)) == -1) {
@@ -976,7 +976,7 @@ int make_board_link(const char *bname, int gid)
{
boardheader_t newboard;
int bid;
-
+
bid = getbnum(bname);
if(bid==0) return -1;
assert(0<=bid-1 && bid-1<MAX_BOARD);
@@ -985,7 +985,7 @@ int make_board_link(const char *bname, int gid)
/*
* known issue:
* These two stuff will be used for sorting. But duplicated brdnames
- * may cause wrong binary-search result. So I replace the last
+ * may cause wrong binary-search result. So I replace the last
* letters of brdname to '~'(ascii code 126) in order to correct the
* resuilt, thought I think it's a dirty solution.
*
@@ -1030,8 +1030,8 @@ int make_board_link_interactively(int gid)
static void
adm_give_id_money(const char *user_id, int money, const char *mail_title)
{
- char tt[TTLEN + 1] = {0};
- int unum = searchuser(user_id, NULL);
+ char tt[TTLEN + 1] = {0};
+ int unum = searchuser(user_id, NULL);
// XXX 站長們似乎利用這個功能來同時發錢或扣錢,return value 可能是 0
// (若代表對方錢被扣光)
@@ -1137,7 +1137,7 @@ give_money(void)
fclose(fp);
sprintf(buf, "(%d人:%d" MONEYNAME ")", count, total_money);
strcat(reason, buf);
-
+
}
fclose(fp2);
diff --git a/pttbbs/mbbsd/announce.c b/pttbbs/mbbsd/announce.c
index 7756b66f..2901e747 100644
--- a/pttbbs/mbbsd/announce.c
+++ b/pttbbs/mbbsd/announce.c
@@ -5,14 +5,14 @@
// 最近發現很多 code 都死在 announce
// 因為進來要看 lastlevel 而非 currbid
// user 可能一進 BBS 直殺郵件->mail_cite->進精華區
-// 於是就爆炸
+// 於是就爆炸
// 同理 currboard 也不該用
// 請改用 me.bid (注意 me.bid 可能為 0, 表示進來的非看板。)
// for max file size limitation here, see edit.c
#define MAX_FILE_SIZE (32768*1024)
-// used to force a page refresh.
+// used to force a page refresh.
// TODO change this to INT_MAX in future, when we understand what is the magic 10000 value.
#define A_INVALID_PAGE (9999)
@@ -72,7 +72,7 @@ int copyqueue_fileinqueue(const char *fn)
void copyqueue_reset()
{
allocated_copyqueue = 0;
- used_copyqueue = 0;
+ used_copyqueue = 0;
head_copyqueue = 0;
}
@@ -80,7 +80,7 @@ int copyqueue_append(CopyQueue *pcq)
{
if(copyqueue_testin(pcq))
return 0;
- if(head_copyqueue == used_copyqueue)
+ if(head_copyqueue == used_copyqueue)
{
// empty queue, happy happy reset
if(allocated_copyqueue > COPYQUEUE_COMMON_SIZE)
@@ -96,7 +96,7 @@ int copyqueue_append(CopyQueue *pcq)
if(used_copyqueue > allocated_copyqueue)
{
- allocated_copyqueue =
+ allocated_copyqueue =
used_copyqueue + COPYQUEUE_COMMON_SIZE; // half page
copyqueue = (CopyQueue*) realloc (copyqueue,
sizeof(CopyQueue) * allocated_copyqueue);
@@ -125,7 +125,7 @@ int copyqueue_toggle(CopyQueue *pcq)
head_copyqueue =used_copyqueue;
if (i < used_copyqueue)
{
- memcpy(copyqueue + i, copyqueue+i+1,
+ memcpy(copyqueue + i, copyqueue+i+1,
sizeof(CopyQueue) * (used_copyqueue - i));
}
return 0;
@@ -264,7 +264,7 @@ a_showmenu(menu_t * pm)
vs_footer(buf, pm->level == 0 ?
" (c)標記/複製 - 無管理權限,無法貼上 " :
" (c)標記/複製 (p)貼上/取消/重設標記 (a)附加至文章後\t(q/←)離開 (h)說明");
- }
+ }
else if(pm->level)
{ // BM
vs_footer(" 【板 主】 ",
@@ -433,8 +433,8 @@ a_newitem(menu_t * pm, int mode)
{
int edflags = 0;
# ifdef BN_BBSMOVIE
- if (pm && pm->bid &&
- strcmp(getbcache(pm->bid)->brdname,
+ if (pm && pm->bid &&
+ strcmp(getbcache(pm->bid)->brdname,
BN_BBSMOVIE) == 0)
{
edflags |= EDITFLAG_UPLOAD;
@@ -480,7 +480,7 @@ a_pasteitem(menu_t * pm, int mode)
move(b_lines-2, 0); clrtobot();
outs("c: 對各項目個別確認是否要貼上, z: 全部不貼,同時重設並取消全部標記\n");
snprintf(buf, sizeof(buf),
- "確定要貼上全部共 %d 個項目嗎 (c/z/y/N)? ",
+ "確定要貼上全部共 %d 個項目嗎 (c/z/y/N)? ",
copyqueue_querysize());
getdata(b_lines - 1, 0, buf, ans, sizeof(ans), LCECHO);
if(ans[0] == 'y')
@@ -573,7 +573,7 @@ a_appenditem(const menu_t * pm, int isask)
vmsg("請先執行 copy 命令後再 append");
copyqueue_reset();
return;
- }
+ }
else
{
CopyQueue *cq = copyqueue_gethead();
@@ -671,7 +671,7 @@ _iter_paste_tag(void *item, void *optarg) {
if (!FindTaggedItem(fhdr))
return 0;
- if (TagBoard == 0)
+ if (TagBoard == 0)
sethomefile(buf, cuser.userid, fhdr->filename);
else {
setbfile(buf, param->bh->brdname, fhdr->filename);
@@ -791,7 +791,7 @@ a_delete(menu_t * pm, const char *backup_dir)
fileheader_t backup, *fhdr = &(pm->header[pm->now - pm->page]);
const char *msg_errsync = "刪除檔案失敗,請退回上層目錄後再重試一次",
*msg_errsync2 = "檔案可能已被它人刪除,請退回上層目錄再重進確認",
- *msg_errbackup = "檔案已刪除但無法備份。請至 " BN_BUGREPORT
+ *msg_errbackup = "檔案已刪除但無法備份。請至 " BN_BUGREPORT
"報告您試圖刪除檔案的位置。";
snprintf(fpath, sizeof(fpath),
@@ -844,7 +844,7 @@ a_delete(menu_t * pm, const char *backup_dir)
// simple workaround here.
if (backup_dir) {
const char *bn = NULL;
- if (strstr(backup_dir, "/" BN_JUNK "/"))
+ if (strstr(backup_dir, "/" BN_JUNK "/"))
bn = BN_JUNK;
else if (strstr(backup_dir, "/" BN_DELETED "/"))
bn = BN_DELETED;
@@ -1096,7 +1096,7 @@ typedef struct {
// look up current location
#define A_WHEREAMI_PREFIX_STR "我在哪? "
-static int
+static int
a_where_am_i(const menu_t *root, int current_idx, const char *current_title)
{
const menu_t *p;
@@ -1115,7 +1115,7 @@ a_where_am_i(const menu_t *root, int current_idx, const char *current_title)
snprintf(abuf, sizeof(abuf), "-%d", current_idx);
last_idx_len = strlen(abuf)+1;
// calculate remaining length
- zidx_len = sizeof(zidx_buf) - strlen(zidx) - last_idx_len;
+ zidx_len = sizeof(zidx_buf) - strlen(zidx) - last_idx_len;
bskipping = 0;
// first round, quick render zidx
@@ -1150,8 +1150,8 @@ a_where_am_i(const menu_t *root, int current_idx, const char *current_title)
}
outs(zidx_buf); outs(ANSI_RESET);
- move(2, 0);
-
+ move(2, 0);
+
bskipping = 0;
// second round, render text output
for (p = root, lvl = 0, num = 0; lvl < max_lvl; p = p->next)
@@ -1244,7 +1244,7 @@ a_multi_search_num(char init, a_menu_session_t *sess)
}
int
-a_menu_rec(const char *maintitle, const char *path,
+a_menu_rec(const char *maintitle, const char *path,
int lastlevel, int lastbid,
char *trans_buffer,
a_menu_session_t *sess,
@@ -1345,7 +1345,7 @@ a_menu_rec(const char *maintitle, const char *path,
{
// simple (single) selection
me.now = n-1;
- me.page = 10000; // I don't know what's the magic value 10000...
+ me.page = 10000; // I don't know what's the magic value 10000...
}
else if (n == 0 && sess->z_indexes[0] == 0)
{
@@ -1446,7 +1446,7 @@ a_menu_rec(const char *maintitle, const char *path,
*quote_file = 0;
# ifdef BN_BBSMOVIE
- if (me.bid && strcmp(getbcache(me.bid)->brdname,
+ if (me.bid && strcmp(getbcache(me.bid)->brdname,
BN_BBSMOVIE) == 0)
{
edflags |= EDITFLAG_UPLOAD;
@@ -1508,7 +1508,7 @@ a_menu_rec(const char *maintitle, const char *path,
{
preselect = NULL;
continue;
- }
+ }
else
{
fileheader_t *fhdr = &me.header[me.now - me.page];
@@ -1526,7 +1526,7 @@ a_menu_rec(const char *maintitle, const char *path,
while ((more_result = more(fname, YEA))) {
/* Ptt 範本精靈 plugin */
- if (trans_buffer &&
+ if (trans_buffer &&
(currstat == EDITEXP || currstat == OSONG)) {
char ans[4];
@@ -1570,10 +1570,10 @@ a_menu_rec(const char *maintitle, const char *path,
break;
}
} else if (dashd(fname)) {
- returnvalue = a_menu_rec(me.header[me.now - me.page].title, fname,
- me.level, me.bid, trans_buffer,
+ returnvalue = a_menu_rec(me.header[me.now - me.page].title, fname,
+ me.level, me.bid, trans_buffer,
sess, newselect, root, &me);
-
+
if (returnvalue == DONOTHING)
{
// DONOTHING will only be caused by previous a_multi_search_num + preselect.
@@ -1703,14 +1703,14 @@ a_menu_rec(const char *maintitle, const char *path,
}
int
-a_menu(const char *maintitle, const char *path,
+a_menu(const char *maintitle, const char *path,
int lastlevel, int lastbid,
char *trans_buffer, const char *backup_dir)
{
a_menu_session_t sess = {0};
sess.backup_dir = backup_dir;
- return a_menu_rec(maintitle, path,
- lastlevel, lastbid, trans_buffer,
+ return a_menu_rec(maintitle, path,
+ lastlevel, lastbid, trans_buffer,
&sess, NULL, NULL, NULL);
}
@@ -1719,7 +1719,7 @@ Announce(void)
{
setutmpmode(ANNOUNCE);
a_menu(BBSNAME "佈告欄", "man",
- ((HasUserPerm(PERM_SYSOP) ) ? SYSOP : NOBODY),
+ ((HasUserPerm(PERM_SYSOP) ) ? SYSOP : NOBODY),
0,
NULL, NULL);
return 0;
diff --git a/pttbbs/mbbsd/assess.c b/pttbbs/mbbsd/assess.c
index 36cdc167..ebc54881 100644
--- a/pttbbs/mbbsd/assess.c
+++ b/pttbbs/mbbsd/assess.c
@@ -15,8 +15,8 @@ inline static void inc(unsigned char *num, int n)
}
int
-inc_badpost(const char *userid, int num) {
- userec_t xuser;
+inc_badpost(const char *userid, int num) {
+ userec_t xuser;
int uid = getuser(userid, &xuser);
time4_t min_timer;
@@ -31,7 +31,7 @@ inc_badpost(const char *userid, int num) {
xuser.timeremovebadpost = min_timer;
xuser.badpost += num;
- passwd_sync_update(uid, &xuser);
+ passwd_sync_update(uid, &xuser);
return xuser.badpost;
}
@@ -41,7 +41,7 @@ static char * const badpost_reason[] = {
#define DIM(x) (sizeof(x)/sizeof(x[0]))
-int assign_badpost(const char *userid, fileheader_t *fhdr,
+int assign_badpost(const char *userid, fileheader_t *fhdr,
const char *newpath, const char *comment)
{
char genbuf[STRLEN];
@@ -87,7 +87,7 @@ int assign_badpost(const char *userid, fileheader_t *fhdr,
sprintf(genbuf,"劣%s文退回(%s)", comment ? "推" : "", reason);
- if (fhdr) strncat(genbuf, fhdr->title, 64-strlen(genbuf));
+ if (fhdr) strncat(genbuf, fhdr->title, 64-strlen(genbuf));
#ifdef USE_COOLDOWN
add_cooldowntime(tusernum, 60);
@@ -96,16 +96,16 @@ int assign_badpost(const char *userid, fileheader_t *fhdr,
if (!(inc_badpost(userid, 1) % 5)){
userec_t xuser;
- post_violatelaw(userid, BBSMNAME "系統警察",
+ post_violatelaw(userid, BBSMNAME "系統警察",
"劣文累計 5 篇", "罰單一張");
- mail_violatelaw(userid, BBSMNAME "系統警察",
+ mail_violatelaw(userid, BBSMNAME "系統警察",
"劣文累計 5 篇", "罰單一張");
kick_all(userid);
passwd_sync_query(tusernum, &xuser);
xuser.money = moneyof(tusernum);
xuser.vl_count++;
xuser.userlevel |= PERM_VIOLATELAW;
- xuser.timeviolatelaw = now;
+ xuser.timeviolatelaw = now;
passwd_sync_update(tusernum, &xuser);
}
diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c
index ae3f65c2..97683560 100644
--- a/pttbbs/mbbsd/bbs.c
+++ b/pttbbs/mbbsd/bbs.c
@@ -21,7 +21,7 @@ static int view_postinfo(int ent, const fileheader_t * fhdr,
static int bnote_lastbid = -1; // 決定是否要顯示進板畫面的 cache
// recommend/comment types
-// most people use recommendation just for one-line reply.
+// most people use recommendation just for one-line reply.
// so we may change default to (RECTYPE_ARROW)= comment only.
// however, the traditional behavior (which does not have
// BRC info for 'new comments available') uses RECTYPE_GOOD.
@@ -75,12 +75,12 @@ is_file_owner_id(const fileheader_t *fhdr, const char *userid) {
/* query money by fileheader pointer.
* return <0 if money is not valid.
*/
-int
+int
query_file_money(const fileheader_t *pfh)
{
fileheader_t hdr;
- if( (currmode & MODE_SELECT) &&
+ if( (currmode & MODE_SELECT) &&
(pfh->multi.refer.flag) &&
(pfh->multi.refer.ref > 0)) // really? not sure, copied from other's code
{
@@ -110,7 +110,7 @@ cp_IsHiddenBoard(const boardheader_t *bp)
}
// lite weight version to update dir files
-static int
+static int
modify_dir_lite(
const char *direct, int ent, const char *fhdr_name,
time4_t modified, const char *title, char recommend)
@@ -124,7 +124,7 @@ modify_dir_lite(
// PttLock(fd, offset, size, F_WRLCK);
// write(fd, rptr, size);
// PttLock(fd, offset, size, F_UNLCK);
-
+
// prevent black holes
if (sz < (int)sizeof(fileheader_t) * (ent) ||
(fd = open(direct, O_RDWR)) < 0 )
@@ -148,7 +148,7 @@ modify_dir_lite(
if (title && *title)
strcpy(fhdr.title, title);
- if (recommend)
+ if (recommend)
{
recommend += fhdr.recommend;
if (recommend > MAX_RECOMMENDS) recommend = MAX_RECOMMENDS;
@@ -164,7 +164,7 @@ modify_dir_lite(
return 0;
}
-static void
+static void
check_locked(fileheader_t *fhdr)
{
boardheader_t *bp = NULL;
@@ -240,10 +240,10 @@ anticrosspost(void)
log_filef("etc/illegal_money", LOG_CREAT,
ANSI_COLOR(1;33;46) "%s "
ANSI_COLOR(37;45) "cross post 文章 "
- ANSI_COLOR(37) " %s" ANSI_RESET "\n",
+ ANSI_COLOR(37) " %s" ANSI_RESET "\n",
cuser.userid, Cdatelite(&now));
- post_violatelaw(cuser.userid, BBSMNAME "系統警察",
+ post_violatelaw(cuser.userid, BBSMNAME "系統警察",
"Cross-post", "罰單處份");
pwcuViolateLaw();
mail_id(cuser.userid, "Cross-Post罰單",
@@ -291,12 +291,12 @@ save_violatelaw(void)
return 0;
}
move(5, 0);
- prints("這是你第 %d 次違法 必須繳出 %d " MONEYNAME "\n\n",
+ prints("這是你第 %d 次違法 必須繳出 %d " MONEYNAME "\n\n",
cuser.vl_count, cuser.vl_count * 1000);
outs(ANSI_COLOR(1;37) "你是否確定以後不會再犯了?" ANSI_RESET "\n");
if (!getdata(10, 0, "確定嗎?[y/N]:", ok, sizeof(ok), LCECHO) ||
- ok[0] != 'y')
+ ok[0] != 'y')
{
move(15, 0);
outs(ANSI_COLOR(1;31) "不想付嗎? 還是不知道要按 y ?\n"
@@ -307,19 +307,19 @@ save_violatelaw(void)
//Ptt:check one more time
reload_money();
- if (cuser.money < (int)cuser.vl_count * 1000)
+ if (cuser.money < (int)cuser.vl_count * 1000)
{
log_filef("log/violation", LOG_CREAT,
- "%s %s pay-violation error: race-conditionn hack?\n",
+ "%s %s pay-violation error: race-conditionn hack?\n",
Cdate(&now), cuser.userid);
vmsg(MONEYNAME "怎麼忽然不夠了? 試圖欺騙系統被查到將砍帳號!");
- return 0;
+ return 0;
}
pay(1000 * (int)cuser.vl_count, "繳付罰單 (#%d)", cuser.vl_count);
pwcuSaveViolateLaw();
log_filef("log/violation", LOG_CREAT,
- "%s %s pay-violation: $%d complete.\n",
+ "%s %s pay-violation: $%d complete.\n",
Cdate(&now), cuser.userid, (int)cuser.vl_count*1000);
vmsg("罰單已付,請重新登入。");
@@ -359,9 +359,9 @@ set_board(void)
snprintf(currBM, sizeof(currBM), "板主:%s", bp->BM);
/* title has +7 leading symbols */
l += strlen(bp->title);
- if(l >= 7)
+ if(l >= 7)
l -= 7;
- else
+ else
l = 0;
l += 8 + strlen(currboard); /* trailing stuff */
l += strlen(bp->brdname);
@@ -386,7 +386,7 @@ set_board(void)
/* init basic perm, but post perm is checked on demand */
currmode = (currmode & (MODE_DIRTY | MODE_GROUPOP)) | MODE_STARTED;
- if (!HasUserPerm(PERM_NOCITIZEN) &&
+ if (!HasUserPerm(PERM_NOCITIZEN) &&
(HasUserPerm(PERM_ALLBOARD) ||
is_BM_cache(currbid) ||
(bp->BM[0] <= ' ' && GROUPOP()))) {
@@ -423,7 +423,7 @@ CheckModifyPerm(const char **preason)
boardheader_t *bp = NULL;
assert(preason);
-
+
// check if my own permission is changed.
if (ISNEWPERM(currutmp))
{
@@ -476,7 +476,7 @@ CheckModifyPerm(const char **preason)
currmode |= MODE_POSTCHECKED;
// vmsg("reload board postperm");
-
+
last_reason = postperm_msg(currboard);
*preason = last_reason;
@@ -571,7 +571,7 @@ readtitle(void)
snprintf(buf, sizeof(buf), "人氣:%d ", nuser);
}
- vbarf(ANSI_REVERSE " 編號 %s 作 者 文 章 標 題\t%s ",
+ vbarf(ANSI_REVERSE " 編號 %s 作 者 文 章 標 題\t%s ",
IS_LISTING_MONEY ? listmode_desc[LISTMODE_MONEY] : listmode_desc[currlistmode],
buf);
}
@@ -590,7 +590,7 @@ is_tn_allowed(const char *title)
#else
// TN_ANNOUNCE is prohibited for non-BMs
if ((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP) ||
- HasUserPerm(PERM_ACCOUNTS | PERM_BOARD | PERM_BBSADM |
+ HasUserPerm(PERM_ACCOUNTS | PERM_BOARD | PERM_BBSADM |
PERM_VIEWSYSOP| PERM_POLICE_MAN))
return 1;
@@ -613,7 +613,7 @@ tn_safe_strip(char *title)
if (is_tn_allowed(title))
return;
assert(is_tn_announce(title));
- memmove(title, title + strlen(TN_ANNOUNCE),
+ memmove(title, title + strlen(TN_ANNOUNCE),
strlen(title) - strlen(TN_ANNOUNCE)+1);
}
@@ -645,9 +645,9 @@ readdoent(int num, fileheader_t * ent)
#else // COLORIZED_SAFEDEL
oisunread = isunread = 0;
#endif // COLORIZED_SAFEDEL
- } else
+ } else
#endif // SAFE_ARTICLE_DELETE
- oisunread = isunread =
+ oisunread = isunread =
brc_unread(currbid, ent->filename, ent->modified);
// modified tag
@@ -691,7 +691,7 @@ readdoent(int num, fileheader_t * ent)
}
// tag should override everything
- if ((currmode & MODE_BOARD) || HasBasicUserPerm(PERM_LOGINOK))
+ if ((currmode & MODE_BOARD) || HasBasicUserPerm(PERM_LOGINOK))
{
if (FindTaggedItem(ent))
type = 'D';
@@ -717,7 +717,7 @@ readdoent(int num, fileheader_t * ent)
if (iscorpse)
color = '0', mark = "□";
// color = '0', mark = "╳";
- else
+ else
#endif
if (ent->filemode & FILE_VOTE)
color = '2', mark = "ˇ";
@@ -750,7 +750,7 @@ readdoent(int num, fileheader_t * ent)
sprintf(recom,"0mXX");
else if(ent->recommend<-10)
sprintf(recom,"0mX%d",-ent->recommend);
- else strcpy(recom,"0m ");
+ else strcpy(recom,"0m ");
/* start printing */
if (ent->filemode & FILE_BOTTOM) {
@@ -767,10 +767,10 @@ readdoent(int num, fileheader_t * ent)
prints("%7d", num);
if (HasUserFlag(UF_MENU_LIGHTBAR))
- prints(" %s%c" ESC_STR "[0;3%4.4s" ANSI_RESET,
+ prints(" %s%c" ESC_STR "[0;3%4.4s" ANSI_RESET,
typeattr, type, recom);
else
- prints(" %s%c" ESC_STR "[0;1;3%4.4s" ANSI_RESET,
+ prints(" %s%c" ESC_STR "[0;1;3%4.4s" ANSI_RESET,
typeattr, type, recom);
if(IS_LISTING_MONEY)
@@ -828,7 +828,7 @@ readdoent(int num, fileheader_t * ent)
special = 0;
}
}
-
+
// strip unsafe characters
if (!const_title)
strip_nonebig5((unsigned char*)title, INT_MAX);
@@ -1004,13 +1004,13 @@ do_deleteCrossPost(const fileheader_t *fh, char bname[])
setbdir(bdir, bname);
setbfile(file, bname, fh->filename);
- memcpy(&newfh, fh, sizeof(fileheader_t));
+ memcpy(&newfh, fh, sizeof(fileheader_t));
// XXX TODO FIXME This (finding file by getindex) sucks. getindex checks
// only timestamp by binary search, but that is not always true in current
// system.
- // Ptt: protect original fh
+ // Ptt: protect original fh
// because getindex safe_article_delete will change fh in some case
if( (i=getindex(bdir, &newfh, 0))>0)
{
@@ -1067,7 +1067,7 @@ delete_allpost(const char *userid)
if(!userid) return;
setbdir(bdir, BN_ALLPOST);
- if( (fd = open(bdir, O_RDWR)) != -1)
+ if( (fd = open(bdir, O_RDWR)) != -1)
{
for(i=0; read(fd, &fhdr, sizeof(fileheader_t)) >0; i++){
if(strcmp(fhdr.owner, userid))
@@ -1085,7 +1085,7 @@ delete_allpost(const char *userid)
/* ----------------------------------------------------- */
/* 發表、回應、編輯、轉錄文章 */
/* ----------------------------------------------------- */
-static int
+static int
solveEdFlagByBoard(const char *bn, int flags)
{
if (
@@ -1172,7 +1172,7 @@ dbcs_safe_trim_title(char *output, const char *title, int len) {
}
}
-void
+void
do_crosspost(const char *brd, fileheader_t *postfile, const char *fpath)
{
char genbuf[200];
@@ -1244,7 +1244,7 @@ do_post_article(int edflags)
char genbuf[PATHLEN];
const char *owner;
char ctype[8][5] = {"問題", "建議", "討論", "心得",
- "閒聊", "請益", "情報",
+ "閒聊", "請益", "情報",
"公告" // TN_ANNOUNCE
};
boardheader_t *bp;
@@ -1261,7 +1261,7 @@ do_post_article(int edflags)
if( !CheckPostPerm2(&reason)
#ifdef FOREIGN_REG
// 不是外籍使用者在 PttForeign 板
- && !(HasUserFlag(UF_FOREIGN) &&
+ && !(HasUserFlag(UF_FOREIGN) &&
strcmp(bp->brdname, BN_FOREIGN) == 0)
#endif
) {
@@ -1306,7 +1306,7 @@ do_post_article(int edflags)
sprintf(buf,"(1-%d或不選)",i);
do {
- getdata(21, 6+7*i, buf, tmp_title, 3, LCECHO);
+ getdata(21, 6+7*i, buf, tmp_title, 3, LCECHO);
posttype = tmp_title[0] - '1';
if (posttype >= 0 && posttype < i)
{
@@ -1381,7 +1381,7 @@ do_post_article(int edflags)
currbrdattr |= BRD_DEFAULTANONYMOUS;
};
#endif
-
+
money = vedit2(fpath, YEA, &islocal, save_title, edflags);
if (money == EDIT_ABORTED) {
unlink(fpath);
@@ -1416,9 +1416,9 @@ do_post_article(int edflags)
// drop money & numposts for free boards, or user without login information
// (they may post on free boards like SYSOP)
// including: special boards (e.g. TEST, ALLPOST), bad boards, no BM boards
- if (!HasBasicUserPerm(PERM_LOGINOK) ||
- IsFreeBoardName(currboard) ||
- (currbrdattr & BRD_NOCREDIT) ||
+ if (!HasBasicUserPerm(PERM_LOGINOK) ||
+ IsFreeBoardName(currboard) ||
+ (currbrdattr & BRD_NOCREDIT) ||
#ifdef USE_HIDDEN_BOARD_NOCREDIT
(currbrdattr & BRD_HIDE) ||
#endif
@@ -1454,7 +1454,7 @@ do_post_article(int edflags)
// stampfile_u is used when you don't want to clear other fields
strcpy(genbuf, fpath);
setbpath(fpath, currboard);
- stampfile_u(fpath, &postfile);
+ stampfile_u(fpath, &postfile);
if (append_record(buf, &postfile, sizeof(postfile)) == -1)
{
@@ -1495,11 +1495,11 @@ do_post_article(int edflags)
outs("順利貼出佈告,");
// Freeboard/BRD_NOCREDIT check was already done.
- if (!ifuseanony)
+ if (!ifuseanony)
{
if (money > 0)
{
- pay(-money, "%s 看板發文稿酬: %s", currboard, postfile.title);
+ pay(-money, "%s 看板發文稿酬: %s", currboard, postfile.title);
pwcuIncNumPost();
addPost = 1;
prints("這是您的第 %d 篇有效文章,獲得稿酬 %d "
@@ -1515,8 +1515,8 @@ do_post_article(int edflags)
// no money, no record.
outs("本篇文章不列入記錄,敬請包涵。");
}
- }
- else
+ }
+ else
{
outs("不列入記錄,敬請包涵。");
}
@@ -1558,7 +1558,7 @@ do_post_article(int edflags)
sendalert(quote_user, ALERT_NEW_MAIL);
} else if ((str = strchr(quote_user, '.'))) {
LOG_IF(LOG_CONF_INTERNETMAIL,
- log_filef("log/internet_mail.log", LOG_CREAT,
+ log_filef("log/internet_mail.log", LOG_CREAT,
"%s [%s (%s)] %s -> %s: %s\n",
Cdatelite(&now), __FUNCTION__,
currboard, cuser.userid, str + 1, save_title));
@@ -1622,12 +1622,12 @@ do_generalboardreply(/*const*/ fileheader_t * fhdr)
{
char genbuf[3];
int edflags = EDITFLAG_KIND_REPLYPOST;
-
+
assert(0<=currbid-1 && currbid-1<MAX_BOARD);
if (!CheckPostRestriction(currbid))
{
- getdata(b_lines - 1, 0,
+ getdata(b_lines - 1, 0,
ANSI_COLOR(1;31) "▲ 無法回應至看板。 " ANSI_RESET
"改回應至 (M)作者信箱 (Q)取消?[Q] ",
genbuf, sizeof(genbuf), LCECHO);
@@ -1856,7 +1856,7 @@ edit_post(int ent, fileheader_t * fhdr, const char *direct)
if (!HasUserPerm(PERM_BASIC) || // including guests
!CheckPostPerm() || // edit needs post perm (cannot be changed in digest mode)
!CheckPostRestriction(currbid)
- )
+ )
return DONOTHING;
setdirpath(genbuf, direct, fhdr->filename);
@@ -1867,7 +1867,7 @@ edit_post(int ent, fileheader_t * fhdr, const char *direct)
// admin edit!
log_filef("log/security", LOG_CREAT,
- "%d %s %d %s admin edit (board) file=%s\n",
+ "%d %s %d %s admin edit (board) file=%s\n",
(int)now, Cdate(&now), getpid(), cuser.userid, genbuf);
}
@@ -1922,7 +1922,7 @@ edit_post(int ent, fileheader_t * fhdr, const char *direct)
outs("\n\n" ANSI_COLOR(1;30) "正在檢查檔案是否被修改過..." ANSI_RESET);
refresh();
- if (hash_partial_file(genbuf, oldsz, newsum) != HASHPF_RET_OK ||
+ if (hash_partial_file(genbuf, oldsz, newsum) != HASHPF_RET_OK ||
memcmp(oldsum, newsum, sizeof(oldsum)) != 0) {
is_race_condition = 1;
}
@@ -2042,7 +2042,7 @@ cross_post(int ent, fileheader_t * fhdr, const char *direct)
clrtoeol();
outs("準備進行文章轉錄。板主要置底文章請改按 "
ANSI_COLOR(1;31) "_" ANSI_RESET " (壓住 "
- ANSI_COLOR(1;36) "Shift" ANSI_RESET " 再按 "
+ ANSI_COLOR(1;36) "Shift" ANSI_RESET " 再按 "
ANSI_COLOR(1;36) "-" ANSI_RESET
" )\n");
}
@@ -2052,11 +2052,11 @@ cross_post(int ent, fileheader_t * fhdr, const char *direct)
//
// some spammers try to cross-post to other boards without
// restriction (see pakkei0712* events on 2007/12)
- // for (1) increase numpost (2) flood target board
+ // for (1) increase numpost (2) flood target board
// (3) flood original post
// You must have post permission on current board
//
- if( (bp->brdattr & BRD_CPLOG) &&
+ if( (bp->brdattr & BRD_CPLOG) &&
(!CheckPostPerm() || !CheckPostRestriction(currbid)))
{
vmsg("由本板轉錄文章需有發文權限(可按 i 查看限制)");
@@ -2066,7 +2066,7 @@ cross_post(int ent, fileheader_t * fhdr, const char *direct)
#ifdef USE_POSTRECORD
if (postrecord.times > 0) {
- outs(ANSI_COLOR(1;31)
+ outs(ANSI_COLOR(1;31)
"請注意: 1.在不同看板多次重覆發表或轉錄相似內容之文章,屬 Cross-post(CP)違規\n"
" 一般而言(詳見各站規板規)連原文共超過四篇就可能會被檢舉。\n"
" 2.被檢舉 Cross-post 時,分身帳號或不同ID但上線位址(IP)相同者\n"
@@ -2121,11 +2121,11 @@ cross_post(int ent, fileheader_t * fhdr, const char *direct)
// quick check: if already cross-posted, reject.
if (hashPost == postrecord.checksum[0])
{
- if (xbid == postrecord.last_bid)
+ if (xbid == postrecord.last_bid)
{
vmsg("這篇文章已經轉錄過了。");
return FULLUPDATE;
- }
+ }
else if (postrecord.times >= MAX_CROSSNUM)
{
anticrosspost();
@@ -2296,17 +2296,17 @@ cross_post(int ent, fileheader_t * fhdr, const char *direct)
#ifdef NOTIFY_BM_CP_IGNORE
// ignore BM for cross-posting.
outs(ANSI_COLOR(1;32)
- "此篇為板主轉錄,不自動檢查CP(但請小心誤觸人工檢舉)\n"
+ "此篇為板主轉錄,不自動檢查CP(但請小心誤觸人工檢舉)\n"
ANSI_RESET);
#endif
#ifdef USE_POSTRECORD
} else if (!HasUserPerm(PERM_ADMIN | PERM_MANAGER) &&
- hashPost == postrecord.checksum[0])
+ hashPost == postrecord.checksum[0])
// && xbid != postrecord.last_bid)
{
++postrecord.times; // check will be done next time.
- if (postrecord.times +1 >= MAX_CROSSNUM)
+ if (postrecord.times +1 >= MAX_CROSSNUM)
{
outs(ANSI_COLOR(1;31) " 警告: 即將達到轉錄次數上限,"
"之後可能開罰單!\n" ANSI_RESET);
@@ -2434,8 +2434,8 @@ editLimits(unsigned char *plogins,
int temp, y;
// load var
- unsigned char
- logins = *plogins,
+ unsigned char
+ logins = *plogins,
badpost = *pbadpost;
// query UI
@@ -2444,7 +2444,7 @@ editLimits(unsigned char *plogins,
y++;
move(y+2, 0); clrtobot();
- outs(ANSI_COLOR(1;32)
+ outs(ANSI_COLOR(1;32)
"請注意「註冊時間」已被取消(由" STR_LOGINDAYS "取代),若您收到的修改請求\n"
"仍有該數值,請重新向提出申請者確認。 另外請注意這是一天一次計算,不是\n"
"舊的上站次數。 有的板主可能拿舊的上站次數來申請,造成使用者忽然無法發文\n"
@@ -2453,7 +2453,7 @@ editLimits(unsigned char *plogins,
sprintf(genbuf, "%u", logins*10);
do {
- getdata_buf(y, 0,
+ getdata_buf(y, 0,
STR_LOGINDAYS "下限 (0~2550,以10為單位,個位數字將自動捨去):",
genbuf, 5, NUMECHO);
temp = atoi(genbuf);
@@ -2461,10 +2461,10 @@ editLimits(unsigned char *plogins,
logins = (unsigned char)(temp / 10);
move(y+1, 0); clrtobot();
- y++;
+ y++;
sprintf(genbuf, "%u", 255 - badpost);
do {
- getdata_buf(y, 0,
+ getdata_buf(y, 0,
"劣文篇數上限 (0~255):", genbuf, 5, NUMECHO);
temp = atoi(genbuf);
} while (temp < 0 || temp > 255);
@@ -2485,7 +2485,7 @@ do_limitedit(int ent, fileheader_t * fhdr, const char *direct)
if (!((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP) ||
(HasUserPerm(PERM_SYSSUPERSUBOP) && GROUPOP())))
return DONOTHING;
-
+
strcpy(buf, "更改 ");
if (HasUserPerm(PERM_SYSOP) || (HasUserPerm(PERM_SYSSUPERSUBOP) && GROUPOP()))
strcat(buf, "(A)本板發表限制 ");
@@ -2560,7 +2560,7 @@ b_man(void)
}
return a_menu(currboard, apath,HasUserPerm(PERM_ALLBOARD) ? 2 :
- (currmode & MODE_BOARD ? 1 : 0),
+ (currmode & MODE_BOARD ? 1 : 0),
currbid, // getbnum(currboard)?
NULL, backup_path);
}
@@ -2613,7 +2613,7 @@ edit_title(int ent, fileheader_t * fhdr, const char *direct)
dirty++;
}
- if (allow >= 2)
+ if (allow >= 2)
{
if (getdata(b_lines - 1, 0, "作者:", genbuf, IDLEN + 2, DOECHO)) {
strlcpy(tmpfhdr.owner, genbuf, sizeof(tmpfhdr.owner));
@@ -2683,7 +2683,7 @@ recommend_cancel(int ent, fileheader_t * fhdr, const char *direct)
{
move(b_lines-2, 0); clrtoeol();
outs("超過兩週,禁止劣推文。");
- } else
+ } else
#endif
{
getdata(b_lines - 1, 0, "請問您要 (1) 推薦歸零 (2) 劣推文 [1/2]? ", yn, 3, LCECHO);
@@ -2807,7 +2807,7 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
char mynick[IDLEN+1];
#ifndef OLDRECOMMEND
static const char *ctype[RECTYPE_SIZE] = {
- "推", "噓", "→",
+ "推", "噓", "→",
};
static const char *ctype_attr[RECTYPE_SIZE] = {
ANSI_COLOR(1;33),
@@ -2838,7 +2838,7 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
assert(0<=currbid-1 && currbid-1<MAX_BOARD);
bp = getbcache(currbid);
- if (bp->brdattr & BRD_NORECOMMEND || fhdr->filename[0] == 'L' ||
+ if (bp->brdattr & BRD_NORECOMMEND || fhdr->filename[0] == 'L' ||
((fhdr->filemode & FILE_MARKED) && (fhdr->filemode & FILE_SOLVED))) {
vmsg("抱歉, 禁止推薦");
return FULLUPDATE;
@@ -2884,8 +2884,8 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
if((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP))
{
/* I'm BM or SYSOP. */
- }
- else if (bp->brdattr & BRD_NOFASTRECMD)
+ }
+ else if (bp->brdattr & BRD_NOFASTRECMD)
{
int d = (int)bp->fastrecommend_pause - (now - lastrecommend);
if (d > 0)
@@ -2928,7 +2928,7 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
}
}
}
-
+
#ifdef USE_COOLDOWN
if(check_cooldown(bp))
@@ -2963,11 +2963,11 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
}
#ifndef DEBUG
- else if (!(currmode & MODE_BOARD) &&
+ else if (!(currmode & MODE_BOARD) &&
(now - lastrecommend) < (
#if 0
/* i'm not sure whether this is better or not */
- (bp->brdattr & BRD_NOFASTRECMD) ?
+ (bp->brdattr & BRD_NOFASTRECMD) ?
bp->fastrecommend_pause :
#endif
90))
@@ -3022,8 +3022,8 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
if (strchr(fhdr->owner, '.') != NULL)
{
move(ymsg--, 0); clrtoeol();
- outs(ANSI_COLOR(1;31)
- "◆這篇文章來自匿名板或外站轉信板,原作者可能無法看到推文。"
+ outs(ANSI_COLOR(1;31)
+ "◆這篇文章來自匿名板或外站轉信板,原作者可能無法看到推文。"
ANSI_RESET "\n");
}
@@ -3035,9 +3035,9 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
{
ymsg --;
move(ymsg--, 0); clrtoeol();
- outs(ANSI_COLOR(1;33)
+ outs(ANSI_COLOR(1;33)
"◆您正在搜尋(標題、作者...)或其它特殊列表模式,"
- "推文計數與修改記錄將會分開計算。"
+ "推文計數與修改記錄將會分開計算。"
ANSI_RESET "\n"
" 若想正常計數請先左鍵退回正常列表模式。\n");
}
@@ -3046,9 +3046,9 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
if(type > RECTYPE_MAX || type < 0)
type = RECTYPE_ARROW;
- maxlength = 78 -
- 3 /* lead */ -
- 6 /* date */ -
+ maxlength = 78 -
+ 3 /* lead */ -
+ 6 /* date */ -
1 /* space */ -
6 /* time */;
@@ -3067,7 +3067,7 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
angel_load_my_fullnick(mynick, sizeof(mynick));
myid = mynick;
}
-#endif
+#endif
if (aligncmt)
{
@@ -3084,7 +3084,7 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
#else // !OLDRECOMMEND
maxlength -= strlen(myid);
- sprintf(buf, "%s%s%s %s:",
+ sprintf(buf, "%s%s%s %s:",
ctype_attr[type], ctype[type], ANSI_RESET, myid);
#endif // !OLDRECOMMEND
@@ -3098,8 +3098,8 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
{
// to hold ':wq', ':q!' 'ZZ'
char ans[2];
- sprintf(buf+strlen(buf),
- ANSI_REVERSE "%-*s" ANSI_RESET " 確定[y/N]:",
+ sprintf(buf+strlen(buf),
+ ANSI_REVERSE "%-*s" ANSI_RESET " 確定[y/N]:",
maxlength, msg);
move(b_lines, 0);
clrtoeol();
@@ -3113,7 +3113,7 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
return FULLUPDATE;
}
LOG_IF(LOG_CONF_PUSH, log_filef("log/push", LOG_CREAT,
- "%s %d %s %s %s\n", cuser.userid,
+ "%s %d %s %s %s\n", cuser.userid,
(int)now, currboard, fhdr->filename, msg));
STATINC(STAT_RECOMMEND);
{
@@ -3124,7 +3124,7 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
{
snprintf(tail, sizeof(tail),
"%15s %s",
- FROMHOST,
+ FROMHOST,
Cdate_mdHM(&now));
} else {
snprintf(tail, sizeof(tail),
@@ -3134,15 +3134,15 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
#ifdef OLDRECOMMEND
snprintf(buf, sizeof(buf),
- ANSI_COLOR(1;31) "→ " ANSI_COLOR(33) "%s"
+ ANSI_COLOR(1;31) "→ " ANSI_COLOR(33) "%s"
ANSI_RESET ANSI_COLOR(33) ":%-*s" ANSI_RESET
"推%s\n",
myid, maxlength, msg, tail);
#else
snprintf(buf, sizeof(buf),
- "%s%s " ANSI_COLOR(33) "%s" ANSI_RESET ANSI_COLOR(33)
+ "%s%s " ANSI_COLOR(33) "%s" ANSI_RESET ANSI_COLOR(33)
":%-*s" ANSI_RESET "%s\n",
- ctype_attr2[type], ctype[type], myid,
+ ctype_attr2[type], ctype[type], myid,
maxlength, msg, tail);
#endif // OLDRECOMMEND
}
@@ -3195,7 +3195,7 @@ del_range(int ent GCC_UNUSED, const fileheader_t *fhdr GCC_UNUSED,
int is_board = (*direct == 'b'),
// is_home = (*direct == 'h'),
is_man = (*direct == 'm');
-
+
#ifdef SAFE_ARTICLE_DELETE
int use_safe_delete = 0;
@@ -3294,7 +3294,7 @@ del_range(int ent GCC_UNUSED, const fileheader_t *fhdr GCC_UNUSED,
bypass = "子目錄";
}
}
-
+
if (bypass) {
id++;
mvprints(b_lines-1, 0, "跳過%s: %s\n", bypass, fh->title);
@@ -3378,12 +3378,12 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
return DONOTHING;
/* TODO recursive lookup */
- if (currmode & MODE_SELECT) {
+ if (currmode & MODE_SELECT) {
vmsg("請回到一般模式再刪除文章");
return DONOTHING;
}
- if ((fhdr->filemode & FILE_BOTTOM) ||
+ if ((fhdr->filemode & FILE_BOTTOM) ||
(fhdr->filemode & FILE_MARKED) || (fhdr->filemode & FILE_DIGEST) ||
(fhdr->owner[0] == '-'))
return DONOTHING;
@@ -3411,7 +3411,7 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
if (!HasUserPerm(PERM_BASIC) || // including guests
!( (currmode & MODE_DIGEST) ? (currmode & MODE_BOARD) : CheckPostPerm() ) || // allow BM to delete posts in digest mode
!CheckPostRestriction(currbid)
- )
+ )
return DONOTHING;
if ((bp->brdattr & BRD_NOSELFDELPOST) && !(currmode & MODE_BOARD)) {
@@ -3434,10 +3434,10 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
break;
// build reason string (based on STR_SAFEDEL_TITLE)
- snprintf(reason, sizeof(reason), "(已被%s刪除) <%s>",
+ snprintf(reason, sizeof(reason), "(已被%s刪除) <%s>",
cuser.userid, fhdr->owner);
move(3, 0); clrtoeol();
- getdata_str(2, 0, " >> 請輸入刪除後要顯示的標題: □ ",
+ getdata_str(2, 0, " >> 請輸入刪除後要顯示的標題: □ ",
reason, sizeof(reason), DOECHO, reason);
if (!reason[0])
@@ -3449,12 +3449,12 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
// confirm again!
move(4, 0); clrtoeol();
- getdata(3, 0, "請再次確定是否要用上述理由刪除(Y/N)?[N]",
+ getdata(3, 0, "請再次確定是否要用上述理由刪除(Y/N)?[N]",
genbuf, 3, LCECHO);
// since the default y/n is same to msg_del_ny, we reuse the genbuf[0] here.
} while (0);
- } else
+ } else
#endif
{
getdata(1, 0, msg_del_ny, genbuf, 3, LCECHO);
@@ -3471,8 +3471,8 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
// DIGEST mode 不用管
// INVALIDMONEY_MODES (FILE_BID, FILE_ANONYMOUS, ...) 也都不用扣
// also check MAX_POST_MONEY in case any error made bad money...
- if (del_fee < 0 ||
- IsFreeBoardName(currboard) ||
+ if (del_fee < 0 ||
+ IsFreeBoardName(currboard) ||
(currbrdattr & BRD_NOCREDIT) ||
(currmode & MODE_DIGEST) ||
(fhdr->filemode & INVALIDMONEY_MODES) ||
@@ -3518,7 +3518,7 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
"若持續發生請向" BN_BUGREPORT "報告\n");
}
if (del_ret == DELETE_FILE_CONTENT_BACKUP_FAILED) {
- outs(" " ANSI_COLOR(1;31) "* 檔案備份失敗,請至 "
+ outs(" " ANSI_COLOR(1;31) "* 檔案備份失敗,請至 "
BN_BUGREPORT "報告" ANSI_RESET "\n");
}
#ifdef ASSESS
@@ -3569,26 +3569,26 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
passwd_sync_update(tusernum, &xuser);
}
- pay_as_uid(tusernum, del_fee,
- "%s 看板 文章「%s」被%s,扣除稿酬%s %s",
- currboard, fhdr->title,
- as_badpost ? "劣退" : "刪除",
- reason[0] ? "。原因:" : "", reason);
+ pay_as_uid(tusernum, del_fee,
+ "%s 看板 文章「%s」被%s,扣除稿酬%s %s",
+ currboard, fhdr->title,
+ as_badpost ? "劣退" : "刪除",
+ reason[0] ? "。原因:" : "", reason);
sendalert_uid(tusernum, ALERT_PWD_PERM);
#ifdef USE_COOLDOWN
if (bp->brdattr & BRD_COOLDOWN)
add_cooldowntime(tusernum, 15);
#endif
}
- }
+ }
else
{
// owner case
pwcuDecNumPost();
- pay(del_fee, "%s 看板 文章自刪清潔費: %s",
- currboard, fhdr->title);
+ pay(del_fee, "%s 看板 文章自刪清潔費: %s",
+ currboard, fhdr->title);
sendalert(cuser.userid, ALERT_PWD_PERM);
- prints("您的文章減為 %d 篇,支付清潔費 %d " MONEYNAME "\n",
+ prints("您的文章減為 %d 篇,支付清潔費 %d " MONEYNAME "\n",
cuser.numposts, del_fee);
}
pressanykey();
@@ -3601,7 +3601,7 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
return FULLUPDATE;
}
-static int // Ptt: 修石頭文
+static int // Ptt: 修石頭文
show_filename(int ent GCC_UNUSED, const fileheader_t * fhdr,
const char *direct GCC_UNUSED)
{
@@ -3618,7 +3618,7 @@ lock_post(int ent, fileheader_t * fhdr, const char *direct)
char genbuf[PATHLEN] = "";
int i;
boardheader_t *bp = NULL;
-
+
if (currstat == RMAIL)
return DONOTHING;
@@ -3684,7 +3684,7 @@ lock_post(int ent, fileheader_t * fhdr, const char *direct)
syncnow();
bp->SRexpire = now;
return FULLUPDATE;
-}
+}
static int
view_postinfo(int ent GCC_UNUSED, const fileheader_t * fhdr,
@@ -3720,7 +3720,7 @@ view_postinfo(int ent GCC_UNUSED, const fileheader_t * fhdr,
move(area_l-(area_l < l), 0);
clrtoln(area_l -(area_l < l) + area_lines+1);
outc(' '); outs(ANSI_CLRTOEND);
- move(area_l -(area_l < l) + area_lines, 0);
+ move(area_l -(area_l < l) + area_lines, 0);
outc(' '); outs(ANSI_CLRTOEND);
move(area_l, 0);
@@ -3733,10 +3733,10 @@ view_postinfo(int ent GCC_UNUSED, const fileheader_t * fhdr,
{
char aidc[10];
int y, x;
-
+
aidu2aidc(aidc, aidu);
- prints("│ " AID_DISPLAYNAME ": "
- ANSI_COLOR(1) "#%s" ANSI_RESET " (%s) [%s] ",
+ prints("│ " AID_DISPLAYNAME ": "
+ ANSI_COLOR(1) "#%s" ANSI_RESET " (%s) [%s] ",
aidc, currboard && currboard[0] ? currboard : "未知",
AID_HOSTNAME);
getyx_ansi(&y, &x);
@@ -3768,7 +3768,7 @@ view_postinfo(int ent GCC_UNUSED, const fileheader_t * fhdr,
if (!bp)
{
prints("│\n");
- }
+ }
else if ((bp->brdattr & (BRD_HIDE | BRD_OVER18)) ||
#ifdef BN_ALLPOST
strcmp(bp->brdname, BN_ALLPOST) == 0 ||
@@ -3785,7 +3785,7 @@ view_postinfo(int ent GCC_UNUSED, const fileheader_t * fhdr,
}
else
{
- prints("│ " URL_DISPLAYNAME ": "
+ prints("│ " URL_DISPLAYNAME ": "
ANSI_COLOR(1) URL_PREFIX "/%s/%s.html" ANSI_RESET "\n",
currboard, fhdr->filename);
}
@@ -3827,7 +3827,7 @@ view_postinfo(int ent GCC_UNUSED, const fileheader_t * fhdr,
{
currlistmode = (currlistmode == LISTMODE_MONEY) ?
LISTMODE_DATE : LISTMODE_MONEY;
- vmsg((currlistmode == LISTMODE_MONEY) ?
+ vmsg((currlistmode == LISTMODE_MONEY) ?
"開啟文章價格列表模式" : "停止列出文章價格");
}
}
@@ -3886,7 +3886,7 @@ view_posthistory(int ent GCC_UNUSED, const fileheader_t * fhdr, const char *dire
return FULLUPDATE;
}
- if (RET_RECYCLEBIN ==
+ if (RET_RECYCLEBIN ==
psb_view_edit_history(fpath, fhdr->title, maxrev, current_as_base))
psb_recycle_bin(direct, currboard);
return FULLUPDATE;
@@ -3993,7 +3993,7 @@ b_note_edit_bname(int bid)
"\t(使用者隨時可按 b 或經由進出不同看板來重新顯示進板畫面)\n");
// 設定日期的效果其實很早就不會動了,所以拔掉
- snprintf(msg, sizeof(msg),
+ snprintf(msg, sizeof(msg),
"要在首次進入看板時顯示進板畫面嗎? (y/n) [%c]: ",
fh->bupdate ? 'Y' : 'N');
getdata(10, 0, msg, buf, 3, LCECHO);
@@ -4111,7 +4111,7 @@ push_bottom(int ent, fileheader_t *old_fhdr, const char *direct)
fhdr.filemode ^= FILE_BOTTOM;
fhdr.multi.refer.flag = 1;
fhdr.multi.refer.ref = ent;
- append_record(buf, &fhdr, sizeof(fileheader_t));
+ append_record(buf, &fhdr, sizeof(fileheader_t));
// make sure original one won't be deleted... add 'm'.
if (!(old_fhdr->filemode & FILE_MARKED))
mark_post(ent, old_fhdr, direct);
@@ -4134,24 +4134,24 @@ good_post(int ent, fileheader_t * fhdr, const char *direct)
if ((currmode & MODE_DIGEST) || !(currmode & MODE_BOARD))
return DONOTHING;
- if(vans(fhdr->filemode & FILE_DIGEST ?
+ if(vans(fhdr->filemode & FILE_DIGEST ?
"取消看板文摘?(Y/n)" : "收入看板文摘?(Y/n)") == 'n')
return READ_REDRAW;
if (fhdr->filemode & FILE_DIGEST) {
fhdr->filemode = (fhdr->filemode & ~FILE_DIGEST);
- if (!strcmp(currboard, BN_NOTE) ||
-#ifdef BN_ARTDSN
- !strcmp(currboard, BN_ARTDSN) ||
+ if (!strcmp(currboard, BN_NOTE) ||
+#ifdef BN_ARTDSN
+ !strcmp(currboard, BN_ARTDSN) ||
#endif
!strcmp(currboard, BN_BUGREPORT) ||
!strcmp(currboard, BN_LAW)
- )
+ )
{
- int unum = searchuser(fhdr->owner, NULL);
- if (unum > 0) {
- pay_as_uid(unum, 1000, "取消 %s 看板文摘", currboard);
- }
+ int unum = searchuser(fhdr->owner, NULL);
+ if (unum > 0) {
+ pay_as_uid(unum, 1000, "取消 %s 看板文摘", currboard);
+ }
if (!(currmode & MODE_SELECT))
fhdr->multi.money -= 1000;
}
@@ -4178,18 +4178,18 @@ good_post(int ent, fileheader_t * fhdr, const char *direct)
append_record(buf, &digest, sizeof(digest));
fhdr->filemode = (fhdr->filemode & ~FILE_MARKED) | FILE_DIGEST;
- if (!strcmp(currboard, BN_NOTE) ||
-#ifdef BN_ARTDSN
- !strcmp(currboard, BN_ARTDSN) ||
+ if (!strcmp(currboard, BN_NOTE) ||
+#ifdef BN_ARTDSN
+ !strcmp(currboard, BN_ARTDSN) ||
#endif
!strcmp(currboard, BN_BUGREPORT) ||
!strcmp(currboard, BN_LAW)
- )
+ )
{
- int unum = searchuser(fhdr->owner, NULL);
- if (unum > 0) {
- pay_as_uid(unum, -1000, "被選入 %s 看板文摘", currboard);
- }
+ int unum = searchuser(fhdr->owner, NULL);
+ if (unum > 0) {
+ pay_as_uid(unum, -1000, "被選入 %s 看板文摘", currboard);
+ }
if (!(currmode & MODE_SELECT))
fhdr->multi.money += 1000;
}
@@ -4243,7 +4243,7 @@ b_mark_read_unread(int ent GCC_UNUSED, const fileheader_t * fhdr,
int check_cooldown(boardheader_t *bp)
{
- int diff = cooldowntimeof(usernum) - now;
+ int diff = cooldowntimeof(usernum) - now;
int i, limit[8] = {4000,1,2000,2,1000,3,-1,10};
if(diff<0)
@@ -4266,7 +4266,7 @@ int check_cooldown(boardheader_t *bp)
for(i=0; i<4; i++)
if(bp->nuser>limit[i*2] && posttimesof(usernum)>=limit[i*2+1])
{
- vmsgf("對不起,您的文章或推文間隔太近囉! (限制 %d 分 %d 秒)",
+ vmsgf("對不起,您的文章或推文間隔太近囉! (限制 %d 分 %d 秒)",
diff/60, diff%60);
return 1;
}
@@ -4283,8 +4283,8 @@ change_cooldown(void)
{
char genbuf[256] = {'\0'};
boardheader_t *bp = getbcache(currbid);
-
- if (!(HasUserPerm(PERM_SYSOP | PERM_POLICE) ||
+
+ if (!(HasUserPerm(PERM_SYSOP | PERM_POLICE) ||
(HasUserPerm(PERM_SYSSUPERSUBOP) && GROUPOP())))
return DONOTHING;
@@ -4323,7 +4323,7 @@ b_moved_to_config()
/* ----------------------------------------------------- */
/* onekey_size was defined in ../include/pttstruct.h, as ((int)'z') */
const onekey_t read_comms[] = {
- { 1, show_filename }, // Ctrl('A')
+ { 1, show_filename }, // Ctrl('A')
{ 0, NULL }, // Ctrl('B')
{ 0, NULL }, // Ctrl('C')
{ 0, NULL }, // Ctrl('D')
@@ -4392,7 +4392,7 @@ const onekey_t read_comms[] = {
{ 1, recommend }, // 'X'
{ 1, recommend_cancel }, // 'Y'
{ 0, NULL }, // 'Z' 90
- { 0, NULL }, { 0, NULL }, { 0, NULL }, { 0, NULL },
+ { 0, NULL }, { 0, NULL }, { 0, NULL }, { 0, NULL },
{ 1, push_bottom }, // '_' 95
{ 0, NULL },
{ 0, NULL }, // 'a' 97
diff --git a/pttbbs/mbbsd/bbslua.c b/pttbbs/mbbsd/bbslua.c
index 713eaf21..2f417850 100644
--- a/pttbbs/mbbsd/bbslua.c
+++ b/pttbbs/mbbsd/bbslua.c
@@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////////////////////
// BBS-Lua Project
//
-// Author: Hung-Te Lin(piaip), Jan. 2008.
+// Author: Hung-Te Lin(piaip), Jan. 2008.
// <piaip@csie.ntu.edu.tw>
// Create: 2008-01-04 22:02:58
// $Id$
@@ -29,7 +29,7 @@
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
+// SOFTWARE.
//
// TODO:
// BBSLUA 1.0
@@ -49,7 +49,7 @@
//
// BBSLUA 2.0
// 1. 2 people communication
-//
+//
// BBSLUA 3.0
// 1. n people communication
//////////////////////////////////////////////////////////////////////////
@@ -138,7 +138,7 @@ typedef struct {
} BBSLuaRT;
// runtime information
-// static
+// static
BBSLuaRT blrt = {0};
#define BL_INIT_RUNTIME() { \
@@ -441,7 +441,7 @@ bl_getstr(lua_State* L)
return lua_yield(L, 0);
}
lua_pushstring(L, "");
- }
+ }
else
{
lua_pushstring(L, buf);
@@ -455,7 +455,7 @@ bl_kbhit(lua_State *L)
{
int n = lua_gettop(L);
double f = 0.1f;
-
+
if (n > 0)
f = (double)lua_tonumber(L, 1);
@@ -646,7 +646,7 @@ bl_attrset(lua_State *L)
outs(ANSI_RESET);
for (i = 1; i <= n; i++)
{
- sprintf(p, "%dm",(int)lua_tointeger(L, i));
+ sprintf(p, "%dm",(int)lua_tointeger(L, i));
outs(buf);
}
return 0;
@@ -712,7 +712,7 @@ bls_getcat(const char *s)
return BLS_INVALID;
}
-static int
+static int
bls_getlimit(const char *p)
{
switch(bls_getcat(p))
@@ -725,14 +725,14 @@ bls_getlimit(const char *p)
return 0;
}
-static int
+static int
bls_setfn(char *fn, size_t sz, const char *p)
{
*fn = 0;
switch(bls_getcat(p))
{
case BLS_GLOBAL:
- snprintf(fn, sz, "%s/" BLSCONF_PREFIX "U%08x",
+ snprintf(fn, sz, "%s/" BLSCONF_PREFIX "U%08x",
BLSCONF_GPATH, blrt.storename);
return 1;
@@ -789,9 +789,9 @@ bls_load(lua_State *L)
}
cat = lua_tostring(L, 1); // category
if (!cat)
- {
+ {
lua_pushnil(L);
- return 1;
+ return 1;
}
blrt.iocounter++;
@@ -838,10 +838,10 @@ bls_save(lua_State *L)
s = lua_tostring(L, 2); // data
limit = bls_getlimit(cat);
- if (!cat || !s || limit < 1)
- {
- lua_pushboolean(L, 0);
- return 1;
+ if (!cat || !s || limit < 1)
+ {
+ lua_pushboolean(L, 0);
+ return 1;
}
slen = lua_objlen(L, 2);
@@ -929,7 +929,7 @@ static const luaL_Reg bbslualibs[] = {
{LUA_STRLIBNAME, luaopen_string},
{LUA_MATHLIBNAME, luaopen_math},
// {LUA_DBLIBNAME, luaopen_debug},
-
+
// bbslua-ext modules
{"bit", luaopen_bit},
@@ -1042,7 +1042,7 @@ bbsluaHook(lua_State *L, lua_Debug* ar)
vkey_purge();
// refresh();
-
+
// check if input key is system break key.
if (bl_peekbreak(BLCONF_PEEK_TIME))
{
@@ -1051,7 +1051,7 @@ bbsluaHook(lua_State *L, lua_Debug* ar)
}
}
-static char *
+static char *
bbslua_attach(const char *fpath, size_t *plen)
{
char *buf = NULL;
@@ -1073,7 +1073,7 @@ bbslua_attach(const char *fpath, size_t *plen)
buf = mmap(NULL, *plen, PROT_READ, MAP_SHARED, fd, 0);
close(fd);
- if (buf == NULL || buf == MAP_FAILED)
+ if (buf == NULL || buf == MAP_FAILED)
{
*plen = 0;
return NULL;
@@ -1196,7 +1196,7 @@ static const char *bbsluaTocTags[] =
NULL
};
-static const char *bbsluaTocPrompts[] =
+static const char *bbsluaTocPrompts[] =
{
"界面版本",
"最新版本",
@@ -1248,7 +1248,7 @@ bbslua_load_TOC(lua_State *L, const char *bs, const char *be, char **ppc)
ps += l;
// found matching pattern, now find value
while (ps < pe && *ps <= ' ') ps++;
- if (ps >= pe || *ps++ != ':')
+ if (ps >= pe || *ps++ != ':')
break;
while (ps < pe && *ps <= ' ') ps++;
// finally, (ps, pe) is the value!
@@ -1276,7 +1276,7 @@ bbslua_load_TOC(lua_State *L, const char *bs, const char *be, char **ppc)
return 0;
}
-static void
+static void
fullmsg(const char *s)
{
clrtoeol();
@@ -1320,11 +1320,11 @@ bbslua_logo(lua_State *L)
fullmsg(" ▲ 此程式缺少相容性資訊,您可能無法正常執行");
fullmsg(" 若執行出現錯誤,請向原作者取得新版");
fullmsg("");
- }
+ }
else if (tocinterface > BBSLUA_INTERFACE_VER)
{
by -= 4; y = by+2;
- move(y-1, 0);
+ move(y-1, 0);
outs(ANSI_COLOR(0;1;37;41));
fullmsg("");
snprintf(msg, sizeof(msg),
@@ -1337,8 +1337,8 @@ bbslua_logo(lua_State *L)
else if (tocinterface == BBSLUA_INTERFACE_VER)
{
// do nothing!
- }
- else
+ }
+ else
{
// should be comtaible
// prints("相容 (%.03f)", tocinterface);
@@ -1362,7 +1362,7 @@ bbslua_logo(lua_State *L)
lua_pop(L, 1);
continue;
}
- move(++y, 0);
+ move(++y, 0);
snprintf(msg, sizeof(msg), " %s: %-.*s",
bbsluaTocPrompts[i], STRLEN-12, lua_tostring(L, -1));
msg[sizeof(msg)-1] = 0;
@@ -1383,7 +1383,7 @@ bbslua_logo(lua_State *L)
// system break key prompt
{
int sz = t_columns -1;
- const char
+ const char
*prompt1 = " 提醒您執行中隨時可按 ",
*prompt2 = "[Ctrl-C]",
*prompt3 = " 強制中斷 BBS-Lua 程式";
@@ -1472,7 +1472,7 @@ static int panic (lua_State *L) {
return 0;
}
-void bbslua_loadLatest(lua_State *L,
+void bbslua_loadLatest(lua_State *L,
char **pbs, char **pps, char **ppe, char **ppc, int *psz,
int *plineshift, char *bfpath, const char **pfpath)
{
@@ -1547,7 +1547,7 @@ void bbslua_loadLatest(lua_State *L,
// XXX fpath=bfpath, supporting only one level redirection now.
*pfpath = bfpath;
}
- *pbs = xbs; *pps = xps; *ppe = xpe; *psz = xsz;
+ *pbs = xbs; *pps = xps; *ppe = xpe; *psz = xsz;
*ppc = xpc;
*plineshift = xlineshift;
@@ -1581,7 +1581,7 @@ void bbslua_loadLatest(lua_State *L,
strlcpy(bn, lastref, sizeof(bn));
// truncate board name
// (not_alnum(ch) && ch != '_' && ch != '-' && ch != '.')
- while (*p &&
+ while (*p &&
(isalnum(*p) || *p == '_' || *p == '-' || *p == '.')) p++;
*p = 0;
if (bn[0])
@@ -1608,7 +1608,7 @@ void bbslua_loadLatest(lua_State *L,
//////////////////////////////////////////////////////////////////////////
#if 0
-static int
+static int
bbslua_hashWriter(lua_State *L, const void *p, size_t sz, void *ud)
{
Fnv32_t *phash = (Fnv32_t*) ud;
@@ -1616,7 +1616,7 @@ bbslua_hashWriter(lua_State *L, const void *p, size_t sz, void *ud)
return 0;
}
-static Fnv32_t
+static Fnv32_t
bbslua_f2hash(lua_State *L)
{
Fnv32_t fnvseed = FNV1_32_INIT;
@@ -1624,7 +1624,7 @@ bbslua_f2hash(lua_State *L)
return fnvseed;
}
-static Fnv32_t
+static Fnv32_t
bbslua_str2hash(const char *str)
{
if (!str)
@@ -1633,7 +1633,7 @@ bbslua_str2hash(const char *str)
}
#endif
-static Fnv32_t
+static Fnv32_t
bbslua_path2hash(const char *path)
{
Fnv32_t seed = FNV1_32_INIT;
@@ -1713,7 +1713,7 @@ bbslua(const char *fpath)
// load script
r = bbslua_loadbuffer(L, ps, pe-ps, "BBS-Lua", lineshift);
-
+
// build hash or store name
blrt.storename = bbslua_path2hash(fpath);
// vmsgf("BBS-Lua Hash: %08X", blrt.storename);
@@ -1782,7 +1782,7 @@ bbslua(const char *fpath)
// grayout(0, b_lines, GRAYOUT_DARK);
move(b_lines, 0); clrtoeol();
- vmsgf("BBS-Lua 執行結束%s。",
+ vmsgf("BBS-Lua 執行結束%s。",
blrt.abort ? " (使用者中斷)" : r ? " (程式錯誤)" : "");
BL_END_RUNTIME();
clear();
diff --git a/pttbbs/mbbsd/board.c b/pttbbs/mbbsd/board.c
index 2bbb7710..26da4923 100644
--- a/pttbbs/mbbsd/board.c
+++ b/pttbbs/mbbsd/board.c
@@ -130,7 +130,7 @@ static void imovefav(int old)
{
char buf[5];
int new;
-
+
getdata(b_lines - 1, 0, "請輸入新次序:", buf, sizeof(buf), DOECHO);
new = atoi(buf) - 1;
if (new < 0 || brdnum <= new){
@@ -166,7 +166,7 @@ HasBoardPerm(boardheader_t *bptr)
return 1;
// allow POLICE to enter BM boards
- if ((level & PERM_BM) &&
+ if ((level & PERM_BM) &&
(HasUserPerm(PERM_POLICE) || HasUserPerm(PERM_POLICE_MAN)))
return 1;
@@ -296,7 +296,7 @@ b_posttype()
// TODO last chance to confirm.
assert(0<=currbid-1 && currbid-1<MAX_BOARD);
if (bp->posttype_f != posttype_f) {
- bp->posttype_f = posttype_f;
+ bp->posttype_f = posttype_f;
modified = 1;
}
if (strcmp(bp->posttype, posttype) != 0) {
@@ -320,8 +320,8 @@ b_config(void)
int i = 0, attr = 0, ipostres;
char isBM = (currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP);
// perm cache
- char hasres = 0,
- cachePostPerm = CheckPostPerm(),
+ char hasres = 0,
+ cachePostPerm = CheckPostPerm(),
cachePostRes = CheckPostRestriction(currbid);
char canpost = (cachePostPerm && cachePostRes);
@@ -331,7 +331,7 @@ b_config(void)
int ytitle = b_lines - LNBOARDINFO;
- bp = getbcache(currbid);
+ bp = getbcache(currbid);
#ifdef OLDRECOMMEND
ytitle ++;
@@ -351,7 +351,7 @@ b_config(void)
uint8_t llogin = bp->post_limit_logins,
lbp = bp->post_limit_badpost;
- move(ytitle-1, 0);
+ move(ytitle-1, 0);
clrtobot();
// outs(MSG_SEPARATOR); // deprecated by grayout
@@ -365,45 +365,45 @@ b_config(void)
outs(" \n"); // at least one character, for move_ansi.
- prints( " " ANSI_COLOR(1;36) "h" ANSI_RESET
- " - 公開狀態(是否隱形): %s " ANSI_RESET "\n",
- (bp->brdattr & BRD_HIDE) ?
+ prints( " " ANSI_COLOR(1;36) "h" ANSI_RESET
+ " - 公開狀態(是否隱形): %s " ANSI_RESET "\n",
+ (bp->brdattr & BRD_HIDE) ?
ANSI_COLOR(1;31)"隱形":"公開");
- prints( " " ANSI_COLOR(1;36) "g" ANSI_RESET
- " - 隱板時 %s 進入十大排行榜" ANSI_RESET "\n",
- (bp->brdattr & BRD_BMCOUNT) ?
+ prints( " " ANSI_COLOR(1;36) "g" ANSI_RESET
+ " - 隱板時 %s 進入十大排行榜" ANSI_RESET "\n",
+ (bp->brdattr & BRD_BMCOUNT) ?
ANSI_COLOR(1)"可以" ANSI_RESET: "不可");
- prints( " " ANSI_COLOR(1;36) "e" ANSI_RESET
- " - %s "ANSI_RESET "非看板會員發文\n",
- (bp->brdattr & BRD_RESTRICTEDPOST) ?
+ prints( " " ANSI_COLOR(1;36) "e" ANSI_RESET
+ " - %s "ANSI_RESET "非看板會員發文\n",
+ (bp->brdattr & BRD_RESTRICTEDPOST) ?
ANSI_COLOR(1)"不開放" : "開放"
);
- prints( " " ANSI_COLOR(1;36) "y" ANSI_RESET
+ prints( " " ANSI_COLOR(1;36) "y" ANSI_RESET
" - %s" ANSI_RESET
" 回應文章\n",
- (bp->brdattr & BRD_NOREPLY) ?
+ (bp->brdattr & BRD_NOREPLY) ?
ANSI_COLOR(1)"不開放" : "開放"
);
- prints( " " ANSI_COLOR(1;36) "d" ANSI_RESET
+ prints( " " ANSI_COLOR(1;36) "d" ANSI_RESET
" - %s" ANSI_RESET
" 自刪文章\n",
- (bp->brdattr & BRD_NOSELFDELPOST) ?
+ (bp->brdattr & BRD_NOSELFDELPOST) ?
ANSI_COLOR(1)"不開放" : "開放"
);
- prints( " " ANSI_COLOR(1;36) "r" ANSI_RESET
- " - %s " ANSI_RESET "推薦文章\n",
- (bp->brdattr & BRD_NORECOMMEND) ?
+ prints( " " ANSI_COLOR(1;36) "r" ANSI_RESET
+ " - %s " ANSI_RESET "推薦文章\n",
+ (bp->brdattr & BRD_NORECOMMEND) ?
ANSI_COLOR(1)"不開放":"開放"
);
#ifndef OLDRECOMMEND
prints( " " ANSI_COLOR(1;36) "s" ANSI_RESET
- " - %s " ANSI_RESET "噓文\n",
+ " - %s " ANSI_RESET "噓文\n",
((bp->brdattr & BRD_NORECOMMEND) || (bp->brdattr & BRD_NOBOO))
? ANSI_COLOR(1)"不開放":"開放");
#endif
@@ -419,8 +419,8 @@ b_config(void)
d = bp->fastrecommend_pause;
}
- prints( " " ANSI_COLOR(1;36) "f" ANSI_RESET
- " - %s " ANSI_RESET "快速連推文章",
+ prints( " " ANSI_COLOR(1;36) "f" ANSI_RESET
+ " - %s " ANSI_RESET "快速連推文章",
d != 0 ?
ANSI_COLOR(1)"限制": "開放");
if(d > 0)
@@ -428,36 +428,36 @@ b_config(void)
outs("\n");
}
- prints( " " ANSI_COLOR(1;36) "i" ANSI_RESET
- " - 推文時 %s" ANSI_RESET " 記錄來源 IP\n",
- (bp->brdattr & BRD_IPLOGRECMD) ?
+ prints( " " ANSI_COLOR(1;36) "i" ANSI_RESET
+ " - 推文時 %s" ANSI_RESET " 記錄來源 IP\n",
+ (bp->brdattr & BRD_IPLOGRECMD) ?
ANSI_COLOR(1)"自動":"不會");
- prints( " " ANSI_COLOR(1;36) "a" ANSI_RESET
- " - 推文時 %s" ANSI_RESET " 開頭\n",
- (bp->brdattr & BRD_ALIGNEDCMT) ?
+ prints( " " ANSI_COLOR(1;36) "a" ANSI_RESET
+ " - 推文時 %s" ANSI_RESET " 開頭\n",
+ (bp->brdattr & BRD_ALIGNEDCMT) ?
ANSI_COLOR(1)"對齊":"不用對齊");
#ifdef USE_AUTOCPLOG
- prints( " " ANSI_COLOR(1;36) "x" ANSI_RESET
- " - 轉錄文章 %s " ANSI_RESET "自動記錄,且 %s "
- ANSI_RESET "發文權限\n",
- (bp->brdattr & BRD_CPLOG) ?
+ prints( " " ANSI_COLOR(1;36) "x" ANSI_RESET
+ " - 轉錄文章 %s " ANSI_RESET "自動記錄,且 %s "
+ ANSI_RESET "發文權限\n",
+ (bp->brdattr & BRD_CPLOG) ?
ANSI_COLOR(1)"會" : "不會" ,
- (bp->brdattr & BRD_CPLOG) ?
+ (bp->brdattr & BRD_CPLOG) ?
ANSI_COLOR(1)"需要" : "不需"
);
#endif
- prints( " " ANSI_COLOR(1;36) "L" ANSI_RESET
- " - 若有轉信則發文時預設 %s " ANSI_RESET "\n",
- (bp->brdattr & BRD_LOCALSAVE) ?
+ prints( " " ANSI_COLOR(1;36) "L" ANSI_RESET
+ " - 若有轉信則發文時預設 %s " ANSI_RESET "\n",
+ (bp->brdattr & BRD_LOCALSAVE) ?
"站內存檔(不轉出)" : ANSI_COLOR(1)"站際存檔(轉出)" );
// use '8' instead of '1', to prevent 'l'/'1' confusion
- prints( " " ANSI_COLOR(1;36) "8" ANSI_RESET
+ prints( " " ANSI_COLOR(1;36) "8" ANSI_RESET
" - %s" ANSI_RESET "未滿十八歲進入\n",
- (bp->brdattr & BRD_OVER18) ?
+ (bp->brdattr & BRD_OVER18) ?
ANSI_COLOR(1) "禁止 " : "允許\ " );
if (!canpost)
@@ -518,9 +518,9 @@ b_config(void)
outs(msg);
outs(ANSI_RESET);
}
- }
+ }
- if (!hasres && cachePostPerm)
+ if (!hasres && cachePostPerm)
{
move_ansi(ipostres++, COLPOSTRES);
outs("無特別限制");
@@ -546,7 +546,7 @@ b_config(void)
if (!isBM) outs(" (需板主權限)");
outs(aRst);
move_ansi(ipostres++, COLPOSTRES);
- prints("%sw%s)設定水桶 %sv%s)可見會員名單 ",
+ prints("%sw%s)設定水桶 %sv%s)可見會員名單 ",
aHot, aRst, aHot, aRst);
move_ansi(ipostres++, COLPOSTRES);
prints("%sm%s)舉辦投票 %so%s)投票名單 ",
@@ -575,7 +575,7 @@ b_config(void)
bp->brdattr ^= BRD_LOCALSAVE;
touched = 1;
break;
-
+
case 'a':
bp->brdattr ^= BRD_ALIGNEDCMT;
touched = 1;
@@ -620,9 +620,9 @@ b_config(void)
{
char ans[2];
move(b_lines-2, 0); clrtobot();
- if (getdata(b_lines-1, 0, (bp->brdattr & BRD_HIDE) ?
+ if (getdata(b_lines-1, 0, (bp->brdattr & BRD_HIDE) ?
ANSI_COLOR(1;32) " +++ 確定要解除看板隱形嗎?" ANSI_RESET " [y/N]: ":
- ANSI_COLOR(1;31) " --- 確定要隱形看板嗎?" ANSI_RESET " [y/N]: ",
+ ANSI_COLOR(1;31) " --- 確定要隱形看板嗎?" ANSI_RESET " [y/N]: ",
ans, sizeof(ans), LCECHO) < 1 ||
ans[0] != 'y')
break;
@@ -649,7 +649,7 @@ b_config(void)
{
char ans[2];
move(b_lines-2, 0); clrtobot();
- if (getdata(b_lines-1, 0, (bp->brdattr & BRD_IPLOGRECMD) ?
+ if (getdata(b_lines-1, 0, (bp->brdattr & BRD_IPLOGRECMD) ?
ANSI_COLOR(1;32) " --- 確定要停止記錄推文 IP 嗎?" ANSI_RESET " [y/N]: " :
ANSI_COLOR(1;31) " +++ 確定要記錄推文 IP 嗎?" ANSI_RESET " [y/N]: ",
ans, sizeof(ans), LCECHO) < 1 ||
@@ -691,13 +691,13 @@ b_config(void)
if(bp->fastrecommend_pause > 0)
sprintf(buf, "%d", bp->fastrecommend_pause);
- getdata_str(b_lines-1, 0,
+ getdata_str(b_lines-1, 0,
"請輸入連推時間限制(單位: 秒) [5~240]: ",
buf, 4, NUMECHO, buf);
if(buf[0] >= '0' && buf[0] <= '9')
bp->fastrecommend_pause = atoi(buf);
- if( bp->fastrecommend_pause < 5 ||
+ if( bp->fastrecommend_pause < 5 ||
bp->fastrecommend_pause > 240)
{
if(buf[0])
@@ -725,7 +725,7 @@ b_config(void)
vmsg("板主本身未滿 18 歲。");
} else {
bp->brdattr ^= BRD_OVER18;
- touched = 1;
+ touched = 1;
}
break;
@@ -776,7 +776,7 @@ b_config(void)
break;
}
bp->brdattr ^= BRD_NOREPLY;
- touched = 1;
+ touched = 1;
break;
case 'd':
@@ -787,7 +787,7 @@ b_config(void)
}
#endif
bp->brdattr ^= BRD_NOSELFDELPOST;
- touched = 1;
+ touched = 1;
break;
default:
@@ -876,7 +876,7 @@ check_newpost(boardstat_t * ptr)
if (brc_unread_time(ptr->bid, ftime, 0))
ptr->myattr |= NBRD_UNREAD;
-
+
return 1;
}
@@ -893,7 +893,7 @@ load_uidofgid(const int gid, const int type)
assert(0<=boardcount && boardcount<=MAX_BOARD);
for (n = 0; n < boardcount; ++n) {
bid = SHM->bsorted[type][n]+1;
- if( bid<=0 || !(bptr = getbcache(bid))
+ if( bid<=0 || !(bptr = getbcache(bid))
|| bptr->brdname[0] == '\0' )
continue;
if (bptr->gid == gid) {
@@ -919,7 +919,7 @@ addnewbrdstat(int n, int state)
{
boardstat_t *ptr;
- // ptt 2 local modification
+ // ptt 2 local modification
// XXX maybe some developer discovered signed short issue?
assert(n != -32769);
@@ -929,7 +929,7 @@ addnewbrdstat(int n, int state)
//boardheader_t *bptr = &bcache[n];
//ptr->total = &(SHM->total[n]);
//ptr->lastposttime = &(SHM->lastposttime[n]);
-
+
ptr->bid = n + 1;
ptr->myattr = state;
if ((B_BH(ptr)->brdattr & BRD_HIDE) && state == NBRD_BOARD)
@@ -1103,7 +1103,7 @@ load_boards(char *key)
#endif
} else { /* load boards of a subclass */
boardheader_t *bptr = getbcache(class_bid);
- int childcount;
+ int childcount;
int bid;
assert(0<=class_bid-1 && class_bid-1<MAX_BOARD);
@@ -1115,7 +1115,7 @@ load_boards(char *key)
nbrdsize = childcount + 5;
nbrd = (boardstat_t *) malloc((childcount+5) * sizeof(boardstat_t));
// 預留兩個以免大量開板時掛調
- for (bid = bptr->firstchild[type]; bid > 0 &&
+ for (bid = bptr->firstchild[type]; bid > 0 &&
brdnum < childcount+5; bid = bptr->next[type]) {
assert(0<=bid-1 && bid-1<MAX_BOARD);
bptr = getbcache(bid);
@@ -1139,11 +1139,11 @@ load_boards(char *key)
addnewbrdstat(bid-1, state);
}
if(childcount < brdnum) {
- //Ptt: dirty fix fix soon
+ //Ptt: dirty fix fix soon
getbcache(class_bid)->childcount = 0;
}
-
-
+
+
}
}
@@ -1166,7 +1166,7 @@ search_local_board()
namecomplete2(&namelist, ANSI_REVERSE "【 搜尋所在位置看板 】"
ANSI_RESET "\n請輸入看板名稱(按空白鍵自動搜尋): ", genbuf);
Vector_delete(&namelist);
-
+
for (num = 0; num < brdnum; num++)
if (!strcasecmp(B_BH(&nbrd[num])->brdname, genbuf))
@@ -1255,16 +1255,16 @@ brdlist_foot(void)
}
-static inline const char *
+static inline const char *
make_class_color(char *name)
{
/* 0;34 is too dark */
uint32_t index = (((uint32_t)name[0] + name[1] + name[2] + name[3]) & 0x07);
const char *colorset[8] = {"", ANSI_COLOR(32),
- ANSI_COLOR(33), ANSI_COLOR(36), ANSI_COLOR(1;34),
+ ANSI_COLOR(33), ANSI_COLOR(36), ANSI_COLOR(1;34),
ANSI_COLOR(1), ANSI_COLOR(1;32), ANSI_COLOR(1;33)};
const char *colorset2[8] = {"", ANSI_COLOR(32),
- ANSI_COLOR(33), ANSI_COLOR(36), ANSI_COLOR(35),
+ ANSI_COLOR(33), ANSI_COLOR(36), ANSI_COLOR(35),
"", ANSI_COLOR(32), ANSI_COLOR(33)};
return HasUserFlag(UF_MENU_LIGHTBAR) ? colorset2[index] : colorset[index];
@@ -1316,7 +1316,7 @@ show_brdlist(int head, int clsflag, int newflag)
char *unread[2] = {ANSI_COLOR(37) " " ANSI_RESET, ANSI_COLOR(1;31) "ˇ" ANSI_RESET};
if (HasUserFlag(UF_MENU_LIGHTBAR))
unread[1] = ANSI_COLOR(31) "ˇ" ANSI_RESET;
-
+
if (IS_LISTING_FAV() && brdnum == 1 && get_fav_type(&nbrd[0]) == 0) {
// (a) or (i) needs HasUserPerm(PERM_LOGINOK)).
@@ -1324,11 +1324,11 @@ show_brdlist(int head, int clsflag, int newflag)
if (!HasFavEditPerm())
{
// TODO actually we cannot use 's' (for PTT)...
- mvouts(3, 10,
+ mvouts(3, 10,
"--- 註冊的使用者才能新增看板喔 (可按 s 手動選取) ---");
} else {
// normal user. tell him what to do.
- mvouts(3, 10,
+ mvouts(3, 10,
"--- 空目錄,請按 a 新增或用 y 列出全部看板後按 z 增刪 ---");
}
return;
@@ -1347,33 +1347,33 @@ show_brdlist(int head, int clsflag, int newflag)
prints("%7d %c ", head, ptr->myattr & NBRD_TAG ? 'D' : ' ');
else
prints("%7s ", "");
-
+
if (!(ptr->myattr & NBRD_FAV))
outs(ANSI_COLOR(1;30));
- outs("------------"
+ outs("------------"
" "
// "------"
- "------------------------------------------"
+ "------------------------------------------"
ANSI_RESET "\n");
continue;
}
else if (ptr->myattr & NBRD_FOLDER){
char *title = get_folder_title(ptr->bid);
- prints("%7d %c ",
- newflag ?
+ prints("%7d %c ",
+ newflag ?
get_data_number(get_fav_folder(getfolder(ptr->bid))) :
head, ptr->myattr & NBRD_TAG ? 'D' : ' ');
// well, what to print with myfav folders?
- // this style is too long and we don't want to
- // fight with users...
+ // this style is too long and we don't want to
+ // fight with users...
// think about new way some otherday.
- prints("%sMyFavFolder" ANSI_RESET " 目錄 □%-34s",
+ prints("%sMyFavFolder" ANSI_RESET " 目錄 □%-34s",
!(HasUserFlag(UF_FAV_NOHILIGHT))?
(HasUserFlag(UF_MENU_LIGHTBAR) ?
HILIGHT_COLOR2 : HILIGHT_COLOR) : "",
- title);
+ title);
/*
if (!(HasUserFlag(UF_FAV_NOHILIGHT)))
outs(HILIGHT_COLOR);
@@ -1402,7 +1402,7 @@ show_brdlist(int head, int clsflag, int newflag)
if (B_BH(ptr)->brdattr & BRD_HIDE)
reason = "[隱板]";
-
+
// we don't print BM and popularity, so subject can be
// longer
prints("X%c %-13.13s%-7.7s %-48.48s",
@@ -1422,7 +1422,7 @@ show_brdlist(int head, int clsflag, int newflag)
if (newflag && B_BH(ptr)->brdattr & BRD_GROUPBOARD)
outs(" ");
else
- prints("%7d%c%s",
+ prints("%7d%c%s",
newflag ? (int)(B_TOTAL(ptr)) : head,
!(B_BH(ptr)->brdattr & BRD_HIDE) ? ' ' :
(B_BH(ptr)->brdattr & BRD_POSTMASK) ? ')' : '-',
@@ -1431,7 +1431,7 @@ show_brdlist(int head, int clsflag, int newflag)
unread[ptr->myattr & NBRD_UNREAD ? 1 : 0]);
if (!IN_CLASSROOT()) {
- prints("%s%-13s" ANSI_RESET "%s%5.5s" ANSI_COLOR(0;37)
+ prints("%s%-13s" ANSI_RESET "%s%5.5s" ANSI_COLOR(0;37)
"%2.2s" ANSI_RESET "%-34.34s",
((!(HasUserFlag(UF_FAV_NOHILIGHT)) &&
getboard(ptr->bid) != NULL))?
@@ -1580,7 +1580,7 @@ choose_board(int newflag)
}
if (IS_LISTING_BRD()) {
if (HasUserPerm(PERM_SYSOP) || GROUPOP()) {
- if (paste_taged_brds(class_bid) ||
+ if (paste_taged_brds(class_bid) ||
m_newbrd(class_bid, 0) == -1)
break;
brdnum = -1;
@@ -1626,7 +1626,7 @@ choose_board(int newflag)
///////////////////////////////////////////////////////
// General Hotkeys
///////////////////////////////////////////////////////
-
+
case 'h':
show_helpfile(fn_boardlisthelp);
show_brdlist(head, 1, newflag);
@@ -1804,7 +1804,7 @@ choose_board(int newflag)
clrtoeol();
// since now user can use Ctrl-S to get access
// to folders, let's fallback to boards only here.
- CompleteBoard(ANSI_REVERSE
+ CompleteBoard(ANSI_REVERSE
"【 搜尋全站看板 】" ANSI_RESET
" (若要限定搜尋範圍為目前列表請改用 Ctrl-S)\n"
"請輸入看板名稱(按空白鍵自動搜尋): ",
@@ -1994,7 +1994,7 @@ choose_board(int newflag)
ptr->myattr &= ~NBRD_FAV;
}
}
- else
+ else
{
if (getboard(ptr->bid) != NULL) {
fav_remove_item(ptr->bid, FAVT_BOARD);
@@ -2144,7 +2144,7 @@ choose_board(int newflag)
last_save_fav_and_brc = now;
vmsg("已儲存看板閱\讀記錄");
} else
- vmsgf("間隔時間太近,未儲存看板閱\讀記錄 [請等 %d 秒後再試]",
+ vmsgf("間隔時間太近,未儲存看板閱\讀記錄 [請等 %d 秒後再試]",
(int)(600 - (now-last_save_fav_and_brc)));
break;
diff --git a/pttbbs/mbbsd/brc.c b/pttbbs/mbbsd/brc.c
index 096d2a72..bd42d5f4 100644
--- a/pttbbs/mbbsd/brc.c
+++ b/pttbbs/mbbsd/brc.c
@@ -65,7 +65,7 @@ static char * const fn_brc = ".brc3";
* @param[out] num number of records, which could be written for \a bid
* = brc_num if found
* = 0 or dangling size if not found
- *
+ *
* @return address of record. \a begin <= addr < \a endp.
* 0 if not found
*/
@@ -300,7 +300,7 @@ load_remote_brc() {
(fd = toconnectex(BRCSTORED_ADDR, 5)) < 0) {
mvprints(b_lines, 0, (conn_retries == 0) ?
ANSI_COLOR(1;31)
- "無法載入最新的看板已讀未讀資料, 將使用上次備份... (#%d)"
+ "無法載入最新的看板已讀未讀資料, 將使用上次備份... (#%d)"
ANSI_RESET: "正在同步看板已讀未讀資料,請稍候... (#%d)",
conn_retries + 1);
refresh();
@@ -324,7 +324,7 @@ load_remote_brc() {
if (fd >= 0)
close(fd);
-
+
if (err) {
brc_release();
return 0;
@@ -358,7 +358,7 @@ save_remote_brc() {
if (fd >= 0)
close(fd);
-
+
if (err)
return 0;
@@ -451,7 +451,7 @@ brc_initialize(){
return 0;
}
-/**
+/**
* get the read records for bid
*
* @param bid
@@ -562,7 +562,7 @@ brc_addlist(const char *fname, time4_t modified)
for (n = 0; n < brc_num; n++) { /* using linear search */
if (frec.create == brc_list[n].create) {
// check if we got bad value.
- if (modified == (time4_t)-1)
+ if (modified == (time4_t)-1)
return;
if (brc_list[n].modified == (time4_t)-1)
@@ -627,7 +627,7 @@ brc_unread_time(int bid, time4_t ftime, time4_t modified)
if (modified == (time4_t)-1 || brcm == (time4_t)-1)
return 0;
- // one case is, some special file headers (ex,
+ // one case is, some special file headers (ex,
// always bottom) may cause issue. They share create
// time (filename) and apply different modify time.
// so let's back to 'greater'.
diff --git a/pttbbs/mbbsd/cache.c b/pttbbs/mbbsd/cache.c
index b5b187ef..91dc9a9c 100644
--- a/pttbbs/mbbsd/cache.c
+++ b/pttbbs/mbbsd/cache.c
@@ -61,7 +61,7 @@ count_logins(int uid, int show)
{
register int i = 0, j, start = 0, end = SHM->UTMPnumber - 1, count;
int *ulist;
- userinfo_t *u;
+ userinfo_t *u;
if (end == -1)
return 0;
ulist = SHM->sorted[SHM->currsorted][7];
@@ -113,7 +113,7 @@ setutmpmode(unsigned int mode)
}
}
-unsigned int
+unsigned int
getutmpmode(void)
{
if (currutmp)
@@ -160,7 +160,7 @@ is_BM_cache(int bid) /* bid starts from 1 */
// XXX potential issue: (thanks for mtdas@ptt)
// buildBMcache use -1 as "none".
- // some function may call is_BM_cache early
+ // some function may call is_BM_cache early
// without having currutmp->uid (maybe?)
// and may get BM permission accidentally.
// quick check
@@ -259,7 +259,7 @@ postperm_msg(const char *bname)
// 在罰單的討論相關板可以發文
if (bp->level & PERM_VIOLATELAW)
return NULL;
- else
+ else
return "罰單未繳";
}
diff --git a/pttbbs/mbbsd/cal.c b/pttbbs/mbbsd/cal.c
index 62b363fe..d29f5504 100644
--- a/pttbbs/mbbsd/cal.c
+++ b/pttbbs/mbbsd/cal.c
@@ -87,71 +87,71 @@ unlockutmpmode(void)
return 0;
}
-static int
-do_pay(int uid, int money, const char *item GCC_UNUSED, const char *reason)
-{
- int oldm, newm;
- const char *userid;
-
- assert(money != 0);
- userid = getuserid(uid);
- assert(userid);
- assert(reason);
-
- // if we cannot find user, abort
- if (!userid)
- return -1;
-
- oldm = moneyof(uid);
- newm = deumoney(uid, -money);
- if (uid == usernum)
- reload_money();
-
+static int
+do_pay(int uid, int money, const char *item GCC_UNUSED, const char *reason)
+{
+ int oldm, newm;
+ const char *userid;
+
+ assert(money != 0);
+ userid = getuserid(uid);
+ assert(userid);
+ assert(reason);
+
+ // if we cannot find user, abort
+ if (!userid)
+ return -1;
+
+ oldm = moneyof(uid);
+ newm = deumoney(uid, -money);
+ if (uid == usernum)
+ reload_money();
+
{
- char buf[PATHLEN];
- sethomefile(buf, userid, FN_RECENTPAY);
- rotate_text_logfile(buf, SZ_RECENTPAY, 0.2);
- syncnow();
+ char buf[PATHLEN];
+ sethomefile(buf, userid, FN_RECENTPAY);
+ rotate_text_logfile(buf, SZ_RECENTPAY, 0.2);
+ syncnow();
log_payment(buf, money, oldm, newm, reason, now);
}
- return newm;
-}
-
-int
-pay_as_uid(int uid, int money, const char *item, ...)
-{
- va_list ap;
- char reason[STRLEN*3] ="";
-
- if (!money)
- return 0;
-
- if (item) {
- va_start(ap, item);
- vsnprintf(reason, sizeof(reason)-1, item, ap);
- va_end(ap);
- }
-
- return do_pay(uid, money, item, reason);
-}
-
-int
-pay(int money, const char *item, ...)
-{
- va_list ap;
- char reason[STRLEN*3] ="";
-
- if (!money)
- return 0;
-
- if (item) {
- va_start(ap, item);
- vsnprintf(reason, sizeof(reason)-1, item, ap);
- va_end(ap);
- }
-
- return do_pay(usernum, money, item, reason);
+ return newm;
+}
+
+int
+pay_as_uid(int uid, int money, const char *item, ...)
+{
+ va_list ap;
+ char reason[STRLEN*3] ="";
+
+ if (!money)
+ return 0;
+
+ if (item) {
+ va_start(ap, item);
+ vsnprintf(reason, sizeof(reason)-1, item, ap);
+ va_end(ap);
+ }
+
+ return do_pay(uid, money, item, reason);
+}
+
+int
+pay(int money, const char *item, ...)
+{
+ va_list ap;
+ char reason[STRLEN*3] ="";
+
+ if (!money)
+ return 0;
+
+ if (item) {
+ va_start(ap, item);
+ vsnprintf(reason, sizeof(reason)-1, item, ap);
+ va_end(ap);
+ }
+
+ return do_pay(usernum, money, item, reason);
}
int
@@ -162,10 +162,10 @@ p_from(void)
if (vans("確定要改故鄉?[y/N]") != 'y')
return 0;
- strlcpy(tmp_from, currutmp->from, sizeof(tmp_from));
+ strlcpy(tmp_from, currutmp->from, sizeof(tmp_from));
if (getdata(b_lines - 1, 0, "請輸入新故鄉:",
tmp_from, sizeof(tmp_from), DOECHO) &&
- strcmp(tmp_from, currutmp->from) != 0)
+ strcmp(tmp_from, currutmp->from) != 0)
{
strlcpy(currutmp->from, tmp_from, sizeof(currutmp->from));
}
@@ -191,7 +191,7 @@ mail_redenvelop(const char *from, const char *to, int money, char *fpath)
"標題: 招財進寶\n"
"時間: %s\n"
ANSI_COLOR(1;33) "親愛的 %s :\n\n" ANSI_RESET
- ANSI_COLOR(1;31) " 我包給你一個 %d " MONEYNAME
+ ANSI_COLOR(1;31) " 我包給你一個 %d " MONEYNAME
"的大紅包喔 ^_^\n\n"
" 禮輕情意重,請笑納...... ^_^" ANSI_RESET "\n"
#if defined(USE_RECENTPAY) || defined(LOG_RECENTPAY)
@@ -203,7 +203,7 @@ mail_redenvelop(const char *from, const char *to, int money, char *fpath)
fclose(fp);
// colorize topic to make sure this is issued by system.
- snprintf(fhdr.title, sizeof(fhdr.title),
+ snprintf(fhdr.title, sizeof(fhdr.title),
ANSI_COLOR(1;37;41) "[紅包]" ANSI_RESET " $%d", money);
strlcpy(fhdr.owner, from, sizeof(fhdr.owner));
sethomedir(dirent, to);
@@ -237,7 +237,7 @@ cal_after_givetax(int money)
return money - give_tax(money);
}
-static int
+static int
give_money_vget_changecb(int key GCC_UNUSED, VGET_RUNTIME *prt, void *instance)
{
int m1 = atoi(prt->buf), m2 = m1;
@@ -259,11 +259,11 @@ give_money_vget_changecb(int key GCC_UNUSED, VGET_RUNTIME *prt, void *instance)
return VGETCB_NONE;
}
-static int
+static int
give_money_vget_peekcb(int key, VGET_RUNTIME *prt, void *instance)
{
int *p_is_before_tax = (int*) instance;
-
+
// digits will be refreshed later.
if (key >= '0' && key <= '9')
return VGETCB_NONE;
@@ -294,16 +294,16 @@ do_give_money(char *id, int uid, int money, const char *myid)
if (strcasecmp(myid, cuser.userid) != 0) {
snprintf(prompt, sizeof(prompt)-1,
"以 %s 的名義轉帳給 %s (稅後 $%d)",
- myid, id, money - tax);
+ myid, id, money - tax);
} else {
- snprintf(prompt, sizeof(prompt)-1,
- "轉帳給 %s (稅後 $%d)", id, money - tax);
+ snprintf(prompt, sizeof(prompt)-1,
+ "轉帳給 %s (稅後 $%d)", id, money - tax);
}
// 實際給予金錢。 為避免程式故障/惡意斷線,一律先扣再發。
pay(money, "%s", prompt);
- pay_as_uid(uid, -(money - tax), "來自 %s 的轉帳 (稅前 $%d)",
- myid, money);
+ pay_as_uid(uid, -(money - tax), "來自 %s 的轉帳 (稅前 $%d)",
+ myid, money);
log_filef(FN_MONEY, LOG_CREAT, "%-12s 給 %-12s %d\t(稅後 %d)\t%s\n",
cuser.userid, id, money, money - tax, Cdate(&now));
@@ -325,7 +325,7 @@ p_give(void)
return -1;
}
-int
+int
give_money_ui(const char *userid)
{
int uid, can_send_mail = 1;
@@ -336,7 +336,7 @@ give_money_ui(const char *userid)
const char *myid = cuser.userid;
const char *uid_prompt = "這位幸運兒的id: ";
- const char *alert_trade = "\n" ANSI_COLOR(0;1;31)
+ const char *alert_trade = "\n" ANSI_COLOR(0;1;31)
"提醒您本站的虛擬 " MONEYNAME " 不應與其它虛擬或現實生活"
"通用之貨幣進行交易\n"
"若查獲有使用者經由不法途徑取得再與其它使用者進行貨幣間之交易時\n"
@@ -379,9 +379,9 @@ give_money_ui(const char *userid)
outs(" 請輸入金額: "); // (3, 0)
{
int is_before_tax = 1;
- const VGET_CALLBACKS cb = {
- give_money_vget_peekcb,
- NULL,
+ const VGET_CALLBACKS cb = {
+ give_money_vget_peekcb,
+ NULL,
give_money_vget_changecb,
};
if (vgetstring(money_buf, 7, VGET_DIGITS, "", &cb, &is_before_tax))
@@ -480,7 +480,7 @@ give_money_ui(const char *userid)
return -1;
}
- outs("\n交易正在進行中,請稍候...\n");
+ outs("\n交易正在進行中,請稍候...\n");
refresh();
if(do_give_money(id, uid, m, myid) < 0)
@@ -498,7 +498,7 @@ give_money_ui(const char *userid)
if (mail_redenvelop( myid, id, m - mtax, fpath) < 0)
{
- outs(ANSI_COLOR(1;31) "已轉入對方帳戶但紅包袋寄送失敗()。"
+ outs(ANSI_COLOR(1;31) "已轉入對方帳戶但紅包袋寄送失敗()。"
ANSI_RESET);
} else {
if (vans("交易已完成,要修改紅包袋嗎?[y/N] ") == 'y')
@@ -509,9 +509,9 @@ give_money_ui(const char *userid)
}
#ifdef USE_RECENTPAY
move(b_lines-5, 0); clrtobot();
- outs("\n您可於下列位置找到最近的交易記錄:\n"
- "主選單 => (U)ser個人設定 => (L)MyLogs個人記錄 => "
- "(P)RecentPay最近交易記錄\n");
+ outs("\n您可於下列位置找到最近的交易記錄:\n"
+ "主選單 => (U)ser個人設定 => (L)MyLogs個人記錄 => "
+ "(P)RecentPay最近交易記錄\n");
#endif
vmsg("交易完成。");
return 0;
@@ -549,7 +549,7 @@ p_sysinfo(void)
cpuloadstr, SHM->UTMPnumber,
#ifdef DYMAX_ACTIVE
// XXX check the related logic in mbbsd.c
- (SHM->GV2.e.dymaxactive > 2000 && SHM->GV2.e.dymaxactive < MAX_ACTIVE) ?
+ (SHM->GV2.e.dymaxactive > 2000 && SHM->GV2.e.dymaxactive < MAX_ACTIVE) ?
SHM->GV2.e.dymaxactive : MAX_ACTIVE,
#else
MAX_ACTIVE,
@@ -569,7 +569,7 @@ p_sysinfo(void)
#endif
#ifdef HAVE_GRAYOUT
"\tGrayout Advanced Control 淡入淡出特效系統\n"
-#endif
+#endif
#ifdef EDITPOST_SMARTMERGE
"\tSmart Merge 修文自動合併\n"
#endif
@@ -593,9 +593,9 @@ p_sysinfo(void)
getrusage(RUSAGE_SELF, &ru);
prints("記憶體用量: %s\n", usage);
prints("CPU 用量: %ld.%06ldu %ld.%06lds",
- (long int)ru.ru_utime.tv_sec,
+ (long int)ru.ru_utime.tv_sec,
(long int)ru.ru_utime.tv_usec,
- (long int)ru.ru_stime.tv_sec,
+ (long int)ru.ru_stime.tv_sec,
(long int)ru.ru_stime.tv_usec);
#ifdef CPULIMIT_PER_DAY
prints(" (limit %d secs per day)", CPULIMIT_PER_DAY);
diff --git a/pttbbs/mbbsd/calendar.c b/pttbbs/mbbsd/calendar.c
index d24655ca..340ae76f 100644
--- a/pttbbs/mbbsd/calendar.c
+++ b/pttbbs/mbbsd/calendar.c
@@ -47,19 +47,19 @@ int ParseDateTime(const char *date, int *year, int *month, int *day,
m = strtok_r(NULL, "/", &strtok_pos);if (!m) return 1;
d = strtok_r(NULL, " ", &strtok_pos); if (!d) return 1;
- if (hour) {
- hh = strtok_r(NULL, ":", &strtok_pos);
- if (!hh) return 1;
+ if (hour) {
+ hh = strtok_r(NULL, ":", &strtok_pos);
+ if (!hh) return 1;
*hour = atoi(hh);
}
- if (min ) {
- mm = strtok_r(NULL, ":", &strtok_pos);
- if (!mm) return 1;
+ if (min ) {
+ mm = strtok_r(NULL, ":", &strtok_pos);
+ if (!mm) return 1;
*min = atoi(mm);
}
- if (sec ) {
- ss = strtok_r(NULL, "", &strtok_pos);
- if (!ss) return 1;
+ if (sec ) {
+ ss = strtok_r(NULL, "", &strtok_pos);
+ if (!ss) return 1;
*sec = atoi(ss);
}
@@ -318,13 +318,13 @@ calendar(void)
outs(buf[i]);
if (i == 0) {
prints("\t" ANSI_COLOR(1;37)
- "現在是 %d.%02d.%02d %2d:%02d:%02d%cm" ANSI_RESET,
+ "現在是 %d.%02d.%02d %2d:%02d:%02d%cm" ANSI_RESET,
snow.tm_year + 1900, snow.tm_mon + 1, snow.tm_mday,
(snow.tm_hour == 0 || snow.tm_hour == 12) ?
12 : snow.tm_hour % 12, snow.tm_min, snow.tm_sec,
snow.tm_hour >= 12 ? 'p' : 'a');
} else if (i >= 2 && e) {
- prints("\t" ANSI_COLOR(1;37)
+ prints("\t" ANSI_COLOR(1;37)
"(尚有 " ANSI_COLOR(%d) "%3d"
ANSI_COLOR(37) " 天)"
ANSI_RESET " %02d/%02d %s",
diff --git a/pttbbs/mbbsd/captcha.c b/pttbbs/mbbsd/captcha.c
index 9af29bc5..8d3fc3b5 100644
--- a/pttbbs/mbbsd/captcha.c
+++ b/pttbbs/mbbsd/captcha.c
@@ -17,7 +17,7 @@ gen_captcha(char *buf, int szbuf, char *fpath)
char cmd[PATHLEN], opts[PATHLEN];
int i, coptSpace, coptFont;
static const char *optSpace[] = {
- "-S", "-s", "-k", "-W",
+ "-S", "-s", "-k", "-W",
// "-o",
NULL
};
@@ -29,7 +29,7 @@ gen_captcha(char *buf, int szbuf, char *fpath)
// shadow family
// "shadow", "smshadow",
// mini (better with large spacing)
- // "mini",
+ // "mini",
NULL
};
@@ -43,13 +43,13 @@ gen_captcha(char *buf, int szbuf, char *fpath)
while (optSpace[coptSpace]) coptSpace++;
while (optFont[coptFont]) coptFont++;
snprintf(opts, sizeof(opts),
- "%s -f %s",
+ "%s -f %s",
optSpace[random() % coptSpace],
optFont [random() % coptFont ]);
// create file
snprintf(fpath, PATHLEN, FN_JOBSPOOL_DIR ".captcha.%s", buf);
- snprintf(cmd, sizeof(cmd), FIGLET_PATH
+ snprintf(cmd, sizeof(cmd), FIGLET_PATH
" %s %s >%s 2>/dev/null || rm %s",
opts, buf, fpath, fpath);
@@ -117,7 +117,7 @@ int verify_captcha(const char *reason)
move(b_lines-1, 0); clrtobot();
prints("請仔細檢查上面的圖形, %d 秒後即可輸入...", i);
// flush out current input
- doupdate();
+ doupdate();
sleep(1);
vkey_purge();
}
@@ -144,7 +144,7 @@ int verify_captcha(const char *reason)
}
#else // !USE_FIGLET_CAPTCHA
-int
+int
verify_captcha(const char *reason)
{
return 1;
diff --git a/pttbbs/mbbsd/ccw.c b/pttbbs/mbbsd/ccw.c
index 8155e75a..5ef84d75 100644
--- a/pttbbs/mbbsd/ccw.c
+++ b/pttbbs/mbbsd/ccw.c
@@ -111,7 +111,7 @@ CCW_PROTO int ccw_partial_match(const char *buf, const char *cmd);
CCW_PROTO void
ccw_header(CCW_CTX *ctx)
{
- move(0, 0);
+ move(0, 0);
SOLVE_ANSI_CACHE();
clrtoeol();
@@ -217,7 +217,7 @@ ccw_peek_cmd(CCW_CTX *ctx, const char *buf, int local)
return 0;
}
-CCW_PROTO void
+CCW_PROTO void
ccw_print_line(CCW_CTX *ctx, const char *buf, int local)
{
// FIXME if printed message is too long, the 2nd line will be overwritten
@@ -247,7 +247,7 @@ ccw_print_line(CCW_CTX *ctx, const char *buf, int local)
CCW_PROTO void
ccw_log_line(CCW_CTX *ctx, const char *buf, int local)
{
- if (!ctx->log)
+ if (!ctx->log)
return;
if (ctx->log_line)
@@ -290,7 +290,7 @@ ccw_prepare_line(CCW_CTX *ctx)
// simply append
ctx->line ++;
}
- else
+ else
{
// scroll screen buffer
region_scroll_up(CCW_INIT_LINE, CCW_STOP_LINE - CCW_INIT_LINE);
@@ -314,7 +314,7 @@ ccw_partial_match(const char *buf, const char *cmd)
}
// print and log one line of text.
-CCW_PROTO void
+CCW_PROTO void
ccw_add_line(CCW_CTX *ctx, const char *buf, int local)
{
// only print/log local when local_echo is enabled.
@@ -402,7 +402,7 @@ ccw_process(CCW_CTX *ctx)
#ifdef DEBUG
ccw_print_line(ctx, ANSI_COLOR(1;30)
- "◆ Powered by piaip's Common Chat Window" ANSI_RESET,
+ "◆ Powered by piaip's Common Chat Window" ANSI_RESET,
CCW_LOCAL_MSG);
#endif
#ifdef EXP_CCW_MOTD
@@ -424,7 +424,7 @@ ccw_process(CCW_CTX *ctx)
// get input
ctx->abort_vget = 0;
- vgetstring(inbuf, ctx->MAX_INPUT_LEN, VGET_TRANSPARENT, "",
+ vgetstring(inbuf, ctx->MAX_INPUT_LEN, VGET_TRANSPARENT, "",
&vgetcb, ctx);
// quick check for end flag or exit command.
@@ -479,7 +479,7 @@ ccw_talkchat_close_log(CCW_CTX *ctx, int force_decide, int is_chat)
// prompt user to decide how to deal with the log
while (1) {
char c;
- getdata(b_lines - 1, 0,
+ getdata(b_lines - 1, 0,
force_decide ? "清除(C) 移至備忘錄(M)? [c/m]: " :
"清除(C) 移至備忘錄(M)? [C/m]",
ans, sizeof(ans), LCECHO);
@@ -540,7 +540,7 @@ ccw_talk_send(CCW_CTX *ctx, const char *msg)
assert(len >= 0 && (size_t)(int)len == strlen(msg));
if (len < 1) return 0;
- // XXX if remote is closed (without MSG_NOSIGNAL),
+ // XXX if remote is closed (without MSG_NOSIGNAL),
// this may raise a SIGPIPE and cause BBS to abort...
if (tosend(ctx->fd, &len, sizeof(len), MSG_NOSIGNAL) != sizeof(len))
return -1;
@@ -549,7 +549,7 @@ ccw_talk_send(CCW_CTX *ctx, const char *msg)
return len;
}
-CCW_PROTO ssize_t
+CCW_PROTO ssize_t
ccw_talk_recv(CCW_CTX *ctx, char *buf, size_t szbuf)
{
char len = 0;
@@ -581,7 +581,7 @@ ccw_talk_header(CCW_CTX *ctx)
CCW_PROTO void
ccw_talk_footer(CCW_CTX *ctx GCC_UNUSED)
{
- vs_footer(" 【" CCW_CAP_TALK "】 ",
+ vs_footer(" 【" CCW_CAP_TALK "】 ",
" (PgUp/PgDn)回顧訊息記錄\t(Ctrl-C)離開 ");
}
@@ -605,7 +605,7 @@ ccw_talk_peek_cmd(CCW_CTX *ctx, const char *buf, int local)
{
ccw_print_line(ctx, "[說明] 可輸入 "
CCW_TALK_CMD_PREFIX_STR CCW_TALK_CMD_CLEAR " 清除畫面或 "
- CCW_TALK_CMD_PREFIX_STR CCW_TALK_CMD_BYE " 離開。",
+ CCW_TALK_CMD_PREFIX_STR CCW_TALK_CMD_BYE " 離開。",
CCW_LOCAL_MSG);
return 1;
}
@@ -651,7 +651,7 @@ ccw_talk_peek_key(CCW_CTX *ctx, int key)
return 0;
}
-int
+int
ccw_talk(int fd, int destuid)
{
char fpath[PATHLEN];
@@ -781,7 +781,7 @@ ccw_chat_send(CCW_CTX *ctx, const char *buf)
assert(len < sizeof(genbuf));
if (len > sizeof(genbuf))
len = sizeof(genbuf);
- // XXX if remote is closed (without MSG_NOSIGNAL),
+ // XXX if remote is closed (without MSG_NOSIGNAL),
// this may raise a SIGPIPE and cause BBS to abort...
return (tosend(ctx->fd, genbuf, len, MSG_NOSIGNAL) == len);
}
@@ -841,7 +841,7 @@ word_match_index(const char *buf, const char *pattern, size_t szpat)
{
if (p > buf && isascii(*(p-1)) && isalnum(*(p-1)))
{
- p++;
+ p++;
continue;
}
// FIXME this may skip to much, but highlights are not that important...
@@ -861,7 +861,7 @@ ccw_chat_print_highlights(CCW_CTX *ctx, const char *s)
{
int m = -1, n;
n = strlen(cuser.userid);
- if (n > 2)
+ if (n > 2)
m = word_match_index(s, cuser.userid, n);
if (m < 0)
{
@@ -890,7 +890,7 @@ ccw_chat_print_line(CCW_CTX *ctx, const char *buf, int local)
size_t szid;
// let's try harder to recognize the content
- if (local != CCW_REMOTE || buf[0] == ' '||
+ if (local != CCW_REMOTE || buf[0] == ' '||
strchr(buf, ESC_CHR) || !strchr(buf, ':') )
{
// pre-formatted or messages
@@ -903,8 +903,8 @@ ccw_chat_print_line(CCW_CTX *ctx, const char *buf, int local)
// message from myself
outs(ANSI_COLOR(1)); outs(ctx->local_id); outs(ANSI_RESET);
outs(buf+szid);
- }
- else
+ }
+ else
{
// message from others
ccw_chat_print_highlights(ctx, buf);
@@ -945,7 +945,7 @@ ccw_chat_recv(CCW_CTX *ctx)
if (len > c && (size_t)len < (sizeof(ext->buf)/ 2) )
break;
- if (*bptr != '/')
+ if (*bptr != '/')
{
// received some data, let's print it.
if (*bptr != '>' || PERM_HIDE(currutmp))
@@ -1010,7 +1010,7 @@ ccw_chat_anti_flood(CCW_CTX *ctx)
if( ++ext->flood > 10 )
{
const char *alert_msg = "請勿大量剪貼或造成洗板面的效果。";
- move(b_lines, 0); clrtoeol(); bell();
+ move(b_lines, 0); clrtoeol(); bell();
outs(alert_msg);
doupdate();
// flush all input!
@@ -1166,13 +1166,13 @@ ccw_chat_peek_key(CCW_CTX *ctx, int key)
return 0;
}
-int
+int
ccw_chat(int fd)
{
char chatid[CHAT_ID_LEN+1] = "myid",
roomid[CHAT_ROOM_LEN+1] = "room";
char fpath[PATHLEN];
- ccw_chat_ext ext = {
+ ccw_chat_ext ext = {
.old_rows = t_lines,
.old_cols = t_columns,
};
@@ -1203,7 +1203,7 @@ ccw_chat(int fd)
const char *err = "無法使用此代號";
char cmd[200];
- getdata(b_lines - 1, 0, "請輸入想在" CCW_CAP_CHAT "使用的暱稱: ",
+ getdata(b_lines - 1, 0, "請輸入想在" CCW_CAP_CHAT "使用的暱稱: ",
chatid, sizeof(chatid), DOECHO);
if(!chatid[0])
strlcpy(chatid, cuser.userid, sizeof(chatid));
@@ -1212,7 +1212,7 @@ ccw_chat(int fd)
DBCS_safe_trim(chatid);
// login format: /! UserID ChatID password
- snprintf(cmd, sizeof(cmd),
+ snprintf(cmd, sizeof(cmd),
"/! %s %s %s", cuser.userid, chatid, cuser.passwd);
ccw_chat_send(&ctx, cmd);
if (recv(ctx.fd, cmd, 3, 0) != 3) {
diff --git a/pttbbs/mbbsd/ch_dark.c b/pttbbs/mbbsd/ch_dark.c
index dc35b1df..6d709fb9 100644
--- a/pttbbs/mbbsd/ch_dark.c
+++ b/pttbbs/mbbsd/ch_dark.c
@@ -289,8 +289,8 @@ playing(struct DarkData *dd, sint fd, sint color, sint ch, sint * b, userinfo_t
case 'u':
move(0, 0);
clrtoeol();
- prints("%s色%s cont=%d",
- (dd->brd[dd->my][dd->mx].color == RED) ? "紅" : "黑",
+ prints("%s色%s cont=%d",
+ (dd->brd[dd->my][dd->mx].color == RED) ? "紅" : "黑",
rname[dd->brd[dd->my][dd->mx].value], dd->cont);
*b = -1;
break;
@@ -300,7 +300,7 @@ playing(struct DarkData *dd, sint fd, sint color, sint ch, sint * b, userinfo_t
&&
dd->brd[dd->mly][dd->mlx].color != dd->brd[dd->my][dd->mx].color /* 同色不能移動也不能吃 */
&&
- (Is_move(dd, dd->my, dd->mx, dd->mly, dd->mlx) ||
+ (Is_move(dd, dd->my, dd->mx, dd->mly, dd->mlx) ||
Is_win(dd, dd->brd[dd->mly][dd->mlx], dd->brd[dd->my][dd->mx], dd->my, dd->mx, dd->mly, dd->mlx))
) {
if (dd->fix && dd->brd[dd->my][dd->mx].value < 0) {
diff --git a/pttbbs/mbbsd/ch_go.c b/pttbbs/mbbsd/ch_go.c
index 61285cbe..a4f0a0ea 100644
--- a/pttbbs/mbbsd/ch_go.c
+++ b/pttbbs/mbbsd/ch_go.c
@@ -1,7 +1,7 @@
/* $Id$ */
#include "bbs.h"
-#include <sys/socket.h>
+#include <sys/socket.h>
#define BBLANK (-1) /* 空白 */
#define BWHITE (0) /* 白子, 後手 */
@@ -168,7 +168,7 @@ go_countlib(board_t board, int x, int y, char color)
}
/* 計算盤面上每個子的氣數 */
-static void
+static void
go_eval(board_t board, int lib[][BRDSIZ], char color)
{
int i, j;
@@ -180,7 +180,7 @@ go_eval(board_t board, int lib[][BRDSIZ], char color)
}
/* 檢查一步是否合法 */
-static int
+static int
go_check(ChessInfo* info, const go_step_t* step)
{
board_p board = (board_p) info->board;
@@ -319,7 +319,7 @@ go_findcolor(board_p board, int x, int y)
while ((board[k][y] == BBLANK) && (k > 0));
color[0] = board[k][y];
}
- else
+ else
color[0] = board[x][y];
if (x < 18)
@@ -614,7 +614,7 @@ go_process_key(ChessInfo* info, int key, ChessGameResult* result)
if (n >= 2 && n <= 9) {
go_step_t step = { CHESS_STEP_NORMAL, SETHAND, {n, 0} };
-
+
ChessStepSend(info, &step);
ChessHistoryAppend(info, &step);
diff --git a/pttbbs/mbbsd/ch_gomo.c b/pttbbs/mbbsd/ch_gomo.c
index fb1a4182..2b00a310 100644
--- a/pttbbs/mbbsd/ch_gomo.c
+++ b/pttbbs/mbbsd/ch_gomo.c
@@ -449,7 +449,7 @@ static int gomo_loadlog(FILE *fp, ChessInfo *info)
while (fgets(buf, sizeof(buf), fp)) {
if (strcmp("</gomokulog>\n", buf) == 0)
return 1;
- else if (strncmp("black:", buf, 6) == 0 ||
+ else if (strncmp("black:", buf, 6) == 0 ||
strncmp("white:", buf, 6) == 0) {
/* /(black|white):([a-zA-Z0-9]+)/; $2 */
userec_t rec;
@@ -464,7 +464,7 @@ static int gomo_loadlog(FILE *fp, ChessInfo *info)
int c, r;
const char *p = buf;
int i;
-
+
for(i=0; i<2; i++) {
p = strchr(p, '>');
diff --git a/pttbbs/mbbsd/ch_reversi.c b/pttbbs/mbbsd/ch_reversi.c
index 3e5a4869..bdfaeb09 100644
--- a/pttbbs/mbbsd/ch_reversi.c
+++ b/pttbbs/mbbsd/ch_reversi.c
@@ -133,8 +133,8 @@ static void
reversi_init_user(const userinfo_t* uinfo, ChessUser* user)
{
strlcpy(user->userid, uinfo->userid, sizeof(user->userid));
- user->win =
- user->lose =
+ user->win =
+ user->lose =
user->tie = 0;
}
@@ -343,7 +343,7 @@ reversi_post_game(ChessInfo* info)
static void
reversi_gameend(ChessInfo* info GCC_UNUSED, ChessGameResult result GCC_UNUSED)
{
- /* nothing to do now
+ /* nothing to do now
* TODO game record */
}
@@ -401,7 +401,7 @@ reversi_loadlog(FILE *fp, ChessInfo *info)
while (fgets(buf, sizeof(buf), fp)) {
if (strcmp("</reversilog>\n", buf) == 0)
return 1;
- else if (strncmp("black:", buf, 6) == 0 ||
+ else if (strncmp("black:", buf, 6) == 0 ||
strncmp("white:", buf, 6) == 0) {
/* /(black|white):([a-zA-Z0-9]+)/; $2 */
userec_t rec;
@@ -415,7 +415,7 @@ reversi_loadlog(FILE *fp, ChessInfo *info)
int c, r;
const char *p = buf;
int i;
-
+
for(i=0; i<2; i++) {
reversi_step_t step = { .type = CHESS_STEP_NORMAL };
diff --git a/pttbbs/mbbsd/chc.c b/pttbbs/mbbsd/chc.c
index 924d60e7..ec9a8703 100644
--- a/pttbbs/mbbsd/chc.c
+++ b/pttbbs/mbbsd/chc.c
@@ -8,7 +8,7 @@ extern const double elo_exp_tab[1000];
enum Turn {
BLK = 0,
- RED
+ RED
};
enum Kind {
@@ -295,7 +295,7 @@ chc_log_poem(FILE* outfp)
int n;
// TODO use readdir(), don't use lots of memory
- n = scandir(BBSHOME"/etc/chess", &namelist, chc_filter,
+ n = scandir(BBSHOME"/etc/chess", &namelist, chc_filter,
(int (*)(const struct dirent **, const struct dirent **))alphasort);
if (n < 0)
perror("scandir");
@@ -357,7 +357,7 @@ chc_genlog(ChessInfo* info, FILE* fp, ChessGameResult result)
fprintf(fp, "=> %s 勝\n",
(info->myturn == RED) == (result== CHESS_RESULT_WIN) ?
"紅" : "黑");
-
+
/* generate machine readable log.
* http://www.elephantbase.net/protocol/cchess_pgn.htm */
{
@@ -456,7 +456,7 @@ static void
chc_prepare_step(ChessInfo* info, const void* step)
{
const drc_t* move = (const drc_t*) step;
- getstep((board_p) info->board,
+ getstep((board_p) info->board,
&move->from, &move->to, info->last_movestr);
}
diff --git a/pttbbs/mbbsd/chess.c b/pttbbs/mbbsd/chess.c
index 907bc5f7..ef06eada 100644
--- a/pttbbs/mbbsd/chess.c
+++ b/pttbbs/mbbsd/chess.c
@@ -315,7 +315,7 @@ ChessStepBroadcast(ChessInfo* info, const void *step)
{
ChessBroadcastListNode *p = &(info->broadcast_list.head);
void (*orig_handler)(int);
-
+
orig_handler = Signal(SIGPIPE, SIG_IGN);
while(p->next){
@@ -559,7 +559,7 @@ ChessPlayFuncMy(ChessInfo* info)
case 'p':
if (info->constants->pass_is_step) {
ChessStepType type = CHESS_STEP_PASS;
- ChessHistoryAppend(info, &type);
+ ChessHistoryAppend(info, &type);
strcpy(info->last_movestr, "虛手");
info->pass[(int) info->turn] = 1;
@@ -894,7 +894,7 @@ ChessWatchRequest(int sig GCC_UNUSED)
if (sock < 0 || !CurrentPlayingGameInfo)
return;
-
+
node = ChessBroadcastListInsert(&CurrentPlayingGameInfo->broadcast_list);
node->sock = sock;
@@ -923,7 +923,7 @@ ChessReceiveWatchInfo(ChessInfo* info)
#define RECV(X) read(info->sock, &(X), sizeof(X))
RECV(info->myturn);
RECV(info->turn);
-
+
RECV(time_mode);
if (time_mode == 'L') {
info->timelimit = (ChessTimeLimit*) malloc(sizeof(ChessTimeLimit));
@@ -1172,7 +1172,7 @@ ChessStartGame(char func_char, int sig, const char* title)
{
userinfo_t *uin;
char buf[4];
-
+
if ((uin = ChessSearchUser(sig, title)) == NULL)
return -1;
uin->turn = 1;
@@ -1374,7 +1374,7 @@ ChessPhotoInitial(ChessInfo* info)
"│ 白 │",
"│ 照 │",
"│ 片│",
- "└──────┘"
+ "└──────┘"
};
char country[5], level[11];
userec_t xuser;
diff --git a/pttbbs/mbbsd/chicken.c b/pttbbs/mbbsd/chicken.c
index 9c7e248a..9c8c1123 100644
--- a/pttbbs/mbbsd/chicken.c
+++ b/pttbbs/mbbsd/chicken.c
@@ -249,7 +249,7 @@ show_chicken_stat(const chicken_t * thechicken, int age)
thechicken->satis,
thechicken->book,
thechicken->dirty,
- thechicken->sick,
+ thechicken->sick,
thechicken->tired);
}
@@ -601,9 +601,9 @@ revive_chicken(chicken_t *thechicken, int admin)
int c = 0;
assert(thechicken);
// check deadtype for what to do
-
+
strlcpy(thechicken->name, "[撿回來的]", sizeof(thechicken->name));
-
+
c = thechicken->hp_max / 5 +1;
if (c < 2) c = 2;
if (c > thechicken->hp_max) c = thechicken->hp_max;
@@ -622,7 +622,7 @@ revive_chicken(chicken_t *thechicken, int admin)
{
thechicken->sick = 0;
thechicken->tired = 0;
- }
+ }
thechicken->lastvisit = now; // really need so?
#ifdef HAVE_CHICKEN_CS
@@ -655,7 +655,7 @@ deadtype(const chicken_t * thechicken, chicken_t *mychicken)
else if (thechicken->weight == 1 &&
thechicken->sick > thechicken->hp_max / 4) // 餓死了
i = DEADTYPE_NOFOOD;
- else if (thechicken->satis <= 0) // 很不滿意
+ else if (thechicken->satis <= 0) // 很不滿意
i = DEADTYPE_NOSATIS;
else
return DEADTYPE_NOTYET;
@@ -713,7 +713,7 @@ ch_changename(chicken_t *mychicken)
if (strlen(newname) >= 3 && strcmp(newname, mychicken->name)) {
strlcpy(mychicken->name, newname, sizeof(mychicken->name));
- log_filef(CHICKENLOG, LOG_CREAT,
+ log_filef(CHICKENLOG, LOG_CREAT,
ANSI_COLOR(31) "%s" ANSI_RESET " 把疼愛的" ANSI_COLOR(33)
" %s" ANSI_COLOR(32) " %s "
ANSI_RESET "改名為" ANSI_COLOR(33) " %s" ANSI_RESET " 於 %s\n",
@@ -730,7 +730,7 @@ select_menu(int age GCC_UNUSED, chicken_t *mychicken)
reload_money();
move(19, 0);
- vbarf(ANSI_COLOR(44;37) " " MONEYNAME ":" ANSI_COLOR(33) " %-10d"
+ vbarf(ANSI_COLOR(44;37) " " MONEYNAME ":" ANSI_COLOR(33) " %-10d"
#ifdef HAVE_CHICKEN_CS
ANSI_COLOR(37) " 常識點數 :" ANSI_COLOR(33) " %-10d"
#endif
@@ -847,7 +847,7 @@ recover_chicken(chicken_t * thechicken)
prints("\n你有一個剛死亡不久的 %s 要招喚回來嗎? 只要 %d 元唷...\n",
chicken_type[(int)thechicken->type], price);
do {
- getdata(10, 0, " 要花錢復活寵物嗎? [y/n]: ",
+ getdata(10, 0, " 要花錢復活寵物嗎? [y/n]: ",
buf, 2, LCECHO);
}
while (buf[0] != 'y' && buf[0] != 'n');
@@ -887,7 +887,7 @@ chicken_toggle_death(const char *uid)
mychicken->name[0] = 0;
vmsgf("%s 的寵物被殺死了", uid);
}
- else
+ else
{
revive_chicken(mychicken, 1);
strlcpy(mychicken->name, "[死]", sizeof(mychicken->name));
@@ -921,7 +921,7 @@ chicken_query(const char *userid)
prints("\n\n%s 的寵物死掉了...", userid);
}
}
-
+
pressanykey();
}
diff --git a/pttbbs/mbbsd/edit.c b/pttbbs/mbbsd/edit.c
index 2f3162fa..2c7e682d 100644
--- a/pttbbs/mbbsd/edit.c
+++ b/pttbbs/mbbsd/edit.c
@@ -13,11 +13,11 @@
* 的時候, 將原本的那行記憶體縮小, 再將新移到的那行重新加大, 以達成最小的
* 記憶體用量.
* 以上說的這個動作在 adjustline() 中完成, adjustline()另外包括修正數個
- * global pointer, 以避免 dangling pointer .
+ * global pointer, 以避免 dangling pointer .
* 另外若定義 DEBUG, 在 textline_t 結構中將加入 mlength, 表示該行實際佔的
* 記憶體大小. 以方便測試結果.
*
- * XXX 由於各種操作都不會 maintain 區塊標記模式的 pointer/state,
+ * XXX 由於各種操作都不會 maintain 區塊標記模式的 pointer/state,
* 因此對於會造成增刪 line 的功能, 都得自動取消標記模式(call block_cancel()).
*
* 20071230 piaip
@@ -29,7 +29,7 @@
* 另外互動迷宮的大小為
* [第 1408/1408 頁 (100%) 目前顯示: 第 30940~30962 行]
* 是以定義:
- * 32M 為 size limit
+ * 32M 為 size limit
* 1M 為 line limit
* 又,忽然發現之前 totaln 之類都是 short... 所以 65536 就夠了?
* 後註: 似乎是用 announce 的 append 作出來的,有看到 > --- <- mark。
@@ -54,9 +54,9 @@
#define ENTROPY_MAX (MAX_POST_MONEY/ENTROPY_RATIO)
#if 0
-#define register
+#define register
#define DEBUG
-#define inline
+#define inline
#endif
/**
@@ -87,7 +87,7 @@ enum {
*
* 文章的內容 (以下稱 content) 以「行」為單位,主要以 firstline, lastline,
* totaln 來記錄。
- *
+ *
* User 在畫面中看到的畫面,置於一個「 window 」中,這個 window 會在
* content 上移動,window 裡面的範圍即為要 show 出來的範圍。它用了不少
* 欄位來記錄,包括 currline, top_of_win, currln, currpnt, curr_window_line,
@@ -255,7 +255,7 @@ static char mbcs_mode =1;
#define IS_BIG5_LOE(x) (0x80 <= (x) && (x) <= 0xfe)
#define IS_BIG5_LO(x) (IS_BIG5_LOS(x) || IS_BIG5_LOE(x))
#define IS_BIG5(hi,lo) (IS_BIG5_HI(hi) && IS_BIG5_LO(lo))
-
+
int mchar_len(unsigned char *str)
{
return ((str[0] != '\0' && str[1] != '\0' && IS_BIG5(str[0], str[1])) ?
@@ -273,7 +273,7 @@ int mchar_len(unsigned char *str)
*/
static int
fix_cursor(char *str, int pos, int dir)
-{
+{
int newpos = 0, w = 0;
assert(dir == FC_RIGHT || dir == FC_LEFT);
assert(pos >= 0);
@@ -426,7 +426,7 @@ show_phone_mode_panel(void)
prints(ANSI_COLOR(1;46) "【%s輸入】 ", BIG_mode[curr_buf->last_phone_mode - 1]);
len = strlen(BIG5[curr_buf->last_phone_mode - 1]) / 2;
for (i = 0; i < len; i++)
- prints(ANSI_COLOR(37) "%c" ANSI_COLOR(34) "%2.2s",
+ prints(ANSI_COLOR(37) "%c" ANSI_COLOR(34) "%2.2s",
i + 'A', BIG5[curr_buf->last_phone_mode - 1] + i * 2);
for (i = 0; i < 16 - len; i++)
outs(" ");
@@ -434,10 +434,10 @@ show_phone_mode_panel(void)
}
else {
prints(ANSI_COLOR(1;46) "【表格繪製】 /=%s *=%s形 ",
- table_mode[(curr_buf->last_phone_mode - 20) / 4],
+ table_mode[(curr_buf->last_phone_mode - 20) / 4],
table_mode[(curr_buf->last_phone_mode - 20) % 4 + 2]);
for (i = 0;i < 11;i++)
- prints(ANSI_COLOR(37) "%c" ANSI_COLOR(34) "%2.2s", i ? i + '/' : '.',
+ prints(ANSI_COLOR(37) "%c" ANSI_COLOR(34) "%2.2s", i ? i + '/' : '.',
table[curr_buf->last_phone_mode - 20] + i * 2);
outs(ANSI_COLOR(37) " Z內碼 " ANSI_RESET);
}
@@ -454,7 +454,7 @@ edit_msg(void)
if (curr_buf->ansimode) /* Thor: 作 ansi 編輯 */
n = n2ansi(n, curr_buf->currline);
-
+
if (curr_buf->phone_mode)
show_phone_mode_panel();
@@ -479,7 +479,7 @@ get_edit_kind_prompt(int flags)
has_new_post = (flags & EDITFLAG_KIND_NEWPOST);
if (has_reply_post && has_reply_mail)
- return ANSI_COLOR(0;1;37;45)
+ return ANSI_COLOR(0;1;37;45)
"注意:您即將 回信給原作者 並同時 回覆文章至看板上" ANSI_RESET;
if (has_reply_mail)
return ANSI_COLOR(0;1;31) "注意:您即將 寄出 私人信件" ANSI_RESET;
@@ -496,7 +496,7 @@ get_edit_warn_prompt(int flags) {
// FIXME not always on boards, maybe
if (no_self_sel)
- return ANSI_COLOR(0;1;31)
+ return ANSI_COLOR(0;1;31)
"注意: 此看板禁止自刪文章,發出後將只有板主以上才能刪文!!!" ANSI_RESET;
return NULL;
@@ -719,7 +719,7 @@ edit_window_adjust(void)
curr_buf->curr_window_line = 0;
curr_buf->top_of_win = curr_buf->currline;
}
-
+
if (curr_buf->curr_window_line >= visible_window_height()) {
offset = curr_buf->curr_window_line - visible_window_height() + 1;
curr_buf->curr_window_line = visible_window_height() - 1;
@@ -1059,7 +1059,7 @@ insert_char(int ch)
* insert_char twice.
*/
static void
-insert_dchar(const char *dchar)
+insert_dchar(const char *dchar)
{
insert_char(*dchar);
insert_char(*(dchar+1));
@@ -1129,7 +1129,7 @@ undelete_line(void)
if (curr_buf->firstline == curr_buf->currline)
curr_buf->firstline = p;
- // change currline
+ // change currline
curr_buf->currline = p;
curr_buf->currline = adjustline(curr_buf->currline, WRAPMARGIN);
curr_buf->currpnt = 0;
@@ -1434,8 +1434,8 @@ quote_strip_ansi_inline(unsigned char *is)
/* ptt prints, keep it as normal */
*os++ = '*';
*os++ = '*';
- }
- else
+ }
+ else
{
/* normal ansi, strip them out. */
while (*is && ANSI_IN_ESCAPE(*is))
@@ -1564,7 +1564,7 @@ check_quote(void)
if ((included_line >> 2) > post_line) {
move(4, 0);
outs("本篇文章的引言比例超過 80%,請您做些微的修正:\n\n"
- ANSI_COLOR(1;33) "1) 增加一些文章 或 2) 刪除不必要之引言"
+ ANSI_COLOR(1;33) "1) 增加一些文章 或 2) 刪除不必要之引言"
ANSI_RESET "\n");
{
char ans[4];
@@ -1597,7 +1597,7 @@ read_file(const char *fpath, int splitSig)
close(fd);
return 0;
}
-
+
return -1;
}
load_file(fp, offSig);
@@ -1647,7 +1647,7 @@ write_header(FILE * fp, const char *mytitle)
#endif // PLAY_ANGEL
do {
- getdata_str(3, 0, defanony ?
+ getdata_str(3, 0, defanony ?
"請輸入你想用的ID,或直接按[Enter]暱名,或按[r][R]用真名:" :
"請輸入你想用的ID,也可直接按[Enter]或[r]或[R]使用原ID:",
real_name, sizeof(real_name), DOECHO, default_name);
@@ -1747,7 +1747,7 @@ loadsitesig(const char *fname)
}
munmap(start, sz);
}
-
+
close(fd);
return ret;
}
@@ -1884,7 +1884,7 @@ static void upload_file(void);
// KEEP_EDITING if keep editing
// 0 if write ok & exit
static int
-write_file(const char *fpath, int saveheader, int *islocal, char mytitle[STRLEN],
+write_file(const char *fpath, int saveheader, int *islocal, char mytitle[STRLEN],
int upload, int chtitle, const char *kind_prompt, const char *warn_prompt,
int *pentropy)
{
@@ -2044,7 +2044,7 @@ write_file(const char *fpath, int saveheader, int *islocal, char mytitle[STRLEN]
#ifdef USE_POSTRECORD
// what if currbid == 0? add currstat checking.
if (currstat == POSTING &&
- postrecord.times > MAX_CROSSNUM-1 &&
+ postrecord.times > MAX_CROSSNUM-1 &&
!is_hidden_board_friend(currbid, currutmp->uid))
anticrosspost();
@@ -2078,7 +2078,7 @@ write_file(const char *fpath, int saveheader, int *islocal, char mytitle[STRLEN]
{
fprintf(fp,
"※ 編輯: %-15s 來自: %-20s (%s)\n",
- cuser.userid,
+ cuser.userid,
FROMHOST,
Cdate_mdHM(&now));
}
@@ -2254,7 +2254,7 @@ block_prompt(void)
{
char fp_tmpbuf[80];
char tmpfname[] = "buf.0";
- char mode[2] = "w";
+ char mode[2] = "w";
char choice[2];
move(b_lines - 1, 0);
@@ -2326,7 +2326,7 @@ enum {
static const char * const luaKeywords[] = {
"and", "break", "do", "else", "elseif",
- "end", "for", "if", "in", "not", "or",
+ "end", "for", "if", "in", "not", "or",
"repeat","return","then","until","while",
NULL
};
@@ -2344,7 +2344,7 @@ static const char * const luaFunctions[] = {
static const char * const luaMath[] = {
"abs", "acos", "asin", "atan", "atan2", "ceil", "cos", "cosh", "deg",
"exp", "floor", "fmod", "frexp", "ldexp", "log", "log10", "max", "min",
- "modf", "pi", "pow", "rad", "random", "randomseed", "sin", "sinh",
+ "modf", "pi", "pow", "rad", "random", "randomseed", "sin", "sinh",
"sqrt", "tan", "tanh",
NULL
};
@@ -2355,22 +2355,22 @@ static const char * const luaTable[] = {
};
static const char * const luaString[] = {
- "byte", "char", "dump", "find", "format", "gmatch", "gsub", "len",
+ "byte", "char", "dump", "find", "format", "gmatch", "gsub", "len",
"lower", "match", "rep", "reverse", "sub", "upper", NULL
};
static const char * const luaBbs[] = {
"ANSI_COLOR", "ANSI_RESET", "ESC", "addstr", "clear", "clock",
"clrtobot", "clrtoeol", "color", "ctime", "getch","getdata",
- "getmaxyx", "getstr", "getyx", "interface", "kball", "kbhit", "kbreset",
+ "getmaxyx", "getstr", "getyx", "interface", "kball", "kbhit", "kbreset",
"move", "moverel", "now", "outs", "pause", "print", "rect", "refresh",
- "setattr", "sitename", "sleep", "strip_ansi", "time", "title",
+ "setattr", "sitename", "sleep", "strip_ansi", "time", "title",
"userid", "usernick",
NULL
};
static const char * const luaToc[] = {
- "author", "date", "interface", "latestref",
+ "author", "date", "interface", "latestref",
"notes", "title", "version",
NULL
};
@@ -2403,7 +2403,7 @@ int synLuaKeyword(const char *text, int n, char *wlen)
// normal identifier
while (n-- > 0 && (isalnum(*text) || *text == '_'))
{
- text++;
+ text++;
(*wlen) ++;
}
return 0;
@@ -2413,7 +2413,7 @@ int synLuaKeyword(const char *text, int n, char *wlen)
// digits
while (n-- > 0 && (isdigit(*text) || *text == '.' || *text == 'x'))
{
- text++;
+ text++;
(*wlen) ++;
}
return 5;
@@ -2425,7 +2425,7 @@ int synLuaKeyword(const char *text, int n, char *wlen)
// length of identifier
while (n-- > 0 && (isalnum(*text) || *text == '_'))
{
- text++;
+ text++;
(*wlen) ++;
}
return -2;
@@ -2497,7 +2497,7 @@ int synLuaKeyword(const char *text, int n, char *wlen)
// calcualte wlen
while (n-- > 0 && (isalnum(*text) || *text == '_'))
{
- text++;
+ text++;
(*wlen) ++;
}
return 0;
@@ -2550,9 +2550,9 @@ void syn_pmore_render(char *os, int len, char *buf)
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
- case '8': case '9': case '.':
+ case '8': case '9': case '.':
*buf++ = attr;
- while (len > 0 && isascii(*s) &&
+ while (len > 0 && isascii(*s) &&
(isalnum(*s) || *s == '.') )
{
*buf++ = attr;
@@ -2572,7 +2572,7 @@ void syn_pmore_render(char *os, int len, char *buf)
case ':':
*buf++ = attr;
- while (len > 0 && isascii(*s) &&
+ while (len > 0 && isascii(*s) &&
(isalnum(*s) || *s == ':') )
{
*buf++ = attr;
@@ -2586,8 +2586,8 @@ void syn_pmore_render(char *os, int len, char *buf)
case 'G':
*buf++ = attr++;
prefix = 1;
- while (len > 0 &&
- ( (isascii(*s) && isalnum(*s)) ||
+ while (len > 0 &&
+ ( (isascii(*s) && isalnum(*s)) ||
strchr("+-,:lpf", *s)) )
{
if (prefix)
@@ -2597,7 +2597,7 @@ void syn_pmore_render(char *os, int len, char *buf)
prefix = 0;
}
*buf++ = attr;
- if (*s == ',')
+ if (*s == ',')
{
attr++;
prefix = 1;
@@ -2605,7 +2605,7 @@ void syn_pmore_render(char *os, int len, char *buf)
s++; len--;
}
attr++;
- return;
+ return;
case 'K':
*buf++ = attr;
@@ -2657,14 +2657,14 @@ edit_outs_attr_n(const char *text, int n, int attr)
#endif
#ifdef COLORED_SELECTION
- if ((attr & EOATTR_SELECTED) &&
+ if ((attr & EOATTR_SELECTED) &&
(attr & ~EOATTR_SELECTED))
{
reset = ANSI_COLOR(0;7;36);
doReset = 1;
outs(reset);
}
- else
+ else
#endif // if not defined, color by priority - selection first
if (attr & EOATTR_SELECTED)
{
@@ -2720,7 +2720,7 @@ edit_outs_attr_n(const char *text, int n, int attr)
}
}
- }
+ }
else if(ch == ESC_CHR)
{
inAnsi = 1;
@@ -2795,7 +2795,7 @@ edit_outs_attr_n(const char *text, int n, int attr)
} else if (ch == '-' && n > 0 && *(text) == '-') {
fComment = 1;
doReset = 1;
- outs(ANSI_COLOR(0;1;34));
+ outs(ANSI_COLOR(0;1;34));
} else if (ch == '[' && n > 0 && *(text) == '[') {
fSquareQuote = 1;
doReset = 1;
@@ -2865,7 +2865,7 @@ edit_outs_attr_n(const char *text, int n, int attr)
}
#endif // ENABLE_PMORE_ASCII_MOVIE_SYNTAX
}
- }
+ }
// this must be ANSI_RESET, not "reset".
if(inAnsi || doReset)
@@ -2902,7 +2902,7 @@ edit_ansi_outs(const char *str, int attr)
return edit_ansi_outs_n(str, strlen(str), attr);
}
-static int
+static int
detect_attr(const char *ps, size_t len)
{
int attr = 0;
@@ -2950,13 +2950,13 @@ display_textline_internal(textline_t *p, int i)
tmp = curr_buf->currln - curr_buf->curr_window_line + i;
- // parse attribute of line
-
+ // parse attribute of line
+
// selected attribute?
- if (has_block_selection() &&
+ if (has_block_selection() &&
( (curr_buf->blockln <= curr_buf->currln &&
curr_buf->blockln <= tmp && tmp <= curr_buf->currln) ||
- (curr_buf->currln <= tmp && tmp <= curr_buf->blockln)) )
+ (curr_buf->currln <= tmp && tmp <= curr_buf->blockln)) )
{
// outs(ANSI_REVERSE); // remove me when EOATTR is ready...
attr |= EOATTR_SELECTED;
@@ -2991,7 +2991,7 @@ display_textline_internal(textline_t *p, int i)
} else
#endif
- (*output)((curr_buf->edit_margin < p->len) ?
+ (*output)((curr_buf->edit_margin < p->len) ?
&p->data[curr_buf->edit_margin] : "", attr);
if (attr)
@@ -3163,7 +3163,7 @@ match_paren(void)
if (p)
i = p->len - 1;
lino--;
- }
+ }
while (p && i >= p->len) {
p = p->next;
i = 0;
@@ -3344,7 +3344,7 @@ insert_ansi_code(void)
strcpy(color, ESC_STR "[");
if (isdigit((int)*apos)) {
- sprintf(color,"%s%c", color, *(apos++));
+ sprintf(color,"%s%c", color, *(apos++));
if (*apos)
strcat(color, ";");
}
@@ -3385,7 +3385,7 @@ phone_mode_switch(void)
/**
* return coresponding phone char of given key c
*/
-static const char*
+static const char*
phone_char(char c)
{
if (curr_buf->last_phone_mode > 0 && curr_buf->last_phone_mode < 20) {
@@ -3509,7 +3509,7 @@ upload_file(void)
{
move(10, 0); clrtobot();
prints("\n\n資料接收中... %u 位元組。\n", (unsigned int)szdata);
- outs(ANSI_COLOR(1)
+ outs(ANSI_COLOR(1)
"◆全部完成後按下 End 或 ^X/^Q/^C 即可回到編輯畫面。"
ANSI_RESET "\n");
promptmsg = 0;
@@ -3543,7 +3543,7 @@ upload_file(void)
promptmsg = (szdata && szdata % 1024 == 0);
// all other keys are ignored.
- } while (c != KEY_END && c != Ctrl('X') &&
+ } while (c != KEY_END && c != Ctrl('X') &&
c != Ctrl('C') && c != Ctrl('Q') &&
curr_buf->totaln <= EDIT_LINE_LIMIT &&
szdata <= EDIT_SIZE_LIMIT);
@@ -3601,7 +3601,7 @@ vedit2(const char *fpath, int saveheader, int *islocal, char title[STRLEN], int
quoted = 1;
}
- if( curr_buf->oldcurrline != curr_buf->firstline ||
+ if( curr_buf->oldcurrline != curr_buf->firstline ||
curr_buf->currline != curr_buf->firstline) {
/* we must adjust because cursor (currentline) moved. */
curr_buf->oldcurrline = curr_buf->currline = curr_buf->top_of_win =
@@ -3609,7 +3609,7 @@ vedit2(const char *fpath, int saveheader, int *islocal, char title[STRLEN], int
}
/* No matter you quote or not, just start the cursor from (0,0) */
- curr_buf->currpnt = curr_buf->currln = curr_buf->curr_window_line =
+ curr_buf->currpnt = curr_buf->currln = curr_buf->curr_window_line =
curr_buf->edit_margin = curr_buf->last_margin = 0;
/* if quote, move to end of file. */
@@ -3648,7 +3648,7 @@ vedit2(const char *fpath, int saveheader, int *islocal, char title[STRLEN], int
if (interval && interval == tin)
{ // Ptt : +- 1 秒也算
count++;
- if(count>60)
+ if(count>60)
{
money = 0;
count = 0;
@@ -3656,7 +3656,7 @@ vedit2(const char *fpath, int saveheader, int *islocal, char title[STRLEN], int
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, Cdate(&now));
- post_violatelaw(cuser.userid, BBSMNAME "系統警察",
+ post_violatelaw(cuser.userid, BBSMNAME "系統警察",
"用機器人發表文章", "強制離站");
abort_bbs(0);
*/
@@ -3684,7 +3684,7 @@ vedit2(const char *fpath, int saveheader, int *islocal, char title[STRLEN], int
if (ch < 0x100 && isprint2(ch)) {
const char *pstr;
if(curr_buf->phone_mode && (pstr=phone_char(ch)))
- insert_dchar(pstr);
+ insert_dchar(pstr);
else
insert_char(ch);
curr_buf->lastindent = -1;
@@ -3727,7 +3727,7 @@ vedit2(const char *fpath, int saveheader, int *islocal, char title[STRLEN], int
case KEY_F10:
case Ctrl('X'): /* Save and exit */
block_cancel();
- tmp = write_file(fpath, saveheader, islocal, title,
+ tmp = write_file(fpath, saveheader, islocal, title,
(flags & EDITFLAG_UPLOAD) ? 1 : 0,
(flags & EDITFLAG_ALLOWTITLE) ? 1 : 0,
get_edit_kind_prompt(flags),
@@ -3883,8 +3883,8 @@ vedit2(const char *fpath, int saveheader, int *islocal, char title[STRLEN], int
}
#ifdef MAX_EDIT_LINE
- if(curr_buf->totaln ==
- ((flags & EDITFLAG_ALLOWLARGE) ?
+ if(curr_buf->totaln ==
+ ((flags & EDITFLAG_ALLOWLARGE) ?
MAX_EDIT_LINE_LARGE : MAX_EDIT_LINE))
{
vmsg("已到達最大行數限制。");
@@ -3930,7 +3930,7 @@ vedit2(const char *fpath, int saveheader, int *islocal, char title[STRLEN], int
// XXX This breaks emacs compatibility. Really bad,
// especially when some terminals just cannot send
- // vt100 arrow keys. However since this key binding
+ // vt100 arrow keys. However since this key binding
// has been changed for a long long time...
// We may need to change this back in the future, but
// not sure when.
@@ -4153,7 +4153,7 @@ vedit2(const char *fpath, int saveheader, int *islocal, char title[STRLEN], int
curr_buf->currln = 0;
edit_window_adjust();
-#ifdef DBCSAWARE
+#ifdef DBCSAWARE
if(mbcs_mode)
curr_buf->currpnt = fix_cursor(curr_buf->currline->data, curr_buf->currpnt, FC_LEFT);
#endif
diff --git a/pttbbs/mbbsd/fav.c b/pttbbs/mbbsd/fav.c
index 1ab239c3..e2c38185 100644
--- a/pttbbs/mbbsd/fav.c
+++ b/pttbbs/mbbsd/fav.c
@@ -7,27 +7,27 @@
* fav 檔的前兩個 byte 是版號,接下來才是真正的 data。
*
* fav 的主要架構如下:
- *
+ *
* fav_t - 用來裝各種 entry(fav_type_t) 的 directory
* 進入我的最愛時,看到的東西就是根據 fav_t 生出來的。
* 裡面紀錄者,這一個 level 中有多少個看板、目錄、分隔線。(favh)
* 是一個 array (with pre-allocated buffer)
- *
+ *
* fav_type_t - fav entry 的 base class
* 存取時透過 type 變數來得知正確的型態。
- *
+ *
* fav_board_t / fav_line_t / fav_folder_t - derived class
* 詳細情形請參考 fav.h 中的定義。
* 以 cast_(board|line|folder)_t 來將一個 fav_type_t 作動態轉型。
- *
+ *
* Policy
* ======
* 為了避免過度的資料搬移,當將一個 item 從我的最愛中移除時,只將他的
* FAVH_FAV flag 移除。而沒有這個 flag 的 item 也不被視為我的最愛。
- *
+ *
* 我的最愛中,沒設 FAVH_FAV 的資料,將在某些時候,如寫入檔案時,呼叫
* rebuild_fav 清除乾淨。
- *
+ *
* Others
* ======
* 站長搬移看板所用的 t ,因為不能只存在 nbrd 裡面,又不然再弄出額外的空間,
@@ -356,7 +356,7 @@ static int favcmp_by_name(const void *a, const void *b)
void fav_sort_by_name(void)
{
fav_t *fp = get_current_fav();
-
+
if (fp == NULL)
return;
@@ -390,7 +390,7 @@ static int favcmp_by_class(const void *a, const void *b)
void fav_sort_by_class(void)
{
fav_t *fp = get_current_fav();
-
+
if (fp == NULL)
return;
@@ -590,7 +590,7 @@ static void write_favrec(FILE *fwp, fav_t *fp)
fwrite(&fp->nLines, sizeof(fp->nLines), 1, fwp);
fwrite(&fp->nFolders, sizeof(fp->nFolders), 1, fwp);
fp->DataTail = get_data_number(fp);
-
+
for(i = 0; i < fp->DataTail; i++){
ft = &fp->favh[i];
fwrite(&ft->type, sizeof(ft->type), 1, fwp);
@@ -607,7 +607,7 @@ static void write_favrec(FILE *fwp, fav_t *fp)
break;
}
}
-
+
for(i = 0; i < fp->DataTail; i++){
if (fp->favh[i].type == FAVT_FOLDER)
write_favrec(fwp, get_fav_folder(&fp->favh[i]));
@@ -939,7 +939,7 @@ fav_type_t *fav_add_folder(void)
fav_type_t *fav_add_board(int bid)
{
fav_t *fp = get_current_fav();
- fav_type_t *ft = getboard(bid);
+ fav_type_t *ft = getboard(bid);
if (fp == NULL)
return NULL;
@@ -959,7 +959,7 @@ fav_type_t *fav_add_board(int bid)
* for administrator to move/administrate board
*/
fav_type_t *fav_add_admtag(int bid)
-{
+{
fav_t *fp = get_fav_root();
fav_type_t *ft;
if (is_maxsize())
@@ -969,8 +969,8 @@ fav_type_t *fav_add_admtag(int bid)
cast_board(ft)->bid = bid;
// turn on FAVH_ADM_TAG
set_attr(ft, FAVH_ADM_TAG, TRUE);
- return ft;
-}
+ return ft;
+}
/* everything about the tag in fav mode.
@@ -1088,7 +1088,7 @@ void fav_remove_all_tagged_item(void)
void fav_add_all_tagged_item(void)
{
// TODO we must check current (and the selected) tag length.
- // Copying a tree (current+target) with length larger than FAV_MAXDEPTH
+ // Copying a tree (current+target) with length larger than FAV_MAXDEPTH
// would make future entering to crash.
fav_set_tmp_folder(get_current_fav());
fav_dosomething_all_tagged_item(fav_add_tagged_item);
@@ -1166,7 +1166,7 @@ int updatenewfav(int mode)
}
brd[i] = BRD_END;
-
+
for(i = 0; i < brdnum && brd[i] != BRD_END; i++){
if(brd[i] == BRD_NEW){
/* check the permission if the board exsits */
@@ -1289,7 +1289,7 @@ static void fav4_read_favrec(FILE *frp, fav_t *fp)
ft->fp = (void *)fav_malloc(fav4_get_type_size(ft->type));
/* TODO A pointer has different size between 32 and 64-bit arch.
- * But the pointer in fav_folder_t is irrelevant here.
+ * But the pointer in fav_folder_t is irrelevant here.
* In order not to touch the current .fav4, fav_folder4_t is used
* here. It should be FIXED in the next version. */
switch (ft->type) {
diff --git a/pttbbs/mbbsd/friend.c b/pttbbs/mbbsd/friend.c
index 386ffc14..568571e3 100644
--- a/pttbbs/mbbsd/friend.c
+++ b/pttbbs/mbbsd/friend.c
@@ -143,7 +143,7 @@ friend_append(int type, int count)
setfriendfile(fpath, type);
- if (currboard && *currboard)
+ if (currboard && *currboard)
strcpy(myboard, currboard);
do {
@@ -538,12 +538,12 @@ friend_edit(int type)
// we have seen some BM hit this accidentally.. so ask again.
outs("整理名單可清除已消失、過期、或已有劣文的帳號。\n\n");
- getdata(2, 0,
+ getdata(2, 0,
"要從名單中清除幾個月沒上站的使用者? (0=不清除)[0] ",
uident, 4, NUMECHO);
expire = atoi(uident);
#ifdef ASSESS
- getdata(3, 0,
+ getdata(3, 0,
"要從名單中清除有幾篇以上劣文的使用者? (0=不清除)[0] ",
uident, 4, NUMECHO);
badpost = atoi(uident);
@@ -678,7 +678,7 @@ t_fix_aloha()
ANSI_COLOR(1) "如果你沒遇到此類問題可直接離開。" ANSI_RESET "\n\n"
"▼如果你遇到有人沒在你的上站通知名單內但又會丟上站通知水球給你,\n"
" 請輸入他的 ID。\n");
-
+
move(7, 0);
usercomplete("有誰不在你的通知名單內但又會送上站通知水球給您呢? ", xid);
diff --git a/pttbbs/mbbsd/gamble.c b/pttbbs/mbbsd/gamble.c
index 35774805..4a8c7b22 100644
--- a/pttbbs/mbbsd/gamble.c
+++ b/pttbbs/mbbsd/gamble.c
@@ -9,7 +9,7 @@
#ifndef GAMBLE_ACTION_DELAY_US
#define GAMBLE_ACTION_DELAY_US (0) // 每個動作之前的 delay
-#endif
+#endif
// Use "%lld" format string whenever you access variables in bignum_t.
typedef long long bignum_t;
@@ -70,8 +70,8 @@ show_ticket_data(char betname[MAX_ITEM][MAX_ITEM_LEN],
}
fclose(fp);
- prints(ANSI_COLOR(32) "站規:" ANSI_RESET
- " 1.可購買以下不同類型的彩券。每張要花 " ANSI_COLOR(32) "%d"
+ prints(ANSI_COLOR(32) "站規:" ANSI_RESET
+ " 1.可購買以下不同類型的彩券。每張要花 " ANSI_COLOR(32) "%d"
ANSI_RESET " " MONEYNAME "。\n"
" 2.%s\n"
" 3.開獎時只有一種彩券中獎, 有購買該彩券者, 則可依購買的張數均分總彩金。\n"
@@ -124,7 +124,7 @@ show_ticket_data(char betname[MAX_ITEM][MAX_ITEM_LEN],
return count;
}
-static int
+static int
append_ticket_record(const char *direct, int ch, int n, int count)
{
FILE *fp;
@@ -187,7 +187,7 @@ buy_ticket_ui(int money, const char *picture, int *item,
}
*item += num;
- pay(money * num, "%s彩券[種類%d,張數%d]", title, type+1, num);
+ pay(money * num, "%s彩券[種類%d,張數%d]", title, type+1, num);
// XXX magic numbers 5, 14...
show_file(picture, 5, 14, SHOWFILE_ALLOW_ALL);
@@ -247,7 +247,7 @@ ticket(int bid)
continue;
n = 0;
- buy_ticket_ui(price, "etc/buyticket", &n, ch,
+ buy_ticket_ui(price, "etc/buyticket", &n, ch,
bh ? bh->brdname : BBSMNAME);
if (bid && !dashf(fn_ticket))
@@ -265,7 +265,7 @@ ticket(int bid)
doesnt_catch_up:
price = price * n;
- // XXX 這是因為停止下注所以退錢? 感覺好危險+race condition
+ // XXX 這是因為停止下注所以退錢? 感覺好危險+race condition
if (price > 0) {
pay_as_uid(currutmp->uid, -price, "下注失敗退費");
}
@@ -333,7 +333,7 @@ openticket(int bid)
move(21, 0); SOLVE_ANSI_CACHE(); clrtoeol();
} while (bet != atoi(buf));
- // before we fork to process,
+ // before we fork to process,
// confirm lock status is correct.
setbfile(buf, bh->brdname, FN_TICKET_END);
setbfile(outcome, bh->brdname, FN_TICKET_LOCK);
@@ -458,7 +458,7 @@ openticket(int bid)
"%s 樂透退費! $ %lld", bh->brdname, money * i);
} else if (mybet == bet) {
if (fp)
- fprintf(fp, "恭喜 %-*s 買了 %3d 張 %s, 獲得 %5lld "
+ fprintf(fp, "恭喜 %-*s 買了 %3d 張 %s, 獲得 %5lld "
MONEYNAME "\n",
IDLEN, userid, i, betname[mybet], money * i);
snprintf(buf, sizeof(buf), "%s 中獎咧! $ %lld",
@@ -472,7 +472,7 @@ openticket(int bid)
if ((uid = searchuser(userid, userid)) == 0)
continue;
pay_as_uid(uid, -(money * i), BBSMNAME "彩券 - [%s]",
- betname[mybet]);
+ betname[mybet]);
mail_id(userid, buf, "etc/ticket.win", BBSMNAME "彩券");
}
fclose(fp1);
diff --git a/pttbbs/mbbsd/io.c b/pttbbs/mbbsd/io.c
index e0ba7cb2..ddd0a07a 100644
--- a/pttbbs/mbbsd/io.c
+++ b/pttbbs/mbbsd/io.c
@@ -111,7 +111,7 @@ oflush(void)
sprintf(xbuf, ESC_STR "[s" ESC_STR "[H" " [%lu/%lu] " ESC_STR "[u",
szLastOutput, szTotalOutput);
write(1, xbuf, strlen(xbuf));
- szLastOutput = 0;
+ szLastOutput = 0;
}
#endif // DBG_OUTRPT
@@ -133,7 +133,7 @@ ochar(int c)
#ifdef DBG_OUTRPT
// TODO we can support converted output in future.
c = fakeEscFilter(c);
- szTotalOutput ++;
+ szTotalOutput ++;
szLastOutput ++;
#endif // DBG_OUTRPT
@@ -153,19 +153,19 @@ ochar(int c)
/* pager processor */
/* ----------------------------------------------------- */
-int
+int
process_pager_keys(int ch)
{
static int water_which_flag = 0;
assert(currutmp);
- switch (ch)
+ switch (ch)
{
case Ctrl('U') :
if (!is_login_ready || !currutmp ||
!HasUserPerm(PERM_BASIC) || HasUserPerm(PERM_VIOLATELAW))
return ch;
if ( currutmp->mode == EDITING ||
- currutmp->mode == LUSERS ||
+ currutmp->mode == LUSERS ||
!currutmp->mode) {
return ch;
} else {
@@ -207,25 +207,25 @@ process_pager_keys(int ch)
// non-UFO
check_water_init();
- if (watermode > 0)
+ if (watermode > 0)
{
watermode = (watermode + water_which->count)
% water_which->count + 1;
t_display_new();
return KEY_INCOMPLETE;
- }
+ }
else if (watermode == 0 &&
currutmp->mode == 0 &&
(currutmp->chatid[0] == 2 || currutmp->chatid[0] == 3) &&
- water_which->count != 0)
+ water_which->count != 0)
{
/* 第二次按 Ctrl-R */
watermode = 1;
t_display_new();
return KEY_INCOMPLETE;
- }
- else if (watermode == -1 &&
- currutmp->msgs[0].pid)
+ }
+ else if (watermode == -1 &&
+ currutmp->msgs[0].pid)
{
/* 第一次按 Ctrl-R (必須先被丟過水球) */
screen_backup_t old_screen;
@@ -266,7 +266,7 @@ process_pager_keys(int ch)
break;
case KEY_TAB:
- if (watermode <= 0 ||
+ if (watermode <= 0 ||
(!PAGER_UI_IS(PAGER_UI_ORIG) || PAGER_UI_IS(PAGER_UI_NEW)))
break;
@@ -367,7 +367,7 @@ drop_input(void)
* =0 if nothing read
* <0 if need to read again
*/
-static inline ssize_t
+static inline ssize_t
read_vin() {
// Note: buf should be larger than pvin buffer size.
unsigned char buf[IBUFSIZE];
@@ -394,7 +394,7 @@ read_vin() {
#else
{
static char xbuf[128];
- sprintf(xbuf, ESC_STR "[s" ESC_STR "[2;1H [%ld] "
+ sprintf(xbuf, ESC_STR "[s" ESC_STR "[2;1H [%ld] "
ESC_STR "[u", len);
write(1, xbuf, strlen(xbuf));
}
@@ -493,7 +493,7 @@ dogetch(void)
if (vbuf_peek(pvin) == KEY_LF)
vbuf_pop(pvin);
return KEY_ENTER;
- }
+ }
else if (c == KEY_LF)
{
return KEY_UNKNOWN;
@@ -511,7 +511,7 @@ igetch(void)
{
register int ch;
- while (1)
+ while (1)
{
ch = dogetch();
@@ -566,7 +566,7 @@ igetch(void)
* if f < 0, wait forever.
* Return 1 if anything available.
*/
-static inline int
+static inline int
wait_input(float f, int bIgnoreBuf)
{
int sel = 0;
@@ -585,7 +585,7 @@ wait_input(float f, int bIgnoreBuf)
{
tv.tv_sec = (long) f;
tv.tv_usec = (f - (long)f) * 1000000L;
- }
+ }
else if (f == 0)
{
tv.tv_sec = 0;
@@ -642,7 +642,7 @@ vkey_is_full(void)
return vbuf_is_full(pvin);
}
-inline void
+inline void
vkey_purge(void)
{
int max_try = 64;
@@ -685,7 +685,7 @@ vkey_poll(int ms)
return wait_input(ms / (double)MILLISECONDS, 0);
}
-int
+int
vkey_prefetch(int timeout) {
if (wait_input(timeout / (double)MILLISECONDS, 1) && !vbuf_is_full(pvin))
read_vin();
@@ -696,7 +696,7 @@ int
vkey_is_prefetched(char c) {
// only ^x keys are safe to be detected.
// other keys may fall into escape sequence.
- assert (c == EOF || (c > 0 && c < ' '));
+ assert (c == EOF || (c > 0 && c < ' '));
if (c == EOF)
return 0;
diff --git a/pttbbs/mbbsd/kaede.c b/pttbbs/mbbsd/kaede.c
index 57b12ad7..1c521a07 100644
--- a/pttbbs/mbbsd/kaede.c
+++ b/pttbbs/mbbsd/kaede.c
@@ -22,7 +22,7 @@ expand_esc_star(char *buf, const char *src, int szbuf)
return 1;
//
// insecure content
- //
+ //
case 's': // current user id
strlcpy(buf, cuser.userid, szbuf);
return 2;
@@ -117,7 +117,7 @@ out_lines(const char *str, int line, int col)
{
move(++y, col);
line--;
- } else
+ } else
{
outc(*str);
}
diff --git a/pttbbs/mbbsd/mail.c b/pttbbs/mbbsd/mail.c
index 60745e6f..53521bc9 100644
--- a/pttbbs/mbbsd/mail.c
+++ b/pttbbs/mbbsd/mail.c
@@ -85,7 +85,7 @@ is_valid_email(const char *full_address)
return 0;
}
-int
+int
invalidaddr(const char *addr) {
int r = is_valid_email(addr);
if (r)
@@ -107,7 +107,7 @@ invalidaddr(const char *addr) {
if (bad_email_offset >= 0) {
char c = addr[bad_email_offset];
prints("錯誤位置: 第 %d 字元: 0x%02X [ %c ]",
- bad_email_offset, (unsigned char)c,
+ bad_email_offset, (unsigned char)c,
isascii(c) && isprint(c) ? c : ' ');
} else {
outs("錯誤原因: email 形式不正確 (非 user@host.domain)");
@@ -137,7 +137,7 @@ load_mailalert(const char *userid)
num = st.st_size / sizeof(fileheader_t);
if (num <= 0)
return 0;
- if (num > NEWMAIL_CHECK_RANGE)
+ if (num > NEWMAIL_CHECK_RANGE)
num = NEWMAIL_CHECK_RANGE;
/* 看看有沒有信件還沒讀過?從檔尾回頭檢查,效率較高 */
@@ -381,8 +381,8 @@ do_innersend(const char *userid, char *mfpath, const char *title, char *newtitle
strlcpy(mhdr.owner, cuser.userid, sizeof(mhdr.owner));
strlcpy(save_title, title, sizeof(save_title));
- if (vedit2(mfpath, YEA, NULL, save_title,
- EDITFLAG_ALLOWTITLE | EDITFLAG_KIND_SENDMAIL) == EDIT_ABORTED)
+ if (vedit2(mfpath, YEA, NULL, save_title,
+ EDITFLAG_ALLOWTITLE | EDITFLAG_KIND_SENDMAIL) == EDIT_ABORTED)
{
unlink(mfpath);
setutmpmode(oldstat);
@@ -553,7 +553,7 @@ setforward(void) {
" - 寄件者一律改為設定自動轉寄者的 ID\n"
" - 要先經過 Email 認證\n"
" - 不能設定為同站的其它使用者\n"
- "\n"
+ "\n"
"不便之處請多見諒\n"
ANSI_RESET "\n");
@@ -568,7 +568,7 @@ setforward(void) {
}
chomp(ip);
- prints("目前設定自動轉寄為: %s",
+ prints("目前設定自動轉寄為: %s",
dashf(buf) ? ip : ANSI_COLOR(1;31)"(關閉)" ANSI_RESET);
getdata_buf(b_lines - 1, 0, "請輸入自動轉寄的Email: ",
ip, sizeof(ip), DOECHO);
@@ -717,8 +717,8 @@ hold_mail(const char *fpath, const char *receiver, const char *title)
{
char buf[4];
- getdata(b_lines - 1, 0,
- (HasUserFlag(UF_DEFBACKUP)) ?
+ getdata(b_lines - 1, 0,
+ (HasUserFlag(UF_DEFBACKUP)) ?
"已順利寄出,是否自存底稿(Y/N)?[Y] " :
"已順利寄出,是否自存底稿(Y/N)?[N] ",
buf, sizeof(buf), LCECHO);
@@ -762,7 +762,7 @@ do_send(const char *userid, const char *title, const char *log_source)
sethomepath(fpath, cuser.userid);
stampfile(fpath, &mhdr);
- if (vedit2(fpath, NA, NULL, save_title,
+ if (vedit2(fpath, NA, NULL, save_title,
EDITFLAG_ALLOWTITLE | EDITFLAG_KIND_SENDMAIL) == EDIT_ABORTED) {
unlink(fpath);
clear();
@@ -781,7 +781,7 @@ do_send(const char *userid, const char *title, const char *log_source)
outs("Y\n請稍候, 信件傳遞中...\n");
ret = bsmtp(fpath, save_title, userid, NULL);
LOG_IF(LOG_CONF_INTERNETMAIL,
- log_filef("log/internet_mail.log", LOG_CREAT,
+ log_filef("log/internet_mail.log", LOG_CREAT,
"%s [%s - %s] %s -> %s: %s\n",
Cdatelite(&now), log_source, __FUNCTION__,
cuser.userid, userid, save_title));
@@ -936,7 +936,7 @@ multi_list(struct Vector *namelist, int *recipient)
}
return;
}
- }
+ }
}
static void
@@ -1341,7 +1341,7 @@ doforward(const char *direct, const fileheader_t * fh, int mode)
refresh();
/* 追蹤使用者 */
- if (HasUserPerm(PERM_LOGUSER))
+ if (HasUserPerm(PERM_LOGUSER))
log_user("mailforward to %s ",address);
// 處理站內黑名單
@@ -1349,7 +1349,7 @@ doforward(const char *direct, const fileheader_t * fh, int mode)
char xid[IDLEN+1], *dot;
strlcpy(xid, address, sizeof(xid));
- dot = strchr(xid, '.');
+ dot = strchr(xid, '.');
if (dot) *dot = 0;
dot = strcasestr(address, ".bbs@");
@@ -1433,7 +1433,7 @@ doforward(const char *direct, const fileheader_t * fh, int mode)
if (hostaddr) {
LOG_IF(LOG_CONF_INTERNETMAIL,
- log_filef("log/internet_mail.log", LOG_CREAT,
+ log_filef("log/internet_mail.log", LOG_CREAT,
"%s [%s] %s -> %s: %s - %s\n",
Cdatelite(&now), __FUNCTION__,
cuser.userid, address, direct, fh->title));
@@ -1457,7 +1457,7 @@ mailtitle(void)
}
showtitle("郵件選單", BBSName);
- prints("[←]離開[↑↓]選擇[→]閱\讀信件 [O]站外信:%s [h]求助 %s\n" ,
+ prints("[←]離開[↑↓]選擇[→]閱\讀信件 [O]站外信:%s [h]求助 %s\n" ,
REJECT_OUTTAMAIL(cuser) ? ANSI_COLOR(31) "關" ANSI_RESET : "開",
#ifdef USE_TIME_CAPSULE
"[~]" RECYCLE_BIN_NAME
@@ -1479,13 +1479,13 @@ maildoent(int num, fileheader_t * ent)
{
type = (ent->filemode & FILE_READ) ?
'm' : 'M';
- }
+ }
else if (ent->filemode & FILE_REPLIED)
{
type = (ent->filemode & FILE_READ) ?
'r' : 'R';
- }
- else
+ }
+ else
{
type = (ent->filemode & FILE_READ) ?
' ' : '+';
@@ -1510,7 +1510,7 @@ maildoent(int num, fileheader_t * ent)
color = ANSI_COLOR(1;31);
break;
}
-
+
strlcpy(datepart, ent->date, sizeof(datepart));
isonline = query_online(ent->owner);
@@ -1521,10 +1521,10 @@ maildoent(int num, fileheader_t * ent)
color = "";
}
- prints("%6d %c %-6s%s%-15.14s%s%s %s%-*.*s%s\n",
- num, type, datepart,
+ prints("%6d %c %-6s%s%-15.14s%s%s %s%-*.*s%s\n",
+ num, type, datepart,
isonline ? ANSI_COLOR(1) : "",
- ent->owner,
+ ent->owner,
isonline ? ANSI_RESET : "",
mark, color,
t_columns - 34, t_columns - 34,
@@ -1880,7 +1880,7 @@ mail_cross_post(int unused_arg GCC_UNUSED, fileheader_t * fhdr,
#ifdef USE_POSTRECORD
if (postrecord.times > 1)
{
- outs(ANSI_COLOR(1;31)
+ outs(ANSI_COLOR(1;31)
"請注意: 若過量重複轉錄將視為洗板,導致被開罰單停權。\n" ANSI_RESET
"若有特別需求請洽各板主,請他們幫你轉文。\n\n");
}
@@ -1907,7 +1907,7 @@ mail_cross_post(int unused_arg GCC_UNUSED, fileheader_t * fhdr,
#endif
} else {
// process and determine 'cross-post'
-
+
int hash = StringHash(fhdr->title);
/* 同樣 title 不管對哪個板都算 cross post , 所以不用檢查 author */
@@ -2052,7 +2052,7 @@ mail_cite(int ent GCC_UNUSED, fileheader_t * fhdr, const char *direct GCC_UNUSED
setbdir(backup_path, xboard);
setutmpmode(ANNOUNCE);
// TODO what's the backup_path here?
- a_menu(xboard, fpath,
+ a_menu(xboard, fpath,
HasUserPerm(PERM_ALLBOARD) ? 2 : is_BM_cache(bid) ? 1 : 0,
bid, NULL, backup_path);
} else {
@@ -2245,7 +2245,7 @@ static const onekey_t mail_comms[] = {
{ 0, NULL }, // Ctrl('F')
{ 0, built_mail_index }, // Ctrl('G')
{ 0, NULL }, // Ctrl('H')
- { 0, toggle_showmail_mode }, // Ctrl('I')
+ { 0, toggle_showmail_mode }, // Ctrl('I')
{ 0, NULL }, // Ctrl('J')
{ 0, NULL }, // Ctrl('K')
{ 0, NULL }, // Ctrl('L')
diff --git a/pttbbs/mbbsd/mbbsd.c b/pttbbs/mbbsd/mbbsd.c
index 3ea34bdf..4a72f87a 100644
--- a/pttbbs/mbbsd/mbbsd.c
+++ b/pttbbs/mbbsd/mbbsd.c
@@ -21,7 +21,7 @@ static void getremotename(const struct in_addr from, char *rhost);
//////////////////////////////////////////////////////////////////
// Site Optimization
-// override these macro if you need more optimization,
+// override these macro if you need more optimization,
// based on OS/lib/package...
#ifndef OPTIMIZE_SOCKET
#define OPTIMIZE_SOCKET(sock) do {} while (0)
@@ -58,7 +58,7 @@ struct ProgramOption {
char flag_user[IDLEN+1];
};
-static void
+static void
free_program_option(struct ProgramOption *opt)
{
if (!opt)
@@ -173,7 +173,7 @@ log_usies(const char *mode, const char *mesg)
{
now = time(NULL);
if (!mesg)
- log_filef(FN_USIES, LOG_CREAT,
+ log_filef(FN_USIES, LOG_CREAT,
"%s %s %-12s Stay:%d\n",
Cdate(&now), mode, cuser.userid ,
(int)(now - login_start_time) / 60);
@@ -295,7 +295,7 @@ abort_bbs_debug(int sig)
/* log */
/* assume vsnprintf() in log_file() is signal-safe, is it? */
- log_filef("log/crash.log", LOG_CREAT,
+ log_filef("log/crash.log", LOG_CREAT,
"%d %d %d %.12s\n", (int)time4(NULL), getpid(), sig, cuser.userid);
/* try logout... not a good idea, maybe crash again. now disabled */
@@ -672,7 +672,7 @@ multi_user_check(void)
}
}
-void
+void
mkuserdir(const char *userid)
{
char genbuf[PATHLEN];
@@ -694,7 +694,7 @@ load_current_user(const char *uid)
is_admin_only = (listen_port == ADMIN_PORT);
#endif
- // ----------------------------------------------------- NEW ACCOUNT
+ // ----------------------------------------------------- NEW ACCOUNT
#ifdef STR_REGNEW
if (!is_admin_only && strcasecmp(uid, STR_REGNEW) == 0) {
@@ -707,28 +707,28 @@ load_current_user(const char *uid)
new_register();
mkuserdir(cuser.userid);
reginit_fav();
- } else
+ } else
#endif
- // --------------------------------------------------- GUEST ACCOUNT
-
+ // --------------------------------------------------- GUEST ACCOUNT
+
#ifdef STR_GUEST
if (!is_admin_only && strcasecmp(uid, STR_GUEST) == 0) {
if (initcuser(STR_GUEST)< 1) exit (0) ;
pwcuInitGuestPerm();
// can we prevent mkuserdir() here?
mkuserdir(cuser.userid);
- } else
+ } else
#endif
- // ---------------------------------------------------- USER ACCOUNT
+ // ---------------------------------------------------- USER ACCOUNT
{
if (!cuser.userid[0] && initcuser(uid) < 1)
exit(0);
if (is_admin_only) {
- if (!HasUserPerm(PERM_SYSOP | PERM_BBSADM | PERM_BOARD |
- PERM_ACCOUNTS | PERM_CHATROOM |
+ if (!HasUserPerm(PERM_SYSOP | PERM_BBSADM | PERM_BOARD |
+ PERM_ACCOUNTS | PERM_CHATROOM |
PERM_VIEWSYSOP | PERM_PRG)) {
puts("\r\n權限不足,請換其它 port 連線。\r\n");
exit(0);
@@ -797,7 +797,7 @@ login_query(char *ruid)
if (getdata(20, 0, "請輸入代號,或以 guest 參觀,或以 new 註冊: ",
uid, sizeof(uid), DOECHO) < 1)
{
- // got nothing
+ // got nothing
outs("請重新輸入。\n");
continue;
}
@@ -855,7 +855,7 @@ login_query(char *ruid)
move (22, 0); clrtoeol();
outs("正在檢查密碼...");
- move(22, 0); refresh();
+ move(22, 0); refresh();
/* prepare for later */
clrtoeol();
@@ -871,7 +871,7 @@ login_query(char *ruid)
} else {
strlcpy(ruid, cuser.userid, IDLEN+1);
- outs("密碼正確! 開始登入系統...");
+ outs("密碼正確! 開始登入系統...");
move(22, 0); refresh();
clrtoeol();
break;
@@ -983,8 +983,8 @@ setup_utmp(int mode)
inline static void welcome_msg(void)
{
- prints(ANSI_RESET " 歡迎您再度拜訪本站,上次您是從 "
- ANSI_COLOR(1;33) "%s" ANSI_COLOR(0;37) " 連往本站,"
+ prints(ANSI_RESET " 歡迎您再度拜訪本站,上次您是從 "
+ ANSI_COLOR(1;33) "%s" ANSI_COLOR(0;37) " 連往本站,"
ANSI_CLRTOEND "\n"
" 我記得那天是 " ANSI_COLOR(1;33) "%s" ANSI_COLOR(0;37) "。"
ANSI_CLRTOEND "\n"
@@ -1057,7 +1057,7 @@ check_bad_clients(void) {
buf, 3, LCECHO);
} while (*buf != 'm' && *buf != 'b');
mvprints(y++, 0, "發文位置: %s", *buf == 'm' ? "信箱" : "看板");
- log_filef(dest, LOG_CREAT, "%s location: %c %s\n", Cdatelite(&now),
+ log_filef(dest, LOG_CREAT, "%s location: %c %s\n", Cdatelite(&now),
*buf, *buf == 'm' ? "mailbox" : "board");
do {
@@ -1076,15 +1076,15 @@ inline static void append_log_recent_login()
int szlogfn = 0, szlogentry = 0;
// prepare log format
- snprintf(buf, sizeof(buf), "%s %-15s\n",
+ snprintf(buf, sizeof(buf), "%s %-15s\n",
Cdatelite(&login_start_time), fromhost);
szlogentry = strlen(buf); // should be the same for all entries
-
+
setuserfile(logfn, FN_RECENTLOGIN);
szlogfn = dashs(logfn);
if (szlogfn > SZ_RECENTLOGIN) {
// rotate to 1/4 of SZ_RECENTLOGIN
- delete_records(logfn, szlogentry, 1,
+ delete_records(logfn, szlogentry, 1,
(szlogfn-(SZ_RECENTLOGIN/4)) / szlogentry);
}
log_file(logfn, LOG_CREAT, buf);
@@ -1210,7 +1210,7 @@ user_login(void)
}
// XXX 這個 check 花不少時間,有點間隔比較好
- if (HasUserPerm(PERM_BM) &&
+ if (HasUserPerm(PERM_BM) &&
(cuser.numlogindays % 10 == 0) && // when using numlogindays, check with is_first_login_of_today
is_first_login_of_today )
check_BM(); /* 自動取下離職板主權力 */
@@ -1324,7 +1324,7 @@ do_aloha(const char *hello)
while (fgets(userid, 80, fp)) {
userinfo_t *uentp;
chomp(userid);
- if ((uentp = (userinfo_t *) search_ulist_userid(userid)) &&
+ if ((uentp = (userinfo_t *) search_ulist_userid(userid)) &&
isvisible(uentp, currutmp) &&
strcasecmp(uentp->userid, cuser.userid) != 0) {
my_write(uentp->pid, hello, uentp->userid, WATERBALL_ALOHA,
@@ -1342,7 +1342,7 @@ do_term_init(enum TermMode term_mode, int w, int h)
initscr();
// if the terminal was already determined, resize for it.
- if ((w && (w != t_columns)) ||
+ if ((w && (w != t_columns)) ||
(h && (h != t_lines )) )
{
term_resize(w, h);
@@ -1417,14 +1417,14 @@ getremotename(const struct in_addr fromaddr, char *rhost)
XAUTH_HOST(strcpy(rhost, (char *)inet_ntoa(fromaddr)));
}
-static int
+static int
set_connection_opt(int sock)
{
const int szrecv = 1024, szsend=4096;
const struct linger lin = {0};
// keep alive: server will check target connection (default 2 hours)
- const int on = 1;
+ const int on = 1;
setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void*)&on, sizeof(on));
#if defined(SOL_TCP) && defined(TCP_KEEPIDLE)
@@ -1433,7 +1433,7 @@ set_connection_opt(int sock)
setsockopt(sock, SOL_TCP, TCP_KEEPIDLE, (void*)&idle, sizeof(idle));
}
#endif
-
+
// fast close
setsockopt(sock, SOL_SOCKET, SO_LINGER, &lin, sizeof(lin));
@@ -1519,7 +1519,7 @@ static void init(void)
mallopt (M_TOP_PAD, MY__TOP_PAD);
#endif
-
+
}
static void usage(char *argv0)
@@ -1776,7 +1776,7 @@ main(int argc, char *argv[], char *envp[])
return 0;
}
- do_term_init(option->term_mode,
+ do_term_init(option->term_mode,
option->term_width, option->term_height);
if (option->tunnel_mode)
@@ -1816,7 +1816,7 @@ shell_login(char *argv0, struct ProgramOption *option)
snprintf(margs, sizeof(margs), "%s ssh ", argv0);
close(2);
/* don't close fd 1, at least init_tty need it */
- if(((fd = OpenCreate("log/stderr", O_WRONLY | O_APPEND)) >= 0) &&
+ if(((fd = OpenCreate("log/stderr", O_WRONLY | O_APPEND)) >= 0) &&
fd != 2 ){
dup2(fd, 2);
close(fd);
@@ -1865,7 +1865,7 @@ tunnel_login(char *argv0, struct ProgramOption *option)
tunnel = toconnect(option->flag_tunnel_path);
if (tunnel < 0)
{
- syslog(LOG_ERR, "mbbsd tunnel connection failed: %s\n",
+ syslog(LOG_ERR, "mbbsd tunnel connection failed: %s\n",
option->flag_tunnel_path);
exit(1);
}
@@ -2003,7 +2003,7 @@ daemon_login(char *argv0, struct ProgramOption *option)
snprintf(margs, sizeof(margs), "%s %d ", argv0, listen_port);
setproctitle("%s: listening ", margs);
#endif
-
+
// Load ban ip table.
banip = load_banip_list(FN_CONF_BANIP, NULL);
@@ -2163,5 +2163,5 @@ check_ban_and_load(int fd, struct ProgramOption *option,
return 0;
}
-/* vim: sw=4
+/* vim: sw=4
*/
diff --git a/pttbbs/mbbsd/menu.c b/pttbbs/mbbsd/menu.c
index 2c69fac9..c960b423 100644
--- a/pttbbs/mbbsd/menu.c
+++ b/pttbbs/mbbsd/menu.c
@@ -30,31 +30,31 @@ enum {
TITLE_TAIL_DIGEST,
};
-// 由於歷史因素,這裡會出現三種編號:
+// 由於歷史因素,這裡會出現三種編號:
// MODE (定義於 modes.h) 是 BBS 對各種功能在 utmp 的編號 (var.c 要加字串)
// Menu Index (M_*) 是 menu.c 內部分辨選單要對應哪個 mode 的 index
// AdBanner Index 是動態看版要顯示什麼的值
// 從前這是用兩個 mode map 來轉換的 (令人看得滿頭霧水)
// 重整後 Menu Index 跟 AdBanner Index 合一,請見下面的說明
///////////////////////////////////////////////////////////////////////
-// AdBanner (SHM->notes) 前幾筆是 Note 板精華區「<系統> 動態看板」(SYS)
+// AdBanner (SHM->notes) 前幾筆是 Note 板精華區「<系統> 動態看板」(SYS)
// 目錄下的文章,所以編排 Menu (M_*) 時要照其順序:
// 精華區編號 => Menu Index => MODE
// (AdBannerIndex)
// ====================================
// 00離站畫面 => M_GOODBYE
-// 01主選單 => M_MMENU => MMENU
-// 02系統維護區 => M_ADMIN => ADMIN
-// 03私人信件區 => M_MAIL => MAIL
-// 04休閒聊天區 => M_TMENU => TMENU
-// 05個人設定區 => M_UMENU => UMENU
-// 06系統工具區 => M_XMENU => XMENU
-// 07娛樂與休閒 => M_PMENU => PMENU
-// 08Ptt搜尋器 => M_SREG => SREG
-// 09Ptt量販店 => M_PSALE => PSALE
-// 10Ptt遊樂場 => M_AMUSE => AMUSE
-// 11Ptt棋院 => M_CHC => CHC
-// 12特別名單 => M_NMENU => NMENU
+// 01主選單 => M_MMENU => MMENU
+// 02系統維護區 => M_ADMIN => ADMIN
+// 03私人信件區 => M_MAIL => MAIL
+// 04休閒聊天區 => M_TMENU => TMENU
+// 05個人設定區 => M_UMENU => UMENU
+// 06系統工具區 => M_XMENU => XMENU
+// 07娛樂與休閒 => M_PMENU => PMENU
+// 08Ptt搜尋器 => M_SREG => SREG
+// 09Ptt量販店 => M_PSALE => PSALE
+// 10Ptt遊樂場 => M_AMUSE => AMUSE
+// 11Ptt棋院 => M_CHC => CHC
+// 12特別名單 => M_NMENU => NMENU
///////////////////////////////////////////////////////////////////////
// 由於 MODE 與 menu 的順序現在已不一致 (最早可能是一致的),所以中間的
// 轉換是靠 menu_mode_map 來處理。
@@ -69,7 +69,7 @@ enum {
M_UMENU, M_XMENU, M_PMENU,M_SREG,
M_PSALE, M_AMUSE, M_CHC, M_NMENU,
- M_MENU_MAX, // 這是 menu (M_*) 的最大值
+ M_MENU_MAX, // 這是 menu (M_*) 的最大值
N_SYSADBANNER = M_MENU_MAX, // 定義 M_* 到多少有對應的 ADBANNER
M_MENU_REFRESH= -1, // 系統用不到的 index 值 (可顯示其它活動與點歌)
};
@@ -109,7 +109,7 @@ showtitle(const char *title, const char *mid)
#ifdef DEBUG
{
sprintf(buf, " current pid: %6d ", getpid());
- mid = buf;
+ mid = buf;
mid_attr = ANSI_COLOR(41;5);
}
#else
@@ -196,7 +196,7 @@ int TopBoards(void);
static char zacmd = 0;
// ZA is waiting, hurry to the meeting stone!
-int
+int
ZA_Waiting(void)
{
return (zacmd != 0);
@@ -235,7 +235,7 @@ ZA_Select(void)
}
// The ZA processor, only invoked in menu.
-void
+void
ZA_Enter(void)
{
char cmd = zacmd;
@@ -300,9 +300,9 @@ show_status(void)
localtime4_r(&now, &ptime);
i = ptime.tm_wday << 1;
move(b_lines, 0);
- vbarf(ANSI_COLOR(34;46) "[%d/%d 星期%c%c %d:%02d]"
+ vbarf(ANSI_COLOR(34;46) "[%d/%d 星期%c%c %d:%02d]"
ANSI_COLOR(1;33;45) "%-14s"
- ANSI_COLOR(30;47) " 線上" ANSI_COLOR(31)
+ ANSI_COLOR(30;47) " 線上" ANSI_COLOR(31)
"%d" ANSI_COLOR(30) "人, 我是" ANSI_COLOR(31) "%s"
ANSI_COLOR(30) "\t[呼叫器]" ANSI_COLOR(31) "%s ",
ptime.tm_mon + 1, ptime.tm_mday, myweek[i], myweek[i + 1],
@@ -338,32 +338,32 @@ adbanner(int menu_index)
return;
if ( i != M_MENU_REFRESH &&
- i >= 0 &&
+ i >= 0 &&
i < N_SYSADBANNER &&
- i <= SHM->last_film)
+ i <= SHM->last_film)
{
// use system menu - i
} else {
- // To display ADBANNERs in slide show mode.
- // Since menu is updated per hour, the total presentation time
+ // To display ADBANNERs in slide show mode.
+ // Since menu is updated per hour, the total presentation time
// should be less than one hour. 60*60/MAX_ADBANNER[500]=7 (seconds).
- // @ Note: 60 * 60 / MAX_ADBANNER =3600/MAX_ADBANNER = "how many seconds
+ // @ Note: 60 * 60 / MAX_ADBANNER =3600/MAX_ADBANNER = "how many seconds
// can one ADBANNER to display" to slide through every banners in one hour.
// @ now / (3600 / MAx_ADBANNER) means "get the index of which to show".
// syncnow();
-
+
const int slideshow_duration = 3600 / MAX_ADBANNER,
slideshow_index = now / slideshow_duration;
- // index range: 0 =>[system] => N_SYSADBANNER => [user esong] =>
+ // index range: 0 =>[system] => N_SYSADBANNER => [user esong] =>
// last_usong => [advertisements] => last_film
int valid_usong_range = (SHM->last_usong > N_SYSADBANNER &&
SHM->last_usong < SHM->last_film);
-
+
if (SHM->last_film > N_SYSADBANNER) {
if (HasUserFlag(UF_ADBANNER_USONG) || !valid_usong_range)
i = N_SYSADBANNER + slideshow_index % (SHM->last_film+1-N_SYSADBANNER);
- else
+ else
i = SHM->last_usong + 1 + slideshow_index % (SHM->last_film - SHM->last_usong);
}
else
@@ -401,7 +401,7 @@ show_menu(int menu_index, const commands_t * p)
// update menu column [fixed const because most items are designed as fixed)
menu_column = (t_columns-40)/2;
row = 12 + (t_lines-24)/2;
-#endif
+#endif
#ifdef EXP_ALERT_ADBANNER_USONG
if ((p[0].level && !HasUserPerm(p[0].level)) &&
@@ -424,7 +424,7 @@ show_menu(int menu_index, const commands_t * p)
while ((s = p[n].desc)) {
if (CheckMenuPerm(p[n].level)) {
prints("%*s (%s%c" ANSI_RESET ")%s\n",
- menu_column, "",
+ menu_column, "",
(HasUserFlag(UF_MENU_LIGHTBAR) ? ANSI_COLOR(36) :
ANSI_COLOR(1;36)), s[0], s+1);
}
@@ -633,7 +633,7 @@ static int deprecate_userlist() {
static const commands_t m_admin_money[] = {
{view_user_money_log, PERM_SYSOP|PERM_ACCOUNTS,
"View Log 檢視交易記錄"},
- {give_money, PERM_SYSOP|PERM_VIEWSYSOP, "Givemoney 紅包雞"},
+ {give_money, PERM_SYSOP|PERM_VIEWSYSOP, "Givemoney 紅包雞"},
{NULL, 0, NULL}
};
@@ -652,14 +652,14 @@ static const commands_t m_admin_user[] = {
static const commands_t adminlist[] = {
{m_user, PERM_SYSOP, "User 使用者資料"},
{m_board, PERM_SYSOP|PERM_BOARD, "Board 設定看板"},
- {m_register,
+ {m_register,
PERM_ACCOUNTS|PERM_ACCTREG, "Register 審核註冊表單"},
{x_file, PERM_SYSOP|PERM_VIEWSYSOP, "Xfile 編輯系統檔案"},
{x_admin_money, PERM_SYSOP|PERM_ACCOUNTS|PERM_VIEWSYSOP,
"Money 【" MONEYNAME "相關】"},
{x_admin_user, PERM_SYSOP|PERM_ACCOUNTS|PERM_BOARD|PERM_POLICE_MAN,
"LUser Log 【使用者資料記錄】"},
- {search_user_bypwd,
+ {search_user_bypwd,
PERM_ACCOUNTS|PERM_POLICE_MAN, "Search User 特殊搜尋使用者"},
{m_loginmsg, PERM_SYSOP, "GMessage Login 進站水球"},
{NULL, 0, NULL}
@@ -672,7 +672,7 @@ static const commands_t maillist[] = {
{mail_list, PERM_LOGINOK, "Mail List 群組寄信"},
{setforward, PERM_LOGINOK, "Forward 設定信箱自動轉寄" },
{mail_mbox, PERM_INTERNET, "Zip UserHome 把所有私人資料打包回去"},
- {built_mail_index,
+ {built_mail_index,
PERM_LOGINOK, "Savemail 重建信箱索引"},
{mail_all, PERM_SYSOP, "All 寄信給所有使用者"},
{NULL, 0, NULL}
@@ -707,7 +707,7 @@ static const commands_t talklist[] = {
{deprecate_userlist, 0, "Pager 切換呼叫器"},
{t_qchicken, 0, "Watch Pet 查詢寵物"},
#ifdef PLAY_ANGEL
- {a_changeangel,
+ {a_changeangel,
PERM_LOGINOK, "AChange Angel 更換小天使"},
{menu_angelbeats, PERM_ANGEL|PERM_SYSOP,
"BAngel Beats! 天使公會"},
@@ -748,7 +748,7 @@ static int u_view_recentpay()
{
char fn[PATHLEN];
clear();
- mvouts(10, 5, "注意: 此處內容僅供參考,實際" MONEYNAME
+ mvouts(10, 5, "注意: 此處內容僅供參考,實際" MONEYNAME
"異動以站方內部資料為準");
pressanykey();
setuserfile(fn, FN_RECENTPAY);
@@ -786,7 +786,7 @@ u_mylogs()
void Customize(); // user.c
-static int
+static int
u_customize()
{
Customize();
@@ -805,7 +805,7 @@ static const commands_t userlist[] = {
#ifdef ASSESS
{u_cancelbadpost,PERM_LOGINOK, "Bye BadPost 申請刪除劣文"},
#endif // ASSESS
- {deprecate_userlist, 0, "KCloak 隱身術"},
+ {deprecate_userlist, 0, "KCloak 隱身術"},
{NULL, 0, NULL}
};
@@ -889,7 +889,7 @@ static const commands_t m_xyz_hot[] = {
/* XYZ tool sub menu */
static const commands_t m_xyz_user[] = {
{x_user100 ,0, "Users 《使用者百大排行榜》"},
- {topsong,PERM_LOGINOK,
+ {topsong,PERM_LOGINOK,
"GTop Songs 《使用者心情點播排行》"},
{x_today, 0, "Today 《今日上線人次統計》"},
{x_yesterday, 0, "Yesterday 《昨日上線人次統計》"},
@@ -932,7 +932,7 @@ static const commands_t xyzlist[] = {
#endif
#else // !DEBUG
- {_debug_reportstruct, 0,
+ {_debug_reportstruct, 0,
"ReportStruct 報告各種結構的大小"},
#endif // !DEBUG
@@ -950,7 +950,7 @@ static const commands_t moneylist[] = {
};
static const commands_t cmdlist[] = {
- {admin, PERM_SYSOP|PERM_ACCOUNTS|PERM_BOARD|PERM_VIEWSYSOP|PERM_ACCTREG|PERM_POLICE_MAN,
+ {admin, PERM_SYSOP|PERM_ACCOUNTS|PERM_BOARD|PERM_VIEWSYSOP|PERM_ACCTREG|PERM_POLICE_MAN,
"0Admin 【 系統維護區 】"},
{Announce, 0, "Announce 【 精華公佈欄 】"},
#ifdef DEBUG
@@ -991,7 +991,7 @@ static int chessroom();
/* Ptt Play menu */
static const commands_t playlist[] = {
{p_money, PERM_LOGINOK, "Pay 【 " BBSMNAME2 "量販店 】"},
- {chicken_main, PERM_LOGINOK,
+ {chicken_main, PERM_LOGINOK,
"Chicken 【 " BBSMNAME2 "養雞場 】"},
{ticket_main, PERM_LOGINOK,
"Gamble 【 " BBSMNAME2 "彩券 】"},
@@ -1078,4 +1078,4 @@ Name_Menu(void)
domenu(M_NMENU, "名單編輯", 'O', namelist);
return 0;
}
-
+
diff --git a/pttbbs/mbbsd/more.c b/pttbbs/mbbsd/more.c
index ae9c8523..d465f9b1 100644
--- a/pttbbs/mbbsd/more.c
+++ b/pttbbs/mbbsd/more.c
@@ -20,7 +20,7 @@
* documentation and/or other materials provided with the distribution.
*/
-static int
+static int
check_sysop_edit_perm(const char *fpath)
{
if (!HasUserPerm(PERM_SYSOP) ||
@@ -46,7 +46,7 @@ check_sysop_edit_perm(const char *fpath)
return 1;
}
-static int
+static int
common_pager_key_handler(int ch, void *ctx GCC_UNUSED)
{
switch(ch)
@@ -64,7 +64,7 @@ common_pager_key_handler(int ch, void *ctx GCC_UNUSED)
break;
return RET_DOBBSLUA;
#endif
-
+
// Query information and file touch
case 'Q':
return RET_DOQUERYINFO;
@@ -107,11 +107,11 @@ common_pager_key_handler(int ch, void *ctx GCC_UNUSED)
currstat != READING)
break;
return RET_SELECTAID;
-
+
/* ------- SOB THREADED NAVIGATION EXITING KEYS ------- */
// I'm not sure if these keys are all invented by SOB,
// but let's honor their names.
- // Kaede, Raw, Izero, woju - you are all TWBBS heroes
+ // Kaede, Raw, Izero, woju - you are all TWBBS heroes
// -- by piaip, 2008.
case 'A':
return AUTHOR_PREV;
@@ -147,7 +147,7 @@ common_pager_exit_handler(int r, const char *fpath)
if (!check_sysop_edit_perm(fpath))
break;
log_filef("log/security", LOG_CREAT,
- "%u %s %d %s admin edit file=%s\n",
+ "%u %s %d %s admin edit file=%s\n",
(int)now, Cdate(&now), getpid(), cuser.userid, fpath);
veditfile(fpath);
break;
@@ -182,7 +182,7 @@ common_pager_exit_handler(int r, const char *fpath)
case RET_DOBBSLUA:
r = FULLUPDATE;
// check permission again
- if (HasUserPerm(PERM_BASIC))
+ if (HasUserPerm(PERM_BASIC))
bbslua(fpath);
break;
#endif
@@ -210,67 +210,67 @@ int more(const char *fpath, int promptend)
int lpos[PAGER_MAXLINES] = {0}; // line position
char buf [ANSILINELEN];
- if (!fp) return -1;
+ if (!fp) return -1;
clear();
if (promptend == NA) { // quick print one page
for (i = 0; i < t_lines-1; i++)
- if (!fgets(buf, sizeof(buf), fp))
- break;
- else
+ if (!fgets(buf, sizeof(buf), fp))
+ break;
+ else
outs(buf);
- fclose(fp);
+ fclose(fp);
return 0;
}
// YEA mode: pre-read
- while (lines < PAGER_MAXLINES-1 &&
+ while (lines < PAGER_MAXLINES-1 &&
fgets(buf, sizeof(buf), fp) != NULL)
lpos[++lines] = ftell(fp);
rewind(fp);
- while (!abort)
+ while (!abort)
{
if (oldlineno != lineno) // seek and print
- {
- clear();
- showall = 0;
+ {
+ clear();
+ showall = 0;
oldlineno = lineno;
fseek(fp, lpos[lineno], SEEK_SET);
- for (i = 0, buf[0] = 0; i < t_lines-1; i++, buf[0] = 0)
+ for (i = 0, buf[0] = 0; i < t_lines-1; i++, buf[0] = 0)
{
- if (!showall)
+ if (!showall)
{
fgets(buf, sizeof(buf), fp);
- if (lineno + i == 0 &&
+ if (lineno + i == 0 &&
(strncmp(buf, STR_AUTHOR1, strlen(STR_AUTHOR1))==0 ||
strncmp(buf, STR_AUTHOR2, strlen(STR_AUTHOR2))==0))
colorize = 1;
}
- if (!buf[0])
+ if (!buf[0])
{
outs("\n");
showall = 1;
} else {
// dirty code to render heeader
- if (colorize && lineno+i < 4 && *buf &&
+ if (colorize && lineno+i < 4 && *buf &&
*buf != '\n' && strchr(buf, ':'))
{
char *q1 = strchr(buf, ':');
int l = t_columns - 2 - strlen(buf);
char *q2 = strstr(buf, STR_POST1);
- chomp(buf);
+ chomp(buf);
if (q2 == NULL) q2 = strstr(buf, STR_POST2);
if (q2) { *(q2-1) = 0; q2 = strchr(q2, ':'); }
else q2 = q1;
- *q1++ = 0; *q2++ = 0;
+ *q1++ = 0; *q2++ = 0;
if (q1 == q2) q2 = NULL;
outs(ANSI_COLOR(34;47) " ");
- outs(buf); outs(" " ANSI_REVERSE);
+ outs(buf); outs(" " ANSI_REVERSE);
outs(q1); prints("%*s", l, ""); q1 += strlen(q1);
if (q2) {
@@ -278,49 +278,49 @@ int more(const char *fpath, int promptend)
outs(" " ANSI_REVERSE); outs(q2);
}
outs(ANSI_RESET"\n");
- } else
+ } else
outs(buf);
}
}
- if (lineno + i >= lines)
+ if (lineno + i >= lines)
showall = 1;
// print prompt bar
snprintf(buf, sizeof(buf),
" 瀏覽 P.%d ", 1 + (lineno / (t_lines-2)));
- vs_footer(buf,
+ vs_footer(buf,
" (→↓[PgUp][PgDn][Home][End])游標移動\t(←/q)結束");
}
// process key
switch((vk = vkey())) {
case KEY_UP: case 'k': case Ctrl('P'):
if (lineno == 0) abort = READ_PREV;
- lineno--;
+ lineno--;
break;
case KEY_PGUP: case Ctrl('B'):
if (lineno == 0) abort = READ_PREV;
- lineno -= t_lines-2;
+ lineno -= t_lines-2;
break;
case KEY_PGDN: case Ctrl('F'): case ' ':
case KEY_RIGHT:
if (showall) abort = READ_NEXT;
- lineno += t_lines-2;
+ lineno += t_lines-2;
break;
case KEY_DOWN: case 'j': case Ctrl('N'):
if (showall) abort = READ_NEXT;
- lineno++;
+ lineno++;
break;
case KEY_HOME: case Ctrl('A'):
- lineno = 0;
+ lineno = 0;
break;
case KEY_END: case Ctrl('E'):
- lineno = lines - (t_lines-1);
+ lineno = lines - (t_lines-1);
break;
case KEY_LEFT: case 'q':
- abort = FULLUPDATE;
+ abort = FULLUPDATE;
break;
case 'b':
@@ -345,8 +345,8 @@ int more(const char *fpath, int promptend)
#else // USE_PMORE ////////////////////////////////////////////////////////
-static const char
-*hlp_nav [] =
+static const char
+*hlp_nav [] =
{ "【瀏覽指令】", NULL,
" 下篇文章 ", "f",
" 前篇文章 ", "b",
@@ -358,14 +358,14 @@ static const char
" 同作者下篇", "a",
NULL,
},
-*hlp_reply [] =
+*hlp_reply [] =
{ "【回應指令】", NULL,
" 推薦文章", "% X",
" 回信回文", "r",
" 全部回覆", "y",
NULL,
},
-*hlp_spc [] =
+*hlp_spc [] =
{ "【特殊指令】", NULL,
" 查詢資訊 ", "Q",
" 文章代碼搜尋", "#",
@@ -378,7 +378,7 @@ static const char
NULL,
};
-static int
+static int
common_pmore_help_handler(int y, void *ctx GCC_UNUSED)
{
const char ** p[3] = { hlp_nav, hlp_reply, hlp_spc };
@@ -411,7 +411,7 @@ static int
common_pmore_footer_handler(int ratio GCC_UNUSED, int width,
void *ctx GCC_UNUSED)
{
-#define FOOTERMSG_MAIL_LONG "(y)回信 (h)說明 (←/q)離開 "
+#define FOOTERMSG_MAIL_LONG "(y)回信 (h)說明 (←/q)離開 "
#define FOOTERMSG_READ_LONG "(y)回應(X%)推文(h)說明(←)離開 "
#define FOOTERMSG_READ_MID "(y)回應(X/%)推文 (←)離開 "
#define FOOTERMSG_SHORT "(h)說明 (←/q)離開 "
@@ -458,12 +458,12 @@ common_pmore_footer_handler(int ratio GCC_UNUSED, int width,
}
/* use new pager: piaip's more. */
-int
+int
more(const char *fpath, int promptend)
{
int r = pmore2(fpath, promptend,
(void*) fpath,
- common_pager_key_handler,
+ common_pager_key_handler,
common_pmore_footer_handler,
common_pmore_help_handler);
@@ -475,7 +475,7 @@ more_inmemory(void *content, int size, int promptend)
{
int r = pmore2_inmemory(content, size, promptend,
NULL,
- common_pager_key_handler,
+ common_pager_key_handler,
common_pmore_footer_handler,
common_pmore_help_handler);
diff --git a/pttbbs/mbbsd/name.c b/pttbbs/mbbsd/name.c
index e71e73c4..3e690bf6 100644
--- a/pttbbs/mbbsd/name.c
+++ b/pttbbs/mbbsd/name.c
@@ -137,7 +137,7 @@ nc_cb_peek(int key, VGET_RUNTIME *prt, void *instance)
}
}
}
-
+
return VGETCB_NONE;
}
@@ -303,15 +303,15 @@ gnc_cb_peek(int key, VGET_RUNTIME *prt, void *instance)
case ' ': // render complete page
assert(prt->icurr == prt->iend);
- if (gc_int->morelist == -1)
+ if (gc_int->morelist == -1)
{
int i;
char *first;
- if (gnc_findbound(data, &gc_int->start, &gc_int->end,
+ if (gnc_findbound(data, &gc_int->start, &gc_int->end,
gc_int->nmemb, gc_int->compar) == -1)
return VGETCB_NEXT;
- i = gnc_complete (data, &gc_int->start, &gc_int->end,
+ i = gnc_complete (data, &gc_int->start, &gc_int->end,
gc_int->permission, gc_int->getname);
if (i == 1) {
prt->iend = prt->icurr = strlen(data);
@@ -362,7 +362,7 @@ generalnamecomplete(const char *prompt, char *data, int len, size_t nmemb,
gnc_comp_func compar, gnc_perm_func permission,
gnc_getname_func getname)
{
- generalcomplete_int gc_int = {
+ generalcomplete_int gc_int = {
.start = 0,
.end = nmemb-1,
.nmemb = nmemb,
@@ -399,7 +399,7 @@ generalnamecomplete(const char *prompt, char *data, int len, size_t nmemb,
}
gnc_findbound(data, &gc_int.start, &gc_int.end, nmemb, compar);
- if (gnc_complete(data, &gc_int.start, &gc_int.end, permission, getname) == 1 ||
+ if (gnc_complete(data, &gc_int.start, &gc_int.end, permission, getname) == 1 ||
(*compar)(gc_int.start, data, len) == 0)
{
strlcpy(data, (*getname)(gc_int.start), len);
@@ -429,7 +429,7 @@ completeboard_permission(int where)
!(bptr->brdattr & BRD_GROUPBOARD));
}
-int
+int
complete_board_and_group_permission(int where)
{
boardheader_t *bptr = &bcache[SHM->bsorted[0][where]];
diff --git a/pttbbs/mbbsd/nios.c b/pttbbs/mbbsd/nios.c
index f4086275..87542618 100644
--- a/pttbbs/mbbsd/nios.c
+++ b/pttbbs/mbbsd/nios.c
@@ -83,12 +83,12 @@ nios_dbgf(const char *fmt, ...)
#ifdef CIN_DEBUG
# define CINDBGLOG(...) nios_dbgf( __VA_ARGS__)
-# else
+# else
# define CINDBGLOG(...)
#endif
#ifdef VKEY_DEBUG
# define VKEYDBGLOG(...) nios_dbgf( __VA_ARGS__)
-# else
+# else
# define VKEYDBGLOG(...)
#endif
@@ -151,7 +151,7 @@ cin_is_buffer_empty()
/**
* cin_is_buffer_full(): check if input buffer is full
*/
-CIN_PROTO int
+CIN_PROTO int
cin_is_buffer_full()
{
return vbuf_is_full(cin);
@@ -160,7 +160,7 @@ cin_is_buffer_full()
/**
* cin_scan_buffer(c): return if buffer has given character
*/
-CIN_PROTO int
+CIN_PROTO int
cin_scan_buffer(char c)
{
return vbuf_strchr(cin, c) >= 0;
@@ -218,7 +218,7 @@ cin_is_fd_empty(int fd)
#define CIN_IS_VALID_FD2(fd) ((fd) > 0)
-CIN_PROTO int
+CIN_PROTO int
cin_poll_fds(int fd1, int fd2, int timeout)
{
CINDBGLOG("cin_poll_fds(fd1=%d, fd2=%d, timeout=%d)", fd1, fd2, timeout);
@@ -281,7 +281,7 @@ cin_clear_fd(int fd)
/**
* cin_fetch_fd(fd): read more data from fd to buffer
*/
-CIN_PROTO void
+CIN_PROTO void
cin_fetch_fd(int fd)
{
CINDBGLOG("cin_fetch_fd(%d)", fd);
@@ -368,7 +368,7 @@ cin_debug_print_content()
// 1. PEEKed character in vkctx
// 2. cin_buffer and cin_fd
// 3. vkctx.attached_fd()
-// using the vkey_process() will handle all these cases. otherwise, you
+// using the vkey_process() will handle all these cases. otherwise, you
// have to take care of all thse input sources.
// vkey context
@@ -430,7 +430,7 @@ vkey_detach()
/**
* vkey_is_full(): return if key buffer is full.
*/
-VKEY_PROTO int
+VKEY_PROTO int
vkey_is_full()
{
VKEYDBGLOG("vkey_is_full()");
@@ -593,7 +593,7 @@ vkey_poll(int timeout)
VKEY_PROTO int
vkey_is_typeahead()
{
- VKEYDBGLOG("vkey_is_typeahead(): %d|%d",
+ VKEYDBGLOG("vkey_is_typeahead(): %d|%d",
VKEY_HAS_PEEK() || !cin_is_buffer_empty());
return VKEY_HAS_PEEK() || !cin_is_buffer_empty();
@@ -602,7 +602,7 @@ vkey_is_typeahead()
/**
* vkey_prefetch(timeout): try to prefecth as more data as possible from fd to buffer for up to timeout milliseconds
*/
-VKEY_PROTO int
+VKEY_PROTO int
vkey_prefetch(int timeout)
{
VKEYDBGLOG("vkey_prefetch(%d)", timeout);
@@ -637,7 +637,7 @@ vkey_is_prefetched(char c)
* vkey(): receive and block for next key
* @return: virtual key code
*/
-VKEY_PROTO int
+VKEY_PROTO int
vkey()
{
VKEYDBGLOG("vkey()");
@@ -660,10 +660,10 @@ vkey_purge()
{
VKEYDBGLOG("vkey_purge()");
- // a magic number to set how much data we're going to process
+ // a magic number to set how much data we're going to process
// before a real purge (may contain telnet protocol)
- int bytes_before_purge = 32;
-
+ int bytes_before_purge = 32;
+
// let's still try to process some remaining bytes
vkey_prefetch(0);
while (vkey_is_ready() && bytes_before_purge-- > 0)
diff --git a/pttbbs/mbbsd/ordersong.c b/pttbbs/mbbsd/ordersong.c
index e2eb6353..4211acbd 100644
--- a/pttbbs/mbbsd/ordersong.c
+++ b/pttbbs/mbbsd/ordersong.c
@@ -7,15 +7,15 @@
#define SONGBOOK "etc/SONGBOOK"
#define OSONGPATH "etc/SONGO"
-#ifndef ORDERSONG_MIN_NUMPOST
-#define ORDERSONG_MIN_NUMPOST (3)
-#endif
-#ifndef ORDERSONG_MAX_BADPOST
-#define ORDERSONG_MAX_BADPOST (1)
-#endif
-#ifndef ORDERSONG_MIN_NUMLOGINDAYS
-#define ORDERSONG_MIN_NUMLOGINDAYS (30)
-#endif
+#ifndef ORDERSONG_MIN_NUMPOST
+#define ORDERSONG_MIN_NUMPOST (3)
+#endif
+#ifndef ORDERSONG_MAX_BADPOST
+#define ORDERSONG_MAX_BADPOST (1)
+#endif
+#ifndef ORDERSONG_MIN_NUMLOGINDAYS
+#define ORDERSONG_MIN_NUMLOGINDAYS (30)
+#endif
#define MAX_SONGS (MAX_ADBANNER-100) // (400) XXX MAX_SONGS should be fewer than MAX_ADBANNER.
@@ -36,18 +36,18 @@ do_order_song(void)
// 由於變免費了,改成要看劣文跟登入天數
#if defined(ORDERSONG_MAX_BADPOST) && defined(ASSESS)
- if (cuser.badpost > ORDERSONG_MAX_BADPOST) {
- vmsgf("為避免濫用,留言前請先消除劣文記錄至 %d 篇以下",
- ORDERSONG_MAX_BADPOST);
- return 0;
- }
-#endif
+ if (cuser.badpost > ORDERSONG_MAX_BADPOST) {
+ vmsgf("為避免濫用,留言前請先消除劣文記錄至 %d 篇以下",
+ ORDERSONG_MAX_BADPOST);
+ return 0;
+ }
+#endif
#ifdef ORDERSONG_MIN_NUMLOGINDAYS
- if (cuser.numlogindays < ORDERSONG_MIN_NUMLOGINDAYS) {
- vmsgf("為避免濫用,留言前要先有%s %d %s",
+ if (cuser.numlogindays < ORDERSONG_MIN_NUMLOGINDAYS) {
+ vmsgf("為避免濫用,留言前要先有%s %d %s",
STR_LOGINDAYS, ORDERSONG_MIN_NUMLOGINDAYS, STR_LOGINDAYS_QTY);
- return 0;
- }
+ return 0;
+ }
#endif
strlcpy(buf, Cdatedate(&now), sizeof(buf));
@@ -72,7 +72,7 @@ do_order_song(void)
"若有上述違規情形,站方將保留決定是否公開內容的權利\n"
"且違規者將不受匿名保護(其 ID 可被公佈於公開看板)\n"
"如不同意請按 (3) 離開。" ANSI_RESET "\n");
- getdata(18, 0,
+ getdata(18, 0,
"請選擇 " ANSI_COLOR(1) "1)" ANSI_RESET " 開始留言、"
ANSI_COLOR(1) "2)" ANSI_RESET " 看範本、"
"或是 " ANSI_COLOR(1) "3)" ANSI_RESET " 離開: ",
@@ -225,7 +225,7 @@ do_order_song(void)
// XXX race condition
delete_range(OSONGPATH "/" FN_DIR, 1, nsongs - MAX_SONGS);
}
- snprintf(genbuf, sizeof(genbuf), "%s says \"%s\" to %s.",
+ snprintf(genbuf, sizeof(genbuf), "%s says \"%s\" to %s.",
sender, say, receiver);
log_usies("OSONG", genbuf);
}
@@ -318,7 +318,7 @@ sortsong(void)
}
qsort(songs, MAX_SONGS, sizeof(songcmp_t), (QCAST) count_cmp);
fprintf(fo,
- " " ANSI_COLOR(36) "──" ANSI_COLOR(37) "名次" ANSI_COLOR(36) "──────" ANSI_COLOR(37)
+ " " ANSI_COLOR(36) "──" ANSI_COLOR(37) "名次" ANSI_COLOR(36) "──────" ANSI_COLOR(37)
"範本" ANSI_COLOR(36) "───────────" ANSI_COLOR(37) "次數" ANSI_COLOR(36)
"──" ANSI_COLOR(32) "共%d次" ANSI_COLOR(36) "──" ANSI_RESET "\n", totalcount);
for (n = 0; n < 100 && songs[n].name[0]; n++) {
diff --git a/pttbbs/mbbsd/passwd.c b/pttbbs/mbbsd/passwd.c
index e7b7185e..3eeafc70 100644
--- a/pttbbs/mbbsd/passwd.c
+++ b/pttbbs/mbbsd/passwd.c
@@ -12,7 +12,7 @@
#define cuser pwcuser
#endif
-int
+int
initcuser(const char *userid)
{
usernum = passwd_load_user(userid, &cuser);
@@ -59,7 +59,7 @@ pwcuInitCUser(userec_t *u)
if (passwd_sync_query(usernum, u) != 0)
return -1;
#ifdef DEBUG
- log_filef("log/pwcu_exitsave.log", LOG_CREAT, "%s InitCUser invoked at %s\n",
+ log_filef("log/pwcu_exitsave.log", LOG_CREAT, "%s InitCUser invoked at %s\n",
cuser.userid, Cdatelite(&now));
#endif
assert(strncmp(u->userid, cuser.userid, IDLEN) == 0);
@@ -74,7 +74,7 @@ pwcuFinalCUser(userec_t *u)
assert(usernum > 0 && usernum <= MAX_USERS);
assert(strcmp(u->userid, cuser.userid) == 0);
#ifdef DEBUG
- log_filef("log/pwcu_exitsave.log", LOG_CREAT, "%s FinalCUser invoked at %s\n",
+ log_filef("log/pwcu_exitsave.log", LOG_CREAT, "%s FinalCUser invoked at %s\n",
cuser.userid, Cdatelite(&now));
#endif
if (passwd_sync_update(usernum, u) != 0)
@@ -110,7 +110,7 @@ int pwcuBitDisableLevel (unsigned int mask)
PWCU_END();
}
-int
+int
pwcuIncNumPost()
{
PWCU_START();
@@ -118,7 +118,7 @@ pwcuIncNumPost()
PWCU_END();
}
-int
+int
pwcuDecNumPost()
{
PWCU_START();
@@ -128,7 +128,7 @@ pwcuDecNumPost()
PWCU_END();
}
-int
+int
pwcuViolateLaw ()
{
PWCU_START();
@@ -173,7 +173,7 @@ pwcuCancelBadpost()
PWCU_END();
}
-int
+int
pwcuAddExMailBox(int m)
{
PWCU_START();
@@ -216,7 +216,7 @@ int pwcuSetNickname (const char *nickname)
PWCU_END();
}
-int
+int
pwcuToggleOutMail()
{
PWCU_START();
@@ -226,7 +226,7 @@ pwcuToggleOutMail()
PWCU_END();
}
-int
+int
pwcuSetLoginView(unsigned int bits)
{
PWCU_START();
@@ -235,7 +235,7 @@ pwcuSetLoginView(unsigned int bits)
PWCU_END();
}
-int
+int
pwcuRegCompleteJustify(const char *justify)
{
PWCU_START();
@@ -289,7 +289,7 @@ int pwcuRegisterSetInfo (const char *rname,
}
#include "chess.h"
-int
+int
pwcuChessResult(int sigType, ChessGameResult r)
{
uint16_t *utmp_win = NULL, *cuser_win = NULL, *u_win = NULL,
@@ -364,25 +364,25 @@ pwcuChessResult(int sigType, ChessGameResult r)
switch(r)
{
case CHESS_RESULT_WIN:
- *utmp_win = *cuser_win =
+ *utmp_win = *cuser_win =
++(*u_win);
// recover init lose
if (*u_lose > 0)
- *utmp_lose = *cuser_lose =
+ *utmp_lose = *cuser_lose =
--(*u_lose);
break;
case CHESS_RESULT_TIE:
- *utmp_tie = *cuser_tie =
+ *utmp_tie = *cuser_tie =
++*u_tie;
// recover init lose
if (*u_lose > 0)
- *utmp_lose = *cuser_lose =
+ *utmp_lose = *cuser_lose =
--(*u_lose);
break;
case CHESS_RESULT_LOST:
- *utmp_lose = *cuser_lose =
+ *utmp_lose = *cuser_lose =
++(*u_lose);
break;
@@ -394,7 +394,7 @@ pwcuChessResult(int sigType, ChessGameResult r)
PWCU_END();
}
-int
+int
pwcuSetChessEloRating(uint16_t elo_rating)
{
PWCU_START();
@@ -402,7 +402,7 @@ pwcuSetChessEloRating(uint16_t elo_rating)
PWCU_END();
}
-int
+int
pwcuToggleUserFlag (unsigned int mask)
{
PWCU_START();
@@ -412,7 +412,7 @@ pwcuToggleUserFlag (unsigned int mask)
PWCU_END();
}
-int
+int
pwcuToggleSortBoard ()
{
// XXX if this is executed too often,
@@ -420,7 +420,7 @@ pwcuToggleSortBoard ()
return pwcuToggleUserFlag(UF_BRDSORT);
}
-int
+int
pwcuToggleFriendList()
{
// XXX if this is executed too often,
@@ -430,10 +430,10 @@ pwcuToggleFriendList()
// non-important variables (only save on exit)
-static char
+static char
pwcu_dirty;
-int
+int
pwcuSetPagerUIType (unsigned int uitype)
{
// XXX you MUST save this variable in pwcuExitSave();
@@ -466,7 +466,7 @@ int pwcuLoginSave ()
{
// XXX because LoginSave was called very long after
// login_start_time, so we must reload passwd again
- // here to prevent race condition.
+ // here to prevent race condition.
// If you want to remove this reload, make sure
// pwcuLoginSave is called AFTER login_start_time
// was decided.
@@ -524,7 +524,7 @@ int pwcuLoginSave ()
// XXX this is a little different - only invoked at exist,
// so no need to sync back to cuser.
-int
+int
pwcuExitSave ()
{
// determine dirty
@@ -553,20 +553,20 @@ pwcuExitSave ()
// u.money = moneyof(usernum); // should be already updated by deumoney
#ifdef DEBUG
- log_filef("log/pwcu_exitsave.log", LOG_CREAT, "%s exit %s at %s\n",
+ log_filef("log/pwcu_exitsave.log", LOG_CREAT, "%s exit %s at %s\n",
cuser.userid, pwcu_dirty ? "DIRTY" : "CLEAN", Cdatelite(&now));
#endif
PWCU_END();
// XXX return 0 here (PWCU_END), following code is not executed.
}
#ifdef DEBUG
- log_filef("log/pwcu_exitsave.log", LOG_CREAT, "%s exit %s at %s\n",
+ log_filef("log/pwcu_exitsave.log", LOG_CREAT, "%s exit %s at %s\n",
cuser.userid, pwcu_dirty ? "DIRTY" : "CLEAN", Cdatelite(&now));
#endif
return 0;
}
-int
+int
pwcuReload ()
{
// XXX TODO verify cuser structure?
diff --git a/pttbbs/mbbsd/pfterm.c b/pttbbs/mbbsd/pfterm.c
index 2eb07c6a..09c368c7 100644
--- a/pttbbs/mbbsd/pfterm.c
+++ b/pttbbs/mbbsd/pfterm.c
@@ -90,7 +90,7 @@
//
// Copyright (c) 2007-2008 Hung-Te Lin <piaip@csie.ntu.edu.tw>
// All rights reserved.
-//
+//
// Distributed under a Non-Commercial 4clause-BSD alike license.
//
// Redistribution and use in source and binary forms, with or without
@@ -107,7 +107,7 @@
// The acknowledgement can be localized with the name unchanged.
// 4. You may not exercise any of the rights granted to you above in any
// manner that is primarily intended for or directed toward commercial
-// advantage or private monetary compensation. For avoidance of doubt,
+// advantage or private monetary compensation. For avoidance of doubt,
// using in a program providing commercial network service is also
// prohibited.
//
@@ -234,7 +234,7 @@ typedef unsigned char ftattr; // primitive attribute type
// Flat Terminal Structure
//////////////////////////////////////////////////////////////////////////
-typedef struct
+typedef struct
{
ftchar **cmap[2]; // character map
ftattr **amap[2]; // attribute map
@@ -430,7 +430,7 @@ void fterm_rawmove (int y, int x);
void fterm_rawmove_opt(int y, int x);
void fterm_rawmove_rel(int dy, int dx);
-int fterm_chattr (char *s, ftattr oa, ftattr na); // size(s) > FTATTR_MINCMD
+int fterm_chattr (char *s, ftattr oa, ftattr na); // size(s) > FTATTR_MINCMD
void fterm_exec (void); // execute ft.cmd
void fterm_flippage (void);
void fterm_dupe2bk (void);
@@ -449,7 +449,7 @@ int fterm_DBCS_Big5(unsigned char c1, unsigned char c2);
// initialization
-void
+void
initscr(void)
{
#ifdef _WIN32
@@ -474,13 +474,13 @@ initscr(void)
move(0, 0);
}
-int
+int
endwin(void)
{
int r, mi = 0;
// fterm_rawclear();
-
+
for (mi = 0; mi < 2; mi++)
{
for (r = 0; r < ft.mrows; r++)
@@ -495,14 +495,14 @@ endwin(void)
return 0;
}
-int
+int
resizeterm(int rows, int cols)
{
int dirty = 0, mi = 0, i = 0;
rows = ranged(rows, FTSZ_MIN_ROW, FTSZ_MAX_ROW);
cols = ranged(cols, FTSZ_MIN_COL, FTSZ_MAX_COL);
-
+
// adjust memory only for increasing buffer
if (rows > ft.mrows || cols > ft.mcols)
{
@@ -511,9 +511,9 @@ resizeterm(int rows, int cols)
// allocate rows
if (rows > ft.mrows)
{
- ft.cmap[mi] = (ftchar**)realloc(ft.cmap[mi],
+ ft.cmap[mi] = (ftchar**)realloc(ft.cmap[mi],
sizeof(ftchar*) * rows);
- ft.amap[mi] = (ftattr**)realloc(ft.amap[mi],
+ ft.amap[mi] = (ftattr**)realloc(ft.amap[mi],
sizeof(ftattr*) * rows);
// allocate new columns
@@ -532,9 +532,9 @@ resizeterm(int rows, int cols)
{
for (i = 0; i < ft.mrows; i++)
{
- ft.cmap[mi][i] = (ftchar*)realloc(ft.cmap[mi][i],
+ ft.cmap[mi][i] = (ftchar*)realloc(ft.cmap[mi][i],
(cols+1) * sizeof(ftchar));
- ft.amap[mi][i] = (ftattr*)realloc(ft.amap[mi][i],
+ ft.amap[mi][i] = (ftattr*)realloc(ft.amap[mi][i],
(cols+1) * sizeof(ftattr));
// zero at end to prevent over-run
ft.cmap[mi][i][cols] = 0;
@@ -542,7 +542,7 @@ resizeterm(int rows, int cols)
}
} else {
// we have to deal one case:
- // expand x, shrink x, expand y ->
+ // expand x, shrink x, expand y ->
// now new allocated lines will have small x(col) instead of mcol.
// the solution is to modify mcols here, or change the malloc above
// to max(ft.mcols, cols).
@@ -570,18 +570,18 @@ resizeterm(int rows, int cols)
// because we will redawwin(), so need to change front buffer only.
for (i = ft.rows; i < rows; i++)
{
- memset(FTCMAP[i], FTCHAR_ERASE,
+ memset(FTCMAP[i], FTCHAR_ERASE,
(cols) * sizeof(ftchar));
- memset(FTAMAP[i], FTATTR_ERASE,
+ memset(FTAMAP[i], FTATTR_ERASE,
(cols) * sizeof(ftattr));
}
if (cols > ft.cols)
{
for (i = 0; i < ft.rows; i++)
{
- memset(FTCMAP[i]+ft.cols, FTCHAR_ERASE,
+ memset(FTCMAP[i]+ft.cols, FTCHAR_ERASE,
(cols-ft.cols) * sizeof(ftchar));
- memset(FTAMAP[i]+ft.cols, FTATTR_ERASE,
+ memset(FTAMAP[i]+ft.cols, FTATTR_ERASE,
(cols-ft.cols) * sizeof(ftattr));
}
}
@@ -601,7 +601,7 @@ resizeterm(int rows, int cols)
// attributes
-ftattr
+ftattr
attrget(void)
{
return ft.attr;
@@ -629,7 +629,7 @@ attrsetbg(ftattr attr)
// clear
-void
+void
clrscr(void)
{
int r;
@@ -640,14 +640,14 @@ clrscr(void)
fterm_markdirty();
}
-void
+void
clear(void)
{
clrscr();
move(0,0);
}
-void
+void
clrtoeol(void)
{
ft.x = ranged(ft.x, 0, ft.cols-1);
@@ -657,7 +657,7 @@ clrtoeol(void)
fterm_markdirty();
}
-void
+void
clrtobeg(void)
{
ft.x = ranged(ft.x, 0, ft.cols-1);
@@ -667,7 +667,7 @@ clrtobeg(void)
fterm_markdirty();
}
-void
+void
clrcurrline(void)
{
ft.y = ranged(ft.y, 0, ft.rows-1);
@@ -706,14 +706,14 @@ clrregion(int r1, int r2)
fterm_markdirty();
}
-void
+void
clrtobot(void)
{
clrtoeol();
clrregion(ft.y+1, ft.rows-1);
}
-void
+void
clrtohome(void)
{
clrtobeg();
@@ -724,7 +724,7 @@ void newwin (int nlines, int ncols, int y, int x)
{
int oy, ox;
// check range
-
+
x = ranged(x, 0, ft.cols-1);
y = ranged(y, 0, ft.rows-1);
ncols = ranged(x+ncols-1, x, ft.cols-1);
@@ -766,7 +766,7 @@ redrawwin(void)
fterm_markdirty();
}
-int
+int
typeahead(int fd)
{
switch(fd)
@@ -854,20 +854,20 @@ doupdate(void)
FTD[x] |= FTDIRTY_ATTR, ds++;
// determine DBCS status
- if (dbcs == 1)
- {
+ if (dbcs == 1)
+ {
#ifdef FTCONF_PREVENT_INVALID_DBCS
switch(fterm_DBCS_Big5(FTCMAP[y][x-1], FTCMAP[y][x]))
{
case FTDBCS_SAFE:
// safe to print
- FTD[x-1] &= ~FTDIRTY_INVALID_DBCS;
+ FTD[x-1] &= ~FTDIRTY_INVALID_DBCS;
FTDC[x-1] = FTCMAP[y][x-1];
break;
case FTDBCS_UNSAFE:
// ok to print, but need to rawmove.
- FTD[x-1] &= ~FTDIRTY_INVALID_DBCS;
+ FTD[x-1] &= ~FTDIRTY_INVALID_DBCS;
FTDC[x-1] = FTCMAP[y][x-1];
FTD[x-1] |= FTDIRTY_CHAR;
#ifdef FTCONF_CLEAR_UNSAFE_DBCS
@@ -880,52 +880,52 @@ doupdate(void)
// only SBCS safe characters can be print.
if (!FTDBCS_ISSBCSPRINT(FTCMAP[y][x]))
{
- FTD[x] |= FTDIRTY_INVALID_DBCS;
+ FTD[x] |= FTDIRTY_INVALID_DBCS;
FTDC[x] = FTCHAR_INVALID_DBCS;
}
break;
}
#endif // FTCONF_PREVENT_INVALID_DBCS
- dbcs = 2;
+ dbcs = 2;
// TAIL: dirty prev and me if any is dirty.
- if (FTD[x] || FTD[x-1])
+ if (FTD[x] || FTD[x-1])
{
- FTD[x] |= FTDIRTY_DBCS;
- FTD[x-1]|= FTDIRTY_CHAR;
+ FTD[x] |= FTDIRTY_DBCS;
+ FTD[x-1]|= FTDIRTY_CHAR;
}
}
else if (FTDBCS_ISLEAD(FTCMAP[y][x]))
- {
+ {
// LEAD: clear dirty when tail was found.
- dbcs = 1;
+ dbcs = 1;
#ifdef FTCONF_PREVENT_INVALID_DBCS
- FTD[x] |= FTDIRTY_INVALID_DBCS;
+ FTD[x] |= FTDIRTY_INVALID_DBCS;
FTDC[x] = FTCHAR_INVALID_DBCS;
#endif // FTCONF_PREVENT_INVALID_DBCS
}
else
{
// NON-DBCS
- dbcs = 0;
+ dbcs = 0;
}
- if (odbcs == 1)
+ if (odbcs == 1)
{
// TAIL: dirty prev and me if any is dirty.
- odbcs = 2;
- if (FTD[x] || FTD[x-1])
+ odbcs = 2;
+ if (FTD[x] || FTD[x-1])
{
- FTD[x] |= FTDIRTY_CHAR;
- FTD[x-1]|= FTDIRTY_CHAR;
+ FTD[x] |= FTDIRTY_CHAR;
+ FTD[x-1]|= FTDIRTY_CHAR;
}
}
- else if (FTDBCS_ISLEAD(FTOCMAP[y][x]))
+ else if (FTDBCS_ISLEAD(FTOCMAP[y][x]))
{
// LEAD: dirty next?
- odbcs = 1;
+ odbcs = 1;
}
- else
+ else
{
odbcs = 0;
}
@@ -964,7 +964,7 @@ doupdate(void)
// Inside a refresh() loop, this will never happen.
// However it may occur for the first print entering refresh.
// So enable only space if this is the first run (!touched).
-
+
// if we don't need to change attributes,
// just print remaining characters
for (i = ft.rx; i < x; i++)
@@ -984,7 +984,7 @@ doupdate(void)
// safe to print all!
// printf("[re-print %d chars]", i-ft.rx);
-
+
#ifdef DBG_SHOW_REPRINT
// reverse to hint this is a re-print
fterm_rawattr(FTATTR_MAKE(0, 7) | FTATTR_BOLD);
@@ -1015,7 +1015,7 @@ doupdate(void)
else
#endif // DBCSAWARE
#ifdef DBG_SHOW_DIRTY
- fterm_rawattr(FTD[x] ?
+ fterm_rawattr(FTD[x] ?
(FTAMAP[y][x] | FTATTR_BOLD) : (FTAMAP[y][x] & ~FTATTR_BOLD));
#else // !DBG_SHOW_DIRTY
fterm_rawattr(FTAMAP[y][x]);
@@ -1085,7 +1085,7 @@ move(int y, int x)
// scrolling
-void
+void
scrl(int rows)
{
if (!rows)
@@ -1124,7 +1124,7 @@ scroll()
FTAMAP[y] = a0;
FTOCMAP[y]= oc0;
FTOAMAP[y]= oa0;
-
+
// XXX also clear backup buffer
// must carefully consider if up then down scrolling.
fterm_flippage();
@@ -1136,14 +1136,14 @@ scroll()
// fterm_markdirty(); // should be already dirty
}
-void
+void
rscroll()
{
// scroll down
int y;
ftchar *c0 = FTCMAP[ft.rows -1], *oc0 = FTOCMAP[ft.rows -1];
ftattr *a0 = FTAMAP[ft.rows -1], *oa0 = FTOAMAP[ft.rows -1];
-
+
// prevent mixing buffered scroll up+down
if (ft.scroll > 0)
fterm_rawscroll(ft.scroll);
@@ -1160,7 +1160,7 @@ rscroll()
FTAMAP[y] = a0;
FTOCMAP[y]= oc0;
FTOAMAP[y]= oa0;
-
+
// XXX also clear backup buffer
// must carefully consider if up then down scrolling.
fterm_flippage();
@@ -1174,19 +1174,19 @@ rscroll()
// output
-void
+void
addch (unsigned char c)
{
outc(c);
}
-void
+void
addstr (const char *s)
{
outs(s);
}
-void
+void
addnstr(const char *s, int n)
{
outns(s, n);
@@ -1198,7 +1198,7 @@ addstring(const char *s)
outstr(s);
}
-void
+void
outs(const char *s)
{
if (!s)
@@ -1207,7 +1207,7 @@ outs(const char *s)
outc(*s++);
}
-void
+void
outns(const char *s, int n)
{
if (!s)
@@ -1227,7 +1227,7 @@ outstr(const char *str)
// calculate real length of str (stripping escapes)
// TODO only print by the returned size
-
+
fterm_prepare_str(fterm_strdlen(str));
outs(str);
@@ -1254,7 +1254,7 @@ outstr(const char *str)
void
outc(unsigned char c)
{
- // 0xFF is invalid for most cases (even DBCS),
+ // 0xFF is invalid for most cases (even DBCS),
if (c == 0xFF || c == 0x00)
return;
@@ -1277,7 +1277,7 @@ outc(unsigned char c)
// start of escaped commands
ft.cmd[ft.szcmd++] = c;
}
- else if (c == '\t')
+ else if (c == '\t')
{
// tab: move by 8, and erase the moved range
int x = ft.x;
@@ -1293,7 +1293,7 @@ outc(unsigned char c)
memset(FTAROW+ft.x, ft.attr, x-ft.x);
}
ft.x = x;
- }
+ }
else if (c == '\b')
{
ft.x = ranged(ft.x-1, 0, ft.cols-1);
@@ -1312,8 +1312,8 @@ outc(unsigned char c)
// scroll();
ft.y --;
}
- }
- else if (iscntrl((unsigned char)c))
+ }
+ else if (iscntrl((unsigned char)c))
{
// unknown control characters: ignore
}
@@ -1347,7 +1347,7 @@ outc(unsigned char c)
}
// readback
-int
+int
instr (char *str)
{
int x = ft.cols -1;
@@ -1365,7 +1365,7 @@ instr (char *str)
return x;
}
-int
+int
innstr (char *str, int n)
{
int on = n;
@@ -1386,7 +1386,7 @@ innstr (char *str, int n)
return n;
}
-int
+int
inansistr (char *str, int n)
{
int x = ft.cols -1, i = 0, szTrail = 0;
@@ -1421,7 +1421,7 @@ inansistr (char *str, int n)
if (a != FTATTR_DEFAULT)
szTrail = 3; // ESC [ m
- else
+ else
szTrail = 0;
if ((int)strlen(cmd) >= n - szTrail)
@@ -1433,7 +1433,7 @@ inansistr (char *str, int n)
}
// n should > szTrail
- *str ++ = FTCROW[i];
+ *str ++ = FTCROW[i];
n--;
}
@@ -1448,7 +1448,7 @@ inansistr (char *str, int n)
// internal core of piaip's flat-term
-void
+void
fterm_flippage (void)
{
// we have only 2 pages now.
@@ -1456,7 +1456,7 @@ fterm_flippage (void)
}
#ifndef fterm_markdirty
-void
+void
fterm_markdirty (void)
{
ft.dirty = 1;
@@ -1466,7 +1466,7 @@ fterm_markdirty (void)
void fterm_dupe2bk(void)
{
int r = 0;
-
+
for (r = 0; r < ft.rows; r++)
{
memcpy(FTOCMAP[r], FTCMAP[r], ft.cols * sizeof(ftchar));
@@ -1493,7 +1493,7 @@ fterm_DBCS_Big5(unsigned char c1, unsigned char c2)
return FTDBCS_SAFE;
}
-int
+int
fterm_prepare_str(int len)
{
// clear and make (cursor, +len) as DBCS-ready.
@@ -1502,7 +1502,7 @@ fterm_prepare_str(int len)
int dbcs = 0, sdbcs = 0;
// TODO what if x+len is outside range?
-
+
// check if (x,y) is in valid range
if (x != ft.x || y != ft.y)
return -1;
@@ -1523,7 +1523,7 @@ fterm_prepare_str(int len)
x = ft.x;
// fix start and end
- if(sdbcs == 2 && x > 0) // TAIL, remove word
+ if(sdbcs == 2 && x > 0) // TAIL, remove word
x--;
if (dbcs == 1 && len < ft.cols) // LEAD, remove word
len ++;
@@ -1537,7 +1537,7 @@ fterm_prepare_str(int len)
}
-void
+void
fterm_exec(void)
{
ftchar cmd = ft.cmd[ft.szcmd-1];
@@ -1566,7 +1566,7 @@ fterm_exec(void)
case 'B': // CUD: CSI n B
case 'C': // CUF: CSI n C
case 'D': // CUB: CSI n D
- // Moves the cursor n (default 1) cells in the given direction.
+ // Moves the cursor n (default 1) cells in the given direction.
// If the cursor is already at the edge of the screen, this has no effect.
if (n < 1)
n = 1;
@@ -1580,7 +1580,7 @@ fterm_exec(void)
case 'E': // CNL: CSI n E
case 'F': // CPL: CSI n F
- // Moves cursor to beginning of the line
+ // Moves cursor to beginning of the line
// n (default 1) lines up/down (next/previous line).
if (n < 1)
n = 1;
@@ -1600,9 +1600,9 @@ fterm_exec(void)
case 'H': // CUP: CSI n ; m H
case 'f': // HVP: CSI n ; m f
- // Moves the cursor to row n, column m.
- // The values are 1-based, and default to 1 (top left corner) if omitted.
- // A sequence such as CSI ;5H is a synonym for CSI 1;5H as well as
+ // Moves the cursor to row n, column m.
+ // The values are 1-based, and default to 1 (top left corner) if omitted.
+ // A sequence such as CSI ;5H is a synonym for CSI 1;5H as well as
// CSI 17;H is the same as CSI 17H and CSI 17;1H
y = n;
if (y >= 0 && isdigit(*p))
@@ -1615,9 +1615,9 @@ fterm_exec(void)
// Clear
case 'J': // ED: CSI n J
- // Clears part of the screen.
- // If n is zero (or missing), clear from cursor to end of screen.
- // If n is one, clear from cursor to beginning of the screen.
+ // Clears part of the screen.
+ // If n is zero (or missing), clear from cursor to end of screen.
+ // If n is one, clear from cursor to beginning of the screen.
// If n is two, clear entire screen
if (n == 0 || n < 0)
clrtobot();
@@ -1630,9 +1630,9 @@ fterm_exec(void)
break;
case 'K': // EL: CSI n K
- // Erases part of the line.
- // If n is zero (or missing), clear from cursor to the end of the line.
- // If n is one, clear from cursor to beginning of the line.
+ // Erases part of the line.
+ // If n is zero (or missing), clear from cursor to the end of the line.
+ // If n is one, clear from cursor to beginning of the line.
// If n is two, clear entire line. Cursor position does not change.
if (n == 0 || n < 0)
clrtoeol();
@@ -1653,7 +1653,7 @@ fterm_exec(void)
break;
case 'S': // SU: CSI n S
- // Scroll whole page up by n (default 1) lines.
+ // Scroll whole page up by n (default 1) lines.
// New lines are added at the bottom.
if (n < 1)
n = 1;
@@ -1661,7 +1661,7 @@ fterm_exec(void)
break;
case 'T': // SD: CSI n T
- // Scroll whole page down by n (default 1) lines.
+ // Scroll whole page down by n (default 1) lines.
// New lines are added at the top.
if (n < 1)
n = 1;
@@ -1669,9 +1669,9 @@ fterm_exec(void)
break;
case 'm': // SGR: CSI n [;k] m
- // Sets SGR (Select Graphic Rendition) parameters.
- // After CSI can be zero or more parameters separated with ;.
- // With no parameters, CSI m is treated as CSI 0 m (reset / normal),
+ // Sets SGR (Select Graphic Rendition) parameters.
+ // After CSI can be zero or more parameters separated with ;.
+ // With no parameters, CSI m is treated as CSI 0 m (reset / normal),
// which is typical of most of the ANSI codes.
// ---------------------------------------------------------
// SGR implementation:
@@ -1702,12 +1702,12 @@ fterm_exec(void)
{
// set foreground
attrsetfg(n - 30);
- }
+ }
else if (n >= 40 && n <= 47)
{
// set background
attrsetbg(n - 40);
- }
+ }
else switch(n)
{
case 0:
@@ -1748,7 +1748,7 @@ fterm_exec(void)
{
n = 0;
p++;
- }
+ }
else if (isdigit(*p))
{
n = atoi(p);
@@ -1764,10 +1764,10 @@ fterm_exec(void)
}
}
-int
+int
fterm_chattr(char *s, ftattr oattr, ftattr nattr)
{
- ftattr
+ ftattr
fg, bg, bold, blink,
ofg, obg, obold, oblink;
char lead = 1;
@@ -1785,17 +1785,17 @@ fterm_chattr(char *s, ftattr oattr, ftattr nattr)
*s++ = 0;
return 1;
}
-
+
fg = FTATTR_GETFG(nattr);
bg = FTATTR_GETBG(nattr);
bold = (nattr & FTATTR_BOLD) ? 1 : 0;
blink = (nattr & FTATTR_BLINK)? 1 : 0;
-
+
ofg = FTATTR_GETFG(oattr);
obg = FTATTR_GETBG(oattr);
obold = (oattr & FTATTR_BOLD) ? 1 : 0;
oblink = (oattr & FTATTR_BLINK)? 1 : 0;
-
+
// we dont use "disable blink/bold" commands,
// so if these settings are changed then we must reset.
// another case is changing background to default background -
@@ -1815,7 +1815,7 @@ fterm_chattr(char *s, ftattr oattr, ftattr nattr)
obg = FTATTR_DEFAULT_BG;
obold = 0; oblink = 0;
}
-
+
if (bold && !obold)
{
if (lead) lead = 0; else *s++ = ';';
@@ -1853,7 +1853,7 @@ fterm_chattr(char *s, ftattr oattr, ftattr nattr)
return 1;
}
-int
+int
fterm_strdlen(const char *s)
{
char ansi = 0;
@@ -1889,14 +1889,14 @@ fterm_strdlen(const char *s)
sz++;
break;
}
- }
- else if (ansi == 1)
+ }
+ else if (ansi == 1)
{
if (*s == '[')
ansi++;
else
ansi = 0;
- }
+ }
else if (!ANSI_IS_PARAM(*s)) // ansi == 2
{
// TODO outc() take max to FTCMD_MAXLEN now...
@@ -1907,7 +1907,7 @@ fterm_strdlen(const char *s)
return sz;
}
-void
+void
fterm_rawattr(ftattr rattr)
{
static char cmd[FTATTR_MINCMD*2];
@@ -1918,7 +1918,7 @@ fterm_rawattr(ftattr rattr)
ft.rattr = rattr;
}
-void
+void
fterm_rawnum(int arg)
{
if (arg < 0 || arg > 99)
@@ -1935,7 +1935,7 @@ fterm_rawnum(int arg)
fterm_rawc('0' + arg%10);
}
}
-void
+void
fterm_rawcmd(int arg, int defval, char c)
{
fterm_rawc(ESC_CHR);
@@ -1945,7 +1945,7 @@ fterm_rawcmd(int arg, int defval, char c)
fterm_rawc(c);
}
-void
+void
fterm_rawcmd2(int arg1, int arg2, int defval, char c)
{
fterm_rawc(ESC_CHR);
@@ -1972,7 +1972,7 @@ fterm_rawcmd2(int arg1, int arg2, int defval, char c)
fterm_rawc(c);
}
-void
+void
fterm_rawclear(void)
{
fterm_rawhome();
@@ -1980,7 +1980,7 @@ fterm_rawclear(void)
fterm_raws(ESC_STR "[2J");
}
-void
+void
fterm_rawclreol(void)
{
#ifdef FTCONF_CLEAR_SETATTR
@@ -1989,7 +1989,7 @@ fterm_rawclreol(void)
// may get wrong attributes. Or not? (consider DBCS...)
// if (FTATTR_GETBG(oattr) != FTATTR_GETBG(FTATTR_ERASE))
fterm_rawattr(FTATTR_ERASE);
-#endif
+#endif
// EL: CSI n K, n = 0
fterm_raws(ESC_STR "[K");
@@ -2000,12 +2000,12 @@ fterm_rawclreol(void)
#endif
}
-void
+void
fterm_rawhome(void)
{
// CUP: CSI n ; m H
fterm_raws(ESC_STR "[H");
- ft.rx = ft.ry = 0;
+ ft.rx = ft.ry = 0;
}
void
@@ -2026,7 +2026,7 @@ fterm_rawmove_rel(int dy, int dx)
fterm_rawcmd(abs(dy), 1, dy < 0 ? 'A' : 'B');
ft.ry = y;
- }
+ }
else if (!dy)
{
int x = ranged(dx + ft.rx, 0, ft.cols-1);
@@ -2036,8 +2036,8 @@ fterm_rawmove_rel(int dy, int dx)
fterm_rawcmd(abs(dx), 1, dx < 0 ? 'D' : 'C');
ft.rx = x;
- }
- else
+ }
+ else
{
// (dy, dx) are given - use fterm_move.
fterm_rawmove(ft.ry + dy, ft.rx + dx);
@@ -2045,7 +2045,7 @@ fterm_rawmove_rel(int dy, int dx)
#endif
}
-void
+void
fterm_rawmove(int y, int x)
{
y = ranged(y, 0, ft.rows-1);
@@ -2061,7 +2061,7 @@ fterm_rawmove(int y, int x)
ft.rx = x;
}
-void
+void
fterm_rawmove_opt(int y, int x)
{
// optimized move
@@ -2077,12 +2077,12 @@ fterm_rawmove_opt(int y, int x)
// known hacks: \r = (x=0), \b=(x--), \n = (y++)
//
// Warning: any optimization here should not change displayed content,
- // because we don't have information about content variation information
+ // because we don't have information about content variation information
// (eg, invalid DBCS bytes will become special marks) here.
// Any hacks which will try to display data from FTCMAP should be done
// inside dirty-map calculation, for ex, using spaces to move right,
// or re-print content.
-
+
#ifndef DBG_TEXT_FD
// x=0: the cheapest output. However not work for text mode fd output.
// a special case is "if we have to move y to up".
@@ -2113,15 +2113,15 @@ fterm_rawmove_opt(int y, int x)
while (ft.ry++ < y)
fterm_rawc('\n');
ft.ry = y;
- }
+ }
else if (ady && adx)
{
fterm_rawmove(y, x);
- }
+ }
else if (ady)
{
fterm_rawmove_rel(y-ft.ry, 0);
- }
+ }
else if (adx)
{
fterm_rawmove_rel(0, x-ft.rx);
@@ -2144,7 +2144,7 @@ fterm_rawcursor(void)
#endif // !_WIN32
}
-void
+void
fterm_rawscroll (int dy)
{
#ifdef FTCONF_USE_ANSI_SCROLL
@@ -2159,13 +2159,13 @@ fterm_rawscroll (int dy)
fterm_rawcmd(ady, 1, cmd);
ft.scroll -= dy;
-#else
+#else
// VT100 flavor:
// * ESC D: scroll down
// * ESC M: scroll up
//
// Elder BBS systems works in a mixed way:
- // \n at (rows-1) as scroll()
+ // \n at (rows-1) as scroll()
// and ESC-M at(0) as rscoll().
//
// SCP: CSI s / RCP: CSI u
@@ -2174,7 +2174,7 @@ fterm_rawscroll (int dy)
//
// Since scroll does not happen very often, let's relax and not
// optimize these commands here...
-
+
int ady = abs(dy);
if (ady == 0)
return;
@@ -2195,7 +2195,7 @@ fterm_rawscroll (int dy)
// because of the IME line.
#ifdef FTCONF_USE_VT100_SCROLL
fterm_raws(ESC_STR "D" ESC_STR "[K"); // ESC_STR "[K");
-#else
+#else
fterm_raws("\n" ESC_STR "[K");
#endif
} else {
@@ -2210,14 +2210,14 @@ fterm_rawscroll (int dy)
#endif
}
-void
+void
fterm_raws(const char *s)
{
while (*s)
fterm_rawc(*s++);
}
-void
+void
fterm_rawnc(int c, int n)
{
while (n-- > 0)
@@ -2227,7 +2227,7 @@ fterm_rawnc(int c, int n)
//////////////////////////////////////////////////////////////////////////
// grayout advanced control
//////////////////////////////////////////////////////////////////////////
-void
+void
grayout(int y, int end, int level)
{
char grattr = FTATTR_DEFAULT;
@@ -2287,7 +2287,7 @@ grayout(int y, int end, int level)
#ifndef _PFTERM_TEST_MAIN
-void
+void
scr_dump(screen_backup_t *psb)
{
int y = 0;
@@ -2297,7 +2297,7 @@ scr_dump(screen_backup_t *psb)
psb->col= ft.cols;
psb->y = ft.y;
psb->x = ft.x;
- p = psb->raw_memory =
+ p = psb->raw_memory =
malloc (ft.rows * ft.cols * (sizeof(ftchar) + sizeof(ftattr)));
for (y = 0; y < ft.rows; y++)
@@ -2309,7 +2309,7 @@ scr_dump(screen_backup_t *psb)
}
}
-void
+void
scr_restore(const screen_backup_t *psb)
{
int y = 0;
@@ -2355,8 +2355,8 @@ void
region_scroll_up(int top, int bottom)
{
int i;
- ftchar *c0;
- ftattr *a0;
+ ftchar *c0;
+ ftattr *a0;
// logic same with old screen.c
if (top > bottom) {
@@ -2388,7 +2388,7 @@ region_scroll_up(int top, int bottom)
// adapter
//////////////////////////////////////////////////////////////////////////
-int
+int
fterm_typeahead(void)
{
#ifdef _PFTERM_TEST_MAIN
@@ -2398,11 +2398,11 @@ fterm_typeahead(void)
#endif
}
-void
+void
fterm_rawc(int c)
{
#ifdef _PFTERM_TEST_MAIN
- // if (c == ESC_CHR) putchar('*'); else
+ // if (c == ESC_CHR) putchar('*'); else
putchar(c);
#else
ochar(c);
@@ -2464,8 +2464,8 @@ int main(int argc, char* argv[])
refresh();
getchar();
- outs(ANSI_COLOR(1;33) "test " ANSI_COLOR(34) "x"
- ANSI_RESET "te" ANSI_COLOR(43;0;1;35) " st"
+ outs(ANSI_COLOR(1;33) "test " ANSI_COLOR(34) "x"
+ ANSI_RESET "te" ANSI_COLOR(43;0;1;35) " st"
ANSI_RESET "testx\n");
refresh();
getchar();
diff --git a/pttbbs/mbbsd/pmore.c b/pttbbs/mbbsd/pmore.c
index 6b19b7d9..b5d41875 100644
--- a/pttbbs/mbbsd/pmore.c
+++ b/pttbbs/mbbsd/pmore.c
@@ -7,14 +7,14 @@
* designed for unlimilited length(lines).
*
* "pmore" is "piaip's more", NOT "PTT's more"!!!
- * pmore is designed for general maple-family BBS systems, not
+ * pmore is designed for general maple-family BBS systems, not
* specific to any branch.
*
* Author: Hung-Te Lin (piaip), June 2005.
*
* Copyright (c) 2005-2009 Hung-Te Lin <piaip@csie.ntu.edu.tw>
* All rights reserved.
- *
+ *
* Distributed under a Non-Commercial 4clause-BSD alike license.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
* The acknowledgement can be localized with the name unchanged.
* 4. You may not exercise any of the rights granted to you above in any
* manner that is primarily intended for or directed toward commercial
- * advantage or private monetary compensation. For avoidance of doubt,
+ * advantage or private monetary compensation. For avoidance of doubt,
* using in a program providing commercial network service is also
* prohibited.
*
@@ -67,7 +67,7 @@
* - ASCII Art movie support [done]
* - ASCII Art movie navigation keys [pending]
* - A new optimized terminal base system (piterm) [change -> pfterm]
- * -
+ * -
* - [2007, Interactive Movie Enhancement]
* - New Invisible Frame Header Code [done]
* - Playback Control (pause, stop, skip) [done]
@@ -215,7 +215,7 @@
// clear() / clrtobol() / clrtoeol(): screen clear API
// move(): move cursor location
// scroll() / rscroll() / refresh(): scroll / reverse-scroll / refresh screen
-// getdata / getdata_buf : query user input
+// getdata / getdata_buf : query user input
//
// ----------------------------------------------------------------
// Maple3 Porting
@@ -230,8 +230,8 @@
// .....................................................
// free(fimage);
// +#endif // M3_USE_PMORE
-// if (!cmd) /* ...
-// (3) if you want to override to override any special keys
+// if (!cmd) /* ...
+// (3) if you want to override to override any special keys
// or help pages, you may change to pmore2 and write
// your own key_handler and help_handler.
#ifdef M3_USE_PMORE
@@ -255,7 +255,7 @@
#undef PMORE_USE_REPLYKEY_HINTS
#undef PMORE_HAVE_SYNCNOW
#undef PMORE_HAVE_VKEY
- #undef PMORE_IGNORE_UNKNOWN_NAVKEYS
+ #undef PMORE_IGNORE_UNKNOWN_NAVKEYS
#undef PMORE_AUTOEXIT_FIRSTPAGE
#define PMORE_AUTONEXT_ON_PAGEFLIP
#define PMORE_AUTONEXT_ON_RIGHTKEY
@@ -309,7 +309,7 @@
#endif
/* Developer's Guide
- *
+ *
* OVERVIEW
* - pmore is designed as a line-oriented pager. After you load (mf_attach)
* a file, you can move current display window by lines (mf_forward and
@@ -319,7 +319,7 @@
* - Functions are designed to work with global variables.
* However you can overcome re-entrance problem by backuping up variables
* or replace all "." to "->" with little modification and add pointer as
- * argument passed to each function.
+ * argument passed to each function.
* (This is really tested and it works, however then using global variables
* is considered to be faster and easier to maintain, at lease shorter in
* time to key-in and for filelength).
@@ -339,12 +339,12 @@
* pages may result in a page with single line conent (if you set display
* starting pointer to the real last line).
* - To overcome this issue, maxdisps is introduced. It tries to go backward
- * one page from end of file (this operation is lighter than visiting
+ * one page from end of file (this operation is lighter than visiting
* entire file content for line number calculation). Then we can set this
* as boundary of forward navigation.
* - maxlinenoS is the line number of maxdisps. It's NOT the real number of
* total line in current file (You have to add the last page). That's why
- * it has a strange name of trailing "S", to hint you that it's not
+ * it has a strange name of trailing "S", to hint you that it's not
* "maxlineno" which is easily considered as "max(total) line number".
*
* HINTS:
@@ -429,14 +429,14 @@ static int debug = 0;
* with this situation. However your should increase your I/O buffer to prevent
* flickers.
*/
-MFFPROTO void
+MFFPROTO void
pmore_clrtoeol(int y, int x)
{
#ifdef PMORE_WORKAROUND_CLRTOEOL
- int i;
- move(y, x);
- for (i = x; i < t_columns; i++)
- outc(' ');
+ int i;
+ move(y, x);
+ for (i = x; i < t_columns; i++)
+ outc(' ');
clrtoeol();
move(y, x); // this is required, due to outc().
#else
@@ -458,10 +458,10 @@ pmore_outns(const char *str, int n)
// --------------------------- <Main Navigation>
typedef struct
{
- unsigned char
+ unsigned char
*start, *end, // file buffer
*disps, *dispe, // displayed content start/end
- *maxdisps; // a very special pointer,
+ *maxdisps; // a very special pointer,
// consider as "disps of last page"
off_t len; // file total length
long lineno, // lineno of disps
@@ -477,15 +477,15 @@ typedef struct
lastpagelines,// lines of last page to show
// this indicates how many lines can
// maxdisps(maxlinenoS) display.
- maxlinenoS; // lineno of maxdisps, "S"!
+ maxlinenoS; // lineno of maxdisps, "S"!
// What does the magic "S" mean?
- // Just trying to notify you that it's
+ // Just trying to notify you that it's
// NOT REAL MAX LINENO NOR FILELENGTH!!!
// You may consider "S" of "Start" (disps).
void (*detachHandler)();
} MmappedFile;
-MmappedFile mf = {
+MmappedFile mf = {
0, 0, 0, 0, 0, 0L,
0, -1L, 0, 0, -1L, -1L, -1L, -1L,
NULL // detachHandler
@@ -512,7 +512,7 @@ enum MF_DISP_CONST {
MFDISP_OPT_FORCEDIRTY,
// prefs
-
+
MFDISP_WRAP_TRUNCATE = 0,
MFDISP_WRAP_WRAP,
MFDISP_WRAP_MODES,
@@ -555,7 +555,7 @@ typedef struct
} MF_BrowsingPreference;
MF_BrowsingPreference bpref =
-{ MFDISP_WRAP_WRAP, MFDISP_SEP_DEFAULT, 1,
+{ MFDISP_WRAP_WRAP, MFDISP_SEP_DEFAULT, 1,
0, 0, 0, };
/* structure generalized for the one-arg mf_attach_handler */
@@ -568,7 +568,7 @@ struct SimpleBuffer {
#define FH_HEADERS (4) // how many headers do we know?
#define FH_HEADER_LEN (4) // strlen of each heads
#define FH_FLOATS (2) // right floating, name and val
-static const char *_fh_disp_heads[FH_HEADERS] =
+static const char *_fh_disp_heads[FH_HEADERS] =
{"作者", "標題", "時間", "轉信"};
typedef struct
@@ -738,7 +738,7 @@ MFFPROTO int mf_movieMaskedInput(int c);
#define MOVIE_ANTI_ANTI_IDLE
// some magic value that your vkey() will never return
-#define MOVIE_KEY_ANY (0x4d464b41)
+#define MOVIE_KEY_ANY (0x4d464b41)
// some environments already converted 0x7F to 0x08,
// but we'd still do it again here for compatibility.
@@ -814,15 +814,15 @@ mf_gunzip(const char *fn GCC_UNUSED, int fd)
}
#endif
-/*
- * mmap basic operations
+/*
+ * mmap basic operations
*/
MFPROTO void mf_detach();
MFPROTO void mf_detach_nounmap();
MFPROTO int mf_postattach();
-MFPROTO int
+MFPROTO int
mf_attach_file(void *fnptr)
{
// We are passing pointer
@@ -878,7 +878,7 @@ mf_attach_buffer(void *buf)
return mf_postattach();
}
-MFPROTO int
+MFPROTO int
mf_postattach()
{
mf.end = mf.start + mf.len;
@@ -903,7 +903,7 @@ mf_postattach()
return 1;
}
-MFPROTO void
+MFPROTO void
mf_detach()
{
mf_freeHeaders();
@@ -924,7 +924,7 @@ mf_detach_nounmap()
/*
* lineno calculation, and moving
*/
-MFFPROTO void
+MFFPROTO void
mf_sync_lineno()
{
unsigned char *p;
@@ -953,7 +953,7 @@ mf_determinemaxdisps(int backlines, int update_by_offset)
if (update_by_offset) {
if (backlines > 0) {
- /* tricky way because usually
+ /* tricky way because usually
* mf_forward checks maxdisps.
*/
mf.disps = mf.maxdisps;
@@ -991,7 +991,7 @@ mf_determinemaxdisps(int backlines, int update_by_offset)
* mf.disps
* mf.lineno
*/
-MFPROTO int
+MFPROTO int
mf_backward(int lines)
{
int real_moved = 0;
@@ -1019,7 +1019,7 @@ mf_backward(int lines)
return real_moved;
}
-MFPROTO int
+MFPROTO int
mf_forward(int lines)
{
int real_moved = 0;
@@ -1047,7 +1047,7 @@ mf_forward(int lines)
*/
}
-MFFPROTO int
+MFFPROTO int
mf_goTop()
{
if (mf.disps == mf.start && mf.xpos > 0)
@@ -1057,7 +1057,7 @@ mf_goTop()
return MFNAV_OK;
}
-MFFPROTO int
+MFFPROTO int
mf_goBottom()
{
mf.disps = mf.maxdisps;
@@ -1066,7 +1066,7 @@ mf_goBottom()
return MFNAV_OK;
}
-MFFPROTO int
+MFFPROTO int
mf_goto(int lineno)
{
mf.disps = mf.start;
@@ -1074,13 +1074,13 @@ mf_goto(int lineno)
return mf_forward(lineno);
}
-MFFPROTO int
+MFFPROTO int
mf_viewedNone()
{
return (mf.disps <= mf.start);
}
-MFFPROTO int
+MFFPROTO int
mf_viewedAll()
{
return (mf.dispe >= mf.end);
@@ -1088,7 +1088,7 @@ mf_viewedAll()
/*
* search!
*/
-MFPROTO int
+MFPROTO int
mf_search(int direction)
{
unsigned char *s = sr.search_str;
@@ -1148,7 +1148,7 @@ mf_search(int direction)
#define ISSPACE(x) (x <= ' ')
-MFPROTO void
+MFPROTO void
pmore_str_strip_ansi(unsigned char *p) // warning: p is NULL terminated
{
unsigned char *pb = p;
@@ -1171,10 +1171,10 @@ pmore_str_strip_ansi(unsigned char *p) // warning: p is NULL terminated
}
}
-/* this chomp is a little different:
+/* this chomp is a little different:
* it kills starting and trailing spaces.
*/
-MFPROTO void
+MFPROTO void
pmore_str_chomp(unsigned char *p)
{
unsigned char *pb = p + ustrlen(p)-1;
@@ -1196,7 +1196,7 @@ pmore_str_chomp(unsigned char *p)
* Format Related
*/
-MFPROTO void
+MFPROTO void
mf_freeHeaders()
{
if (fh.lines > 0) {
@@ -1210,7 +1210,7 @@ mf_freeHeaders()
}
}
-MFPROTO void
+MFPROTO void
mf_parseHeaders()
{
/* file format:
@@ -1235,7 +1235,7 @@ mf_parseHeaders()
} else if (strncmp((char*)mf.start, STR_AUTHOR2, LEN_AUTHOR2) == 0) {
fh.lines = 4;
}
- else
+ else
return;
for (i = 0; i < fh.lines; i++) {
@@ -1253,7 +1253,7 @@ mf_parseHeaders()
fh.lines --;
break;
}
-
+
p = pmf;
pmf ++; // move to next line.
@@ -1321,7 +1321,7 @@ mf_parseHeaders()
*/
MFFPROTO void
MFDISP_SKIPCURLINE()
-{
+{
while (mf.dispe < mf.end && *mf.dispe != '\n')
mf.dispe++;
}
@@ -1373,7 +1373,7 @@ static char *override_attr = NULL;
* display mf content from disps for MFDISP_PAGE
*/
-MFPROTO void
+MFPROTO void
mf_display()
{
int lines = 0, col = 0, currline = 0, wrapping = 0;
@@ -1420,7 +1420,7 @@ mf_display()
int scrll = mf.lineno - mf.oldlineno, i;
int reverse = (scrll > 0 ? 0 : 1);
- if (reverse)
+ if (reverse)
scrll = -scrll;
else
{
@@ -1471,7 +1471,7 @@ mf_display()
clear(), move(0, 0);
mf.dispe = mf.disps;
- while (lines < MFDISP_PAGE)
+ while (lines < MFDISP_PAGE)
{
int inAnsi = 0;
int newline = newline_default;
@@ -1490,7 +1490,7 @@ mf_display()
if (optimized == MFDISP_OPT_FORCEDIRTY)
{
- /* btw, apparently this line should be visible.
+ /* btw, apparently this line should be visible.
* if not, maybe something wrong.
*/
pmore_clrtoeol(lines, 0);
@@ -1502,7 +1502,7 @@ mf_display()
{
if (mf.dispedlines == 23)
return;
- }
+ }
else if (mfmovie.mode == MFDISP_MOVIE_DETECTED)
{
// detected only applies for first page.
@@ -1511,7 +1511,7 @@ mf_display()
if (mf_movieFrameHeader(mf.dispe, mf.end))
MFDISP_SKIPCURLINE();
}
- else if (mfmovie.mode == MFDISP_MOVIE_UNKNOWN ||
+ else if (mfmovie.mode == MFDISP_MOVIE_UNKNOWN ||
mfmovie.mode == MFDISP_MOVIE_PLAYING)
{
if (mf_movieFrameHeader(mf.dispe, mf.end))
@@ -1535,7 +1535,7 @@ mf_display()
MFDISP_DIRTY();
return;
}
- }
+ }
#endif
/* Is currentline visible? */
@@ -1569,7 +1569,7 @@ mf_display()
* leads to slow display (we cannt speed it up with
* optimized scrolling.
*/
- if (bpref.separator & MFDISP_SEP_WRAP)
+ if (bpref.separator & MFDISP_SEP_WRAP)
{
/* we have to do all wrapping stuff
* in normal text section.
@@ -1578,14 +1578,14 @@ mf_display()
wrapping = 1;
mf.wraplines ++;
MFDISP_FORCEDIRTY2BOT();
- if (mf.dispe > mf.start &&
+ if (mf.dispe > mf.start &&
mf.dispe < mf.end &&
*mf.dispe == '\n')
mf.dispe --;
}
else
MFDISP_SKIPCURLINE();
- }
+ }
else if (currline < fh.lines && bpref.rawmode == MFDISP_RAW_NA )
{
/* case 2, we're printing headers */
@@ -1603,7 +1603,7 @@ mf_display()
w -= ustrlen(fh.floats[0]) + ustrlen(fh.floats[1]) + 4;
}
- prints("%-*.*s", w, w,
+ prints("%-*.*s", w, w,
(val ? val : ""));
if (currline == 0 && fh.floats[0])
@@ -1617,7 +1617,7 @@ mf_display()
outs(ANSI_RESET);
MFDISP_SKIPCURLINE();
- }
+ }
else if (mf.dispe < mf.end)
{
/* case 3, normal text */
@@ -1644,14 +1644,14 @@ mf_display()
line_head--;
dist = mf.end - line_head;
- if (dist > 1 &&
- (*line_head == ':' || *line_head == '>') &&
+ if (dist > 1 &&
+ (*line_head == ':' || *line_head == '>') &&
*(line_head + 1) == ' ')
{
outs(ANSI_COLOR(0;36));
flResetColor = 1;
- } else if (dist > 2 &&
- (!strncmp((char*)line_head, "※", 2) ||
+ } else if (dist > 2 &&
+ (!strncmp((char*)line_head, "※", 2) ||
!strncmp((char*)line_head, "==>", 3)))
{
outs(ANSI_COLOR(0;32));
@@ -1679,7 +1679,7 @@ mf_display()
xprefix --;
else
{
- outc(c);
+ outc(c);
col++;
}
}
@@ -1728,10 +1728,10 @@ mf_display()
dbcs_incomplete == NULL &&
#endif
mf.end - mf.dispe > sr.len &&
- sr.cmpfunc((char*)mf.dispe,
+ sr.cmpfunc((char*)mf.dispe,
(char*)sr.search_str, sr.len) == 0)
{
- outs(ANSI_REVERSE);
+ outs(ANSI_REVERSE);
srlen = sr.len-1;
flResetColor = 1;
}
@@ -1745,17 +1745,17 @@ mf_display()
//
// or use the sample version inside pmore source.
//
- if (inAnsi &&
+ if (inAnsi &&
mf.end - mf.dispe > 2 &&
*(mf.dispe+1) == '*')
{
int i;
// the max esc_star sequence in your system
- char esbuf[4]= "";
+ char esbuf[4]= "";
// the max expanded size of esc_star.
- char buf[64] = "" ;
+ char buf[64] = "" ;
char *pbuf = buf;
memcpy(buf, mf.dispe, 3); // ^[*s
@@ -1769,7 +1769,7 @@ mf_display()
// assert(sizeof(buf) >= sizeof(esbuf));
strncpy(esbuf, buf, sizeof(esbuf));
esbuf[sizeof(esbuf)-1] = 0; // because we use strncpy.
-
+
if (expand_esc_star(buf, esbuf, sizeof(buf)) > 1)
{
override_attr = ANSI_COLOR(1;37;41);
@@ -1780,7 +1780,7 @@ mf_display()
// also try to consider xprefix
// (assume no ANSI stuff in converted buf)
- if (xprefix > 0)
+ if (xprefix > 0)
{
if (xprefix >= i)
{
@@ -1882,7 +1882,7 @@ mf_display()
if (dbcs_incomplete)
dbcs_incomplete = NULL;
- else if (PMORE_DBCS_LEADING(c))
+ else if (PMORE_DBCS_LEADING(c))
dbcs_incomplete = mf.dispe;
#endif
if (xprefix > 0)
@@ -1928,7 +1928,7 @@ mf_display()
* display this when ANSI escapes were used
* in same line. However, on most
* situation this works.
- * So we used an alternative, forced ANSI
+ * So we used an alternative, forced ANSI
* move command.
*/
// move(lines, col-1);
@@ -1937,7 +1937,7 @@ mf_display()
lines+1, col-1+1);
/* to preven ANSI ESCAPE being tranlated as
* DBCS trailing byte. */
- outc(' ');
+ outc(' ');
/* move back one column */
outs(ansicmd);
/* erase it (previous leading byte)*/
@@ -1979,7 +1979,7 @@ mf_display()
wrapping = 0;
}
- if (mf.dispe < mf.end && *mf.dispe == '\n')
+ if (mf.dispe < mf.end && *mf.dispe == '\n')
mf.dispe ++;
// else, we're in wrap mode.
@@ -2017,12 +2017,12 @@ mf_display()
* o.k, now we know maxline should be one line forward.
*/
mf_determinemaxdisps(+1, 1);
- } else
+ } else
{
/* not caused by separator?
* ok, then it's by wrapped lines.
*
- * old flavor: go bottom:
+ * old flavor: go bottom:
* mf_determinemaxdisps(0)
* however we have "update" method now,
* so we can achieve more user friendly behavior.
@@ -2043,7 +2043,7 @@ mf_display_footer(
// format:
// |PageNo Percentage|Detail Info|Floating1 (context)|Floating2 (quit)
// |SUMMARY|DETAIL|HELP
-
+
char buf[256]; // must be large enough to hold temporary data
int avail = t_columns-1; // available space
int w; // for width calculation
@@ -2052,10 +2052,10 @@ mf_display_footer(
* page determination is hard.
* should we use starting line, or finishing line?
*/
- int nowpage =
+ int nowpage =
(int)((mf.lineno + mf.dispedlines/2) / MFNAV_PAGE)+1;
int allpages = -1; /* unknown yet */
- int progress =
+ int progress =
(int)((unsigned long)(mf.dispe-mf.start) * 100 / mf.len);
#ifdef DEBUG
@@ -2067,7 +2067,7 @@ mf_display_footer(
prints("L#%ld(w%ld,lp%ld) Dsp:%08X/%08X/%08X, "
"F:%08X/%08X(%d) tScr(%dx%d)",
mf.lineno, mf.wraplines, mf.lastpagelines,
- (unsigned int)mf.disps,
+ (unsigned int)mf.disps,
(unsigned int)mf.maxdisps,
(unsigned int)mf.dispe,
(unsigned int)mf.start, (unsigned int)mf.end,
@@ -2082,14 +2082,14 @@ mf_display_footer(
// determine pges
if (mf.maxlinenoS >= 0)
{
- allpages =
+ allpages =
(int)((mf.maxlinenoS + mf.lastpagelines -
((bpref.separator & MFDISP_SEP_WRAP) &&
(fh.lines >= 0) ? 0:1)) / MFNAV_PAGE)+1;
if (mf.lineno >= mf.maxlinenoS || nowpage > allpages)
nowpage = allpages;
/*
- nowpage =
+ nowpage =
(int)((mf.lineno + mf.dispedlines-2) / MFNAV_PAGE)+1 ;
*/
}
@@ -2114,16 +2114,16 @@ mf_display_footer(
prints(" 瀏覽 P.%d(%d%%) ", nowpage, progress);
outs(
PMORE_COLOR_FOOTER3 " "
- PMORE_COLOR_FOOTER3_KEY "(h)"
+ PMORE_COLOR_FOOTER3_KEY "(h)"
PMORE_COLOR_FOOTER3_TEXT "求助 "
- PMORE_COLOR_FOOTER3_KEY
+ PMORE_COLOR_FOOTER3_KEY
"→↓[PgUp][PgDn][Home][End]"
PMORE_COLOR_FOOTER3_TEXT "游標移動 "
PMORE_COLOR_FOOTER3_KEY "←[q]"
PMORE_COLOR_FOOTER3_TEXT "結束 "
);
return;
- }
+ }
// pmore style footer
@@ -2159,7 +2159,7 @@ mf_display_footer(
{
snprintf(buf, sizeof(buf),
" 顯示範圍: %d~%d 欄位, %02d~%02d 行",
- (int)mf.xpos+1,
+ (int)mf.xpos+1,
(int)(mf.xpos + t_columns-(mf.trunclines ? 2 : 1)),
(int)(mf.lineno + 1),
(int)(mf.lineno + mf.dispedlines)
@@ -2187,7 +2187,7 @@ mf_display_footer(
{
footer_handler(progress, avail, ctx);
return;
- }
+ }
// part 3, help: context help and quit hotkeys
#define PMORE_MSG_FOOTER_FLOAT_SHORT \
@@ -2276,15 +2276,15 @@ PMORE_UINAV_FORWARDLINE()
* piaip's more, a replacement for old more
*/
static int
-_pmore2(
+_pmore2(
int promptend, void *ctx,
- int (*mf_attach_handler)(void *), void *ahctx,
+ int (*mf_attach_handler)(void *), void *ahctx,
int (*key_handler) (int key, void *ctx),
int (*footer_handler)(int ratio, int width, void *ctx),
int (*help_handler) (int y, void *ctx));
int
-pmore2(
+pmore2(
const char *fpath, int promptend, void *ctx,
int (*key_handler) (int key, void *ctx),
int (*footer_handler)(int ratio, int width, void *ctx),
@@ -2299,7 +2299,7 @@ pmore2(
}
int
-pmore2_inmemory(
+pmore2_inmemory(
void *content, int size,
int promptend, void *ctx,
int (*key_handler) (int key, void *ctx),
@@ -2320,9 +2320,9 @@ pmore2_inmemory(
}
static int
-_pmore2(
+_pmore2(
int promptend, void *ctx,
- int (*mf_attach_handler)(void *), void *ahctx,
+ int (*mf_attach_handler)(void *), void *ahctx,
int (*key_handler) (int key, void *ctx),
int (*footer_handler)(int ratio, int width, void *ctx),
int (*help_handler) (int y, void *ctx)
@@ -2349,7 +2349,7 @@ _pmore2(
bkfh = fh;
RESETFH();
RESETMF();
-
+
override_msg = NULL; /* elimiate pending errors */
// set mode if system supports it
@@ -2368,7 +2368,7 @@ _pmore2(
{
if (invalidate)
{
- mf_display();
+ mf_display();
invalidate = 0;
}
@@ -2391,13 +2391,13 @@ _pmore2(
MFDISP_DIRTY();
#ifdef PMORE_AUTOEXIT_FIRSTPAGE
- // XXX a special case is 'random one frame then stop'.
+ // XXX a special case is 'random one frame then stop'.
// let's workaround for it.
if (mfmovie.mode == MFDISP_MOVIE_YES)
{
// re-display the page again!
mfmovie.mode = MFDISP_MOVIE_PLAYING;
- mf_display();
+ mf_display();
RESET_MOVIE();
break;
}
@@ -2414,7 +2414,7 @@ _pmore2(
move(b_lines, 0);
// clrtoeol(); // this shall be done in mf_display to speed up.
-
+
#ifdef USE_BBSLUA
// TODO prompt BBS Lua status here.
#endif // USE_BBSLUA
@@ -2440,7 +2440,7 @@ _pmore2(
while (w-- > 0) outc(' '); outs(ANSI_RESET ANSI_CLRTOEND);
w = tolower(vkey());
- if ( w != 'n' &&
+ if ( w != 'n' &&
w != KEY_UP && w != KEY_LEFT &&
w != 'q')
{
@@ -2547,7 +2547,7 @@ _pmore2(
continue;
case 0:
- // common return value of 'do nothing',
+ // common return value of 'do nothing',
// meaning 'continue processing this key' here.
break;
@@ -2723,8 +2723,8 @@ _pmore2(
40, DOECHO);
if (sbuf[0]) {
- if (getdata(b_lines - 1, 0,
- PMORE_MSG_SEARCH_LETTERCASE "[N] ",
+ if (getdata(b_lines - 1, 0,
+ PMORE_MSG_SEARCH_LETTERCASE "[N] ",
ans, sizeof(ans), LCECHO) && *ans == 'y')
sr.cmpfunc = strncmp;
else if (*ans == 'q')
@@ -2761,8 +2761,8 @@ _pmore2(
buf[0] = ch, buf[1] = 0;
pmore_clrtoeol(b_lines-1, 0);
- getdata_buf(b_lines-1, 0,
- (pageMode ?
+ getdata_buf(b_lines-1, 0,
+ (pageMode ?
PMORE_MSG_GOTO_PAGE : PMORE_MSG_GOTO_LINE),
buf, 8, DOECHO);
if (buf[0]) {
@@ -2819,17 +2819,17 @@ _pmore2(
// mf_goTop();
mf_movieNextFrame();
MFDISP_DIRTY();
- }
+ }
else if (mfmovie.mode == MFDISP_MOVIE_NO)
{
static char buf[10]="1";
//move(b_lines-1, 0);
-
- /*
+
+ /*
* TODO scan current page to confirm if this is a new style movie
*/
pmore_clrtoeol(b_lines-1, 0);
- getdata_buf(b_lines - 1, 0,
+ getdata_buf(b_lines - 1, 0,
PMORE_MSG_MOVIE_PLAYOLD_GETTIME,
buf, 8, LCECHO);
@@ -2847,7 +2847,7 @@ _pmore2(
{
char ans[4];
pmore_clrtoeol(b_lines-1, 0);
- getdata(b_lines - 1, 0,
+ getdata(b_lines - 1, 0,
PMORE_MSG_MOVIE_PLAYOLD_AS24L,
ans, 3, LCECHO);
if (ans[0] == 'n')
@@ -2879,7 +2879,7 @@ _pmore2(
}
// backward compatible
-int
+int
pmore(const char *fpath, int promptend)
{
return pmore2(fpath, promptend, NULL, NULL, NULL, NULL);
@@ -2924,7 +2924,7 @@ pmore_prefEntry(
outs(PREFATTR_BAR " |" ANSI_RESET);
// test if option has hotkey
- if (*options && *options != '\t' &&
+ if (*options && *options != '\t' &&
*(options+1) && *(options+1) == '.')
{
// found hotkey
@@ -2952,7 +2952,7 @@ pmore_prefEntry(
outc('\n');
}
-MFPROTO void
+MFPROTO void
pmore_PromptBar(const char *caption, int shadow)
{
int i = 0;
@@ -3123,7 +3123,7 @@ pmore_Preference()
#define HLP_KEYLIST_COLOR PMHLPATTR_NORMAL_KEY
#endif
-static const char
+static const char
*hlp_basic[] = {
"【基本移動】", NULL,
" 下翻一頁", "^F → PgDn Space",
@@ -3166,15 +3166,15 @@ MFPROTO void
pmore_Help(void *ctx, int (*help_handler)(int y, void *ctx))
{
const char **t_tables[PMHLP_BLOCKS] = { hlp_basic, hlp_adv, hlp_sys};
- const int col_widths[PMHLP_BLOCKS] = { 29, 27, 20 },
- l_widths [PMHLP_BLOCKS] = { 12, 13, 15 };
+ const int col_widths[PMHLP_BLOCKS] = { 29, 27, 20 },
+ l_widths [PMHLP_BLOCKS] = { 12, 13, 15 };
const int n_t_tables =PMHLP_BLOCKS;
int i, incomplete;
int y = 2; // height of prompt bar
clear();
pmore_PromptBar(PMORE_MSG_HELP_TITLE, PMORE_SHADOW_BELOW);
- do
+ do
{
incomplete = n_t_tables;
y++;
@@ -3189,7 +3189,7 @@ pmore_Help(void *ctx, int (*help_handler)(int y, void *ctx))
if (!rvar) { // draw category
prints(HLP_CATEGORY_COLOR "%-*s", col_widths[i], lvar);
continue;
- }
+ }
if (!lvar) { // table is complete...
incomplete --;
lvar = "";
@@ -3202,7 +3202,7 @@ pmore_Help(void *ctx, int (*help_handler)(int y, void *ctx))
}
outc('\n');
} while (incomplete);
-
+
// show additional help information
if (help_handler)
help_handler(y, ctx);
@@ -3218,7 +3218,7 @@ pmore_Help(void *ctx, int (*help_handler)(int y, void *ctx))
// ---------------------------------------------------- Extra modules
#ifdef PMORE_USE_ASCII_MOVIE
-void
+void
mf_float2tv(float f, struct timeval *ptv)
{
if (f < MOVIE_MIN_FRAMECLK)
@@ -3230,14 +3230,14 @@ mf_float2tv(float f, struct timeval *ptv)
ptv->tv_usec = (f - (long)f) * MOVIE_SECOND_U;
}
-int
+int
mf_str2float(unsigned char *p, unsigned char *end, float *pf)
{
char buf[16] = {0};
int cbuf = 0;
/* process time */
- while ( p < end &&
+ while ( p < end &&
cbuf < (int)sizeof(buf)-1 &&
(isdigit(*p) || *p == '.' || *p == '+' || *p == '-'))
buf[cbuf++] = *p++;
@@ -3256,7 +3256,7 @@ mf_str2float(unsigned char *p, unsigned char *end, float *pf)
* your I/O system, but we'll do it here.
* override if you have better methods.
*/
-MFPROTO int
+MFPROTO int
mf_movieWaitKey(struct timeval *ptv, int dorefresh)
{
int sel = 0;
@@ -3302,7 +3302,7 @@ mf_movieWaitKey(struct timeval *ptv, int dorefresh)
// now, maybe something for read (sel > 0)
// or time out (sel == 0)
// or weird error (sel < 0)
-
+
// sync clock(now) if timeout.
#ifdef PMORE_HAVE_SYNCNOW
if (sel == 0)
@@ -3328,7 +3328,7 @@ mf_moviePromptPlaying(int type)
if (override_attr) outs(override_attr);
w -= strlen(override_msg);
outs(override_msg);
- while (w-- > 0) outc(' ');
+ while (w-- > 0) outc(' ');
outs(ANSI_RESET ANSI_CLRTOEND);
RESET_OVERRIDE_MSG();
@@ -3347,7 +3347,7 @@ mf_moviePromptPlaying(int type)
outs(ANSI_RESET ANSI_COLOR(1;30;47));
}
- w -= strlen(s); outs(s);
+ w -= strlen(s); outs(s);
while (w-- > 0) outc(' ');
outs(ANSI_RESET ANSI_CLRTOEND);
@@ -3364,7 +3364,7 @@ mf_moviePromptPlaying(int type)
MFPROTO int
mf_moviePromptOptions(
int isel, int maxsel,
- int key,
+ int key,
unsigned char *text, unsigned int szText)
{
unsigned char *s = text;
@@ -3408,16 +3408,16 @@ mf_moviePromptOptions(
}
// check text: we don't allow special char.
- if (text && szText && text[0])
+ if (text && szText && text[0])
{
while (s < text + szText && *s > ' ')
{
s++;
}
szText = s - text;
- }
+ }
else
- {
+ {
// default option text
text = (unsigned char*)"☆";
szText = ustrlen(text);
@@ -3442,7 +3442,7 @@ mf_moviePromptOptions(
return printlen;
}
-MFFPROTO int
+MFFPROTO int
mf_movieNamedKey(int c)
{
switch (c)
@@ -3468,14 +3468,14 @@ mf_movieNamedKey(int c)
return 0;
}
-MFFPROTO int
+MFFPROTO int
mf_movieIsSystemBreak(int c)
{
return (c == 'q' || c == 'Q' || c == Ctrl('C'))
? 1 : 0;
}
-MFFPROTO int
+MFFPROTO int
mf_movieMaskedInput(int c)
{
unsigned char *p = mfmovie.optkeys;
@@ -3494,7 +3494,7 @@ mf_movieMaskedInput(int c)
// general look up
while (p < mf.end && *p && *p != '\n' && *p != '#')
{
- if (*p == '@' && mf.end - p > 1
+ if (*p == '@' && mf.end - p > 1
&& isalnum(*(p+1))) // named key
{
p++;
@@ -3511,7 +3511,7 @@ mf_movieMaskedInput(int c)
return 0;
}
-unsigned char *
+unsigned char *
mf_movieFrameHeader(unsigned char *p, unsigned char *end)
{
// ANSI has ESC_STR [8m as "Conceal" but
@@ -3519,7 +3519,7 @@ mf_movieFrameHeader(unsigned char *p, unsigned char *end)
// So let's go back to fixed format...
static char *patHeader = "==" ESC_STR "[30;40m^L";
static char *patHeader2= ESC_STR "[30;40m^L"; // patHeader + 2; // "=="
- // static char *patHeader3= ESC_STR "[m^L";
+ // static char *patHeader3= ESC_STR "[m^L";
static size_t szPatHeader = 12; // strlen(patHeader);
static size_t szPatHeader2 = 10; // strlen(patHeader2);
// static size_t szPatHeader3 = 5; // strlen(patHeader3);
@@ -3536,7 +3536,7 @@ mf_movieFrameHeader(unsigned char *p, unsigned char *end)
return p+2;
// Add more frame headers
-
+
/* // *[m seems not so common, skip.
if (sz < szPatHeader3) return NULL;
if (memcmp(p, patHeader3, szPatHeader3) == 0)
@@ -3554,7 +3554,7 @@ mf_movieFrameHeader(unsigned char *p, unsigned char *end)
return NULL;
}
-MFPROTO int
+MFPROTO int
mf_movieGotoNamedFrame(const unsigned char *name, const unsigned char *end)
{
const unsigned char *p = name;
@@ -3573,7 +3573,7 @@ mf_movieGotoNamedFrame(const unsigned char *name, const unsigned char *end)
{
if ((p = mf_movieFrameHeader(mf.disps, mf.end)) == NULL ||
*p != ':')
- continue;
+ continue;
// got some frame. let's check the name
p++;
@@ -3592,7 +3592,7 @@ mf_movieGotoNamedFrame(const unsigned char *name, const unsigned char *end)
return 0;
}
-MFPROTO int
+MFPROTO int
mf_movieGotoFrame(int fno, int relative)
{
if (!relative)
@@ -3616,7 +3616,7 @@ mf_movieGotoFrame(int fno, int relative)
} while (fno > 0);
} else {
// backward
- // For backward, the first call moves to beginning of current line
+ // For backward, the first call moves to beginning of current line
// (which is frame header). so the loop should be be (abs(fno)+1),
// and that's why use <= here.
while (fno <= 0)
@@ -3694,10 +3694,10 @@ mf_movieExecuteOffsetCmd(unsigned char *s, unsigned char *end)
// offset: is 1 .. N for all cases
int curr = 0, newno = 0;
-
+
switch (*s)
{
- case 'p':
+ case 'p':
// by page
curr = (mf.lineno / MFDISP_PAGE) + 1;
newno = mf_parseOffsetCmd(s+1, end, curr);
@@ -3740,7 +3740,7 @@ mf_movieExecuteOffsetCmd(unsigned char *s, unsigned char *end)
if (newno <= 0)
return 0;
- // XXX this is dropping performance...
+ // XXX this is dropping performance...
// need to optimize again someday.
// XXX by the odisps design in mf_movieNextFrame,
// we seems don't really need this...
@@ -3752,7 +3752,7 @@ mf_movieExecuteOffsetCmd(unsigned char *s, unsigned char *end)
case ':':
// XXX need to handle endless loop case
-
+
// by names
return mf_movieGotoNamedFrame(s+1, end);
@@ -3769,14 +3769,14 @@ mf_movieExecuteOffsetCmd(unsigned char *s, unsigned char *end)
* @return 0: duration timeout
* @return -1: invalid option
*/
-MFPROTO int
+MFPROTO int
mf_movieOptionHandler(unsigned char *opt, unsigned char *end)
{
// format: #time#key1,cmd,text1#key2,cmd,text2#
// if key is empty, use auto-increased key.
// if cmd is empty, invalid.
// if text is empty, display key only or hide if time is assigned.
-
+
int ient = 0;
unsigned char *pkey = NULL, *cmd = NULL, *text = NULL;
unsigned int szCmd = 0, szText = 0;
@@ -3792,7 +3792,7 @@ mf_movieOptionHandler(unsigned char *opt, unsigned char *end)
// TODO handle line length
// TODO restrict option size
-
+
// set up timer (opt points to optional time now)
do {
p = opt;
@@ -3816,7 +3816,7 @@ mf_movieOptionHandler(unsigned char *opt, unsigned char *end)
break;
} while (1);
-
+
// UI Selection
do {
// do c test here because we need parser to help us
@@ -3866,7 +3866,7 @@ mf_movieOptionHandler(unsigned char *opt, unsigned char *end)
// unknown parameters
break;
}
- }
+ }
// ready to parse one option
if (*p == '#')
@@ -3878,7 +3878,7 @@ mf_movieOptionHandler(unsigned char *opt, unsigned char *end)
{ cmd = NULL; szCmd = 0; }
// quick abort if option is invalid.
- if (!cmd)
+ if (!cmd)
continue;
if (szText == 0 || *text == ',' || *text == '#')
@@ -3894,7 +3894,7 @@ mf_movieOptionHandler(unsigned char *opt, unsigned char *end)
// handle special case @a (all) here
- if (*pkey == '@' &&
+ if (*pkey == '@' &&
++ pkey < end &&
(nk = mf_movieNamedKey(*pkey)))
{
@@ -3906,7 +3906,7 @@ mf_movieOptionHandler(unsigned char *opt, unsigned char *end)
}
// calculation complete.
-
+
// print option
if (!hideOpts && maxsel == 0 && text == NULL)
{
@@ -3930,7 +3930,7 @@ mf_movieOptionHandler(unsigned char *opt, unsigned char *end)
}
// handle selection
- if (c == key ||
+ if (c == key ||
(key == MOVIE_KEY_ANY && c != 0))
{
// hotkey pressed
@@ -4002,19 +4002,19 @@ mf_movieOptionHandler(unsigned char *opt, unsigned char *end)
if (c == KEY_LEFT || c == KEY_UP)
{
if (isel > 0) isel --;
- }
+ }
else if (c == KEY_RIGHT || c == KEY_TAB || c == KEY_DOWN)
{
if (isel < maxsel-1) isel ++;
- }
+ }
else if (c == KEY_HOME)
{
isel = 0;
- }
+ }
else if (c == KEY_END)
{
isel = maxsel -1;
- }
+ }
} while ( !selected );
@@ -4041,13 +4041,13 @@ mf_movieOptionHandler(unsigned char *opt, unsigned char *end)
}
/*
- * mf_movieSyncFrame:
+ * mf_movieSyncFrame:
* wait until synchronization, and flush break key (if any).
* return meaning:
* I've got synchronized.
* If no (user breaks), return 0
*/
-MFPROTO int
+MFPROTO int
mf_movieSyncFrame()
{
if (mfmovie.pause)
@@ -4058,7 +4058,7 @@ mf_movieSyncFrame()
if (mf_movieIsSystemBreak(c))
return 0;
return 1;
- }
+ }
else if (mfmovie.options)
{
unsigned char *opt = mfmovie.options;
@@ -4110,8 +4110,8 @@ mf_movieProcessCommand(unsigned char *p, unsigned char *end)
// SYNCHRONIZATION
gettimeofday(&mfmovie.synctime, NULL);
// S can take other commands
- }
- else if (*p == 'E')
+ }
+ else if (*p == 'E')
{
// END
STOP_MOVIE();
@@ -4119,24 +4119,24 @@ mf_movieProcessCommand(unsigned char *p, unsigned char *end)
MOVIECMD_SKIP_ALL(p,end);
return p;
}
- else if (*p == 'P')
+ else if (*p == 'P')
{
// PAUSE
mfmovie.pause = 1;
// MFDISP_SKIPCURLINE();
MOVIECMD_SKIP_ALL(p,end);
return p;
-
+
}
else if (*p == 'I')
{
// INTERRUPT
// Syntax: Icmd_from,cmd_to
- // Jump cmd_from, and execute until cmd_to,
+ // Jump cmd_from, and execute until cmd_to,
// then back here for next frame.
unsigned char *pfs, *pfe, *pts, *pte;
int curr_fno;
-
+
mfmovie.intr_src = NULL;
mfmovie.intr_dest_frame = 0;
@@ -4147,8 +4147,8 @@ mf_movieProcessCommand(unsigned char *p, unsigned char *end)
pts = pte = pfe+1;
while (pte < end && *pte > ' ' && *pte != ',')
pte++;
- // check syntax
- if ( pfe >= end || *pfe != ',' ||
+ // check syntax
+ if ( pfe >= end || *pfe != ',' ||
pts >= end)
{
MOVIECMD_SKIP_ALL(p,end);
@@ -4172,7 +4172,7 @@ mf_movieProcessCommand(unsigned char *p, unsigned char *end)
MOVIECMD_SKIP_ALL(p,end);
return p;
}
- else if (*p == 'G')
+ else if (*p == 'G')
{
// GOTO
// Gt+-n,t+-n,t+-n (random select one)
@@ -4182,7 +4182,7 @@ mf_movieProcessCommand(unsigned char *p, unsigned char *end)
unsigned char *pe = p;
unsigned int igs = 0;
- for (pe = p ; pe < end && *pe &&
+ for (pe = p ; pe < end && *pe &&
*pe > ' ' && *pe < 0x80
; pe ++)
if (*pe == ',') igs++;
@@ -4192,7 +4192,7 @@ mf_movieProcessCommand(unsigned char *p, unsigned char *end)
// make random
igs = random() % (igs+1);
- for (pe = p ; igs > 0 && pe < end && *pe &&
+ for (pe = p ; igs > 0 && pe < end && *pe &&
*pe > ' ' && *pe < 0x80
; pe ++)
if (*pe == ',') igs--;
@@ -4201,18 +4201,18 @@ mf_movieProcessCommand(unsigned char *p, unsigned char *end)
p = pe-1;
}
- mf_movieExecuteOffsetCmd(p+1, end);
+ mf_movieExecuteOffsetCmd(p+1, end);
MOVIECMD_SKIP_ALL(p,end);
return p;
- }
- else if (*p == ':')
+ }
+ else if (*p == ':')
{
// NAMED
// :name:
// name allows alnum only
p++;
// TODO check isalnum p?
-
+
// :name can accept trailing commands
while (p < end && *p != '\n' && *p != ':')
p++;
@@ -4223,7 +4223,7 @@ mf_movieProcessCommand(unsigned char *p, unsigned char *end)
p--;
continue;
}
- else if (*p == 'K')
+ else if (*p == 'K')
{
// Reserve Key for interactive usage.
// Currently only K#...# format is supported.
@@ -4250,7 +4250,7 @@ mf_movieProcessCommand(unsigned char *p, unsigned char *end)
MOVIECMD_SKIP_ALL(p,end);
return p;
}
- else if (*p == '#')
+ else if (*p == '#')
{
// OPTIONS
// #key1,frame1,text1#key2,frame2,text2#
@@ -4260,7 +4260,7 @@ mf_movieProcessCommand(unsigned char *p, unsigned char *end)
MOVIECMD_SKIP_ALL(p,end);
return p;
}
- else if (*p == 'O')
+ else if (*p == 'O')
{
// OLD compatible mode
// = -> compat24
@@ -4277,17 +4277,17 @@ mf_movieProcessCommand(unsigned char *p, unsigned char *end)
}
// MFDISP_SKIPCURLINE();
return p;
- }
+ }
#if 0
- else if (*p == 'L')
+ else if (*p == 'L')
{
// LOOP
- // Lm,n
+ // Lm,n
// m times to backward n
break;
- }
+ }
#endif
- else
+ else
{
// end of known control codes
break;
@@ -4296,18 +4296,18 @@ mf_movieProcessCommand(unsigned char *p, unsigned char *end)
return p;
}
-MFPROTO int
+MFPROTO int
mf_movieNextFrame()
{
- while (1)
+ while (1)
{
unsigned char *p = mf_movieFrameHeader(mf.disps, mf.end);
- if (p)
+ if (p)
{
float nf = 0;
unsigned char *odisps = mf.disps;
-
+
// check if we reached interrupt breakpoint
if (odisps == mfmovie.intr_src)
{
diff --git a/pttbbs/mbbsd/psb.c b/pttbbs/mbbsd/psb.c
index 4c0f5604..8cc368f5 100644
--- a/pttbbs/mbbsd/psb.c
+++ b/pttbbs/mbbsd/psb.c
@@ -35,8 +35,8 @@ typedef struct {
int key;
int allow_pbs_version_message;
void *ctx;
- int (*header)(void *ctx);
- int (*footer)(void *ctx);
+ int (*header)(void *ctx);
+ int (*footer)(void *ctx);
int (*renderer)(int i, int curr, int total, int rows, void *ctx);
int (*cursor)(int y, int curr, void *ctx);
int (*input_processor)(int key, int curr, int total, int rows, void *ctx);
@@ -84,7 +84,7 @@ psb_default_input_processor(int key, int curr, int total, int rows, void *ctx GC
case '0':
return 0;
- case KEY_END:
+ case KEY_END:
case '$':
return total-1;
@@ -102,7 +102,7 @@ psb_default_input_processor(int key, int curr, int total, int rows, void *ctx GC
return curr + rows;
return total - 1;
- case KEY_UP:
+ case KEY_UP:
case Ctrl('P'):
case 'p':
case 'k':
@@ -165,7 +165,7 @@ psb_main(PSB_CTX *psbctx)
move(psbctx->header_lines + i, 0);
SOLVE_ANSI_CACHE();
if (base + i < psbctx->total)
- psbctx->renderer(base + i, psbctx->curr, psbctx->total,
+ psbctx->renderer(base + i, psbctx->curr, psbctx->total,
rows, psbctx->ctx);
}
move(t_lines - psbctx->footer_lines, 0);
@@ -336,7 +336,7 @@ pveh_welcome() {
" Q: 通常歷史會保留多久?\n"
" A: 看板約3~4週,信箱約2~3週\n\n"
" Q: 檔案被刪了也可以看歷史嗎?\n"
-" A: 屍體還在看板上可以直接對<本文已被刪除>按,不然就先進"
+" A: 屍體還在看板上可以直接對<本文已被刪除>按,不然就先進"
RECYCLE_BIN_NAME "(~)再找\n"
);
doupdate();
@@ -471,7 +471,7 @@ pvrb_search(char key, int curr, int total, pvrb_ctx *cx) {
}
assert(sizeof(search_str) >= FNLEN);
- if (need_input &&
+ if (need_input &&
getdata(b_lines-1, 0, prompt, search_str, FNLEN, DOECHO) < 1)
return PSB_NA;
@@ -680,7 +680,7 @@ pae_footer(void *ctx GCC_UNUSED) {
static int
pae_renderer(int i, int curr, int total GCC_UNUSED, int rows GCC_UNUSED, void *ctx) {
pae_ctx *cx = (pae_ctx*) ctx;
- prints(" %3d %s%s%-36.36s " ANSI_COLOR(1;37) "%-30.30s" ANSI_RESET "\n",
+ prints(" %3d %s%s%-36.36s " ANSI_COLOR(1;37) "%-30.30s" ANSI_RESET "\n",
i+1,
(i == curr) ? ANSI_COLOR(41) : "",
dashf(cx->files[i]) ? ANSI_COLOR(1;36) : ANSI_COLOR(1;30),
@@ -788,7 +788,7 @@ psb_admin_edit() {
paectx.descs[ctx.total] = strdup(v);
ctx.total++;
}
- if (ctx.total >= MAX_PAE_ENTRIES)
+ if (ctx.total >= MAX_PAE_ENTRIES)
vmsg("注意: 您的系統設定已超過或接近預設上限,請洽系統站長加大設定");
psb_main(&ctx);
diff --git a/pttbbs/mbbsd/read.c b/pttbbs/mbbsd/read.c
index 1913378b..c8e6da7b 100644
--- a/pttbbs/mbbsd/read.c
+++ b/pttbbs/mbbsd/read.c
@@ -161,7 +161,7 @@ getkeep(const char *s, int def_topline, int def_cursline)
/* 為省記憶體, 且避免 malloc/free 不成對, getkeep 最好不要 malloc,
* 只記 s 的 hash 值,
* fvn1a-32bit collision 機率約小於十萬分之一 */
- /* 原本使用 link list, 可是一方面會造成 malloc/free 不成對,
+ /* 原本使用 link list, 可是一方面會造成 malloc/free 不成對,
* 一方面 size 小, malloc space overhead 就高, 因此改成 link block,
* 以 KEEPSLOT 為一個 block 的 link list.
* 只有第一個 block 可能沒滿. */
@@ -276,7 +276,7 @@ thread(const keeploc_t * locmem, int stypen)
if(locmem->crs_ln==0)
return locmem->crs_ln;
-
+
STATINC(STAT_THREAD);
if (stypen & RS_AUTHOR)
key = headers[pos - locmem->top_ln].owner;
@@ -289,7 +289,7 @@ thread(const keeploc_t * locmem, int stypen)
new_ln > 0 && new_ln <= last_line && --jump > 0;
new_ln += step ) {
- int rk =
+ int rk =
get_record_keep(currdirect, &fh, sizeof(fileheader_t), new_ln, &fd);
if(fd < 0 || rk < 0)
@@ -304,7 +304,7 @@ thread(const keeploc_t * locmem, int stypen)
break;
else if( !strncmp(&fh.title[4], key, PROPER_TITLE_LEN) ) {
amatch = new_ln;
- jump = THREAD_SEARCH_RANGE;
+ jump = THREAD_SEARCH_RANGE;
/* 當搜尋同主題第一篇, 連續找不到多少篇才停 */
}
}
@@ -417,7 +417,7 @@ out:
return pos;
}
-static int
+static int
select_by_aid(const keeploc_t * locmem, int *pnew_ln, int *pnewdirect_new_ln,
char *pdefault_ch)
{
@@ -600,9 +600,9 @@ select_read(const keeploc_t * locmem, int sr_mode)
if(!getdata(b_lines, 0,
currmode & MODE_SELECT ? "增加條件 作者: ":"搜尋作者: ",
keyword, IDLEN+1, DOECHO) || trim_blank(keyword))
- return READ_REDRAW;
+ return READ_REDRAW;
} else if(sr_mode & RS_KEYWORD) {
- if(!getdata(b_lines, 0,
+ if(!getdata(b_lines, 0,
currmode & MODE_SELECT ? "增加條件 標題: ":"搜尋標題: ",
keyword, TTLEN, DOECHO) || trim_blank(keyword))
return READ_REDRAW;
@@ -613,7 +613,7 @@ select_read(const keeploc_t * locmem, int sr_mode)
if (currmode & MODE_SELECT) {
// TTLEN width exceed default screen
// let's use TTLEN-4 here.
- if (!getdata(b_lines, 0, "增加條件 排除標題: ",
+ if (!getdata(b_lines, 0, "增加條件 排除標題: ",
keyword, TTLEN-4, DOECHO) ||
trim_blank(keyword))
return READ_REDRAW;
@@ -623,7 +623,7 @@ select_read(const keeploc_t * locmem, int sr_mode)
}
} else if (sr_mode & RS_RECOMMEND) {
if(currstat == RMAIL ||
- (!getdata(b_lines, 0, (currmode & MODE_SELECT) ?
+ (!getdata(b_lines, 0, (currmode & MODE_SELECT) ?
"增加條件 推文數: ": "搜尋推文數高於多少"
#ifndef OLDRECOMMEND
" (<0則搜噓文數) "
@@ -646,8 +646,8 @@ select_read(const keeploc_t * locmem, int sr_mode)
return DONOTHING;
if(sr_mode & RS_TITLE) {
- fileheader_t *fh = &headers[locmem->crs_ln - locmem->top_ln];
- strcpy(keyword, subject(fh->title));
+ fileheader_t *fh = &headers[locmem->crs_ln - locmem->top_ln];
+ strcpy(keyword, subject(fh->title));
}
}
@@ -655,7 +655,7 @@ select_read(const keeploc_t * locmem, int sr_mode)
_mode = sr_mode;
else
_mode |= sr_mode;
-
+
snprintf(genbuf, sizeof(genbuf), "%s%X.%X.%X",
first_select ? "SR.":p,
sr_mode, (int)strlen(keyword), DBCS_StringHash(keyword));
@@ -721,7 +721,7 @@ select_read(const keeploc_t * locmem, int sr_mode)
if(inc) {
/* find incremental selection start point */
int idx;
- sprintf(fhs[0].filename, "X.%d", (int)filetime);
+ sprintf(fhs[0].filename, "X.%d", (int)filetime);
idx = getindex(currdirect, &fhs[0], 0);
if(idx<0) {
reference = -idx;
@@ -773,7 +773,7 @@ select_read(const keeploc_t * locmem, int sr_mode)
else if(sr_mode & RS_KEYWORD_EXCLUDE &&
DBCS_strcasestr(fhs[i].title, keyword))
continue;
- else if((sr_mode & RS_TITLE) &&
+ else if((sr_mode & RS_TITLE) &&
strcasecmp(subject(fhs[i].title), keyword))
continue;
else if ((sr_mode & RS_RECOMMEND) &&
@@ -812,18 +812,18 @@ select_read(const keeploc_t * locmem, int sr_mode)
static int newdirect_new_ln = -1;
static int
-i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
+i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
int bid, int bottom_line)
{
int mode = DONOTHING, num, new_top=10;
int ch, new_ln = locmem->crs_ln, lastmode = DONOTHING;
static char default_ch = 0;
-
+
do {
if( (mode = cursor_pos(locmem, new_ln, new_top, default_ch ? 0 : 1))
!= DONOTHING )
return mode;
-
+
if( !default_ch )
ch = vkey();
else{
@@ -834,7 +834,7 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
ch = default_ch;
}
- new_top = 10; // default 10
+ new_top = 10; // default 10
switch (ch) {
case Ctrl('Z'):
mode = FULLUPDATE;
@@ -844,7 +844,7 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
if( (num = search_num(ch, last_line)) != -1 )
- new_ln = num + 1;
+ new_ln = num + 1;
break;
case 'q':
case 'e':
@@ -861,7 +861,7 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
mode = NEWDIRECT;
}
else
- mode =
+ mode =
(currmode & MODE_DIGEST) ? board_digest() : DOQUIT;
break;
@@ -877,11 +877,11 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
case Ctrl('H'):
mode = select_read(locmem, RS_NEWPOST);
break;
-
+
case 'Z':
mode = select_read(locmem, RS_RECOMMEND);
break;
-
+
case 'a':
mode = select_read(locmem, RS_AUTHOR);
break;
@@ -892,7 +892,7 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
case 'G':
// special types
- switch(vans( currmode & MODE_SELECT ?
+ switch(vans( currmode & MODE_SELECT ?
"增加條件 標記(m/s)(未輸入則取消): ":
"搜尋標記(m/s)(未輸入則取消): "))
{
@@ -964,7 +964,7 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
new_ln = last_line;
new_top = p_lines-1;
} else {
- new_ln = locmem->crs_ln - 1;
+ new_ln = locmem->crs_ln - 1;
new_top = p_lines - 2;
}
break;
@@ -972,7 +972,7 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
case 'n':
case 'j':
case KEY_DOWN:
- new_ln = locmem->crs_ln + 1;
+ new_ln = locmem->crs_ln + 1;
new_top = 1;
break;
@@ -980,14 +980,14 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
case KEY_PGDN:
case 'N':
case Ctrl('F'):
- new_ln = locmem->top_ln + p_lines;
+ new_ln = locmem->top_ln + p_lines;
new_top = 0;
break;
case KEY_PGUP:
case Ctrl('B'):
case 'P':
- new_ln = locmem->top_ln - p_lines;
+ new_ln = locmem->top_ln - p_lines;
new_top = 0;
break;
@@ -1107,7 +1107,7 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
break;
if (func != NULL){
num = locmem->crs_ln - bottom_line;
-
+
if(!rcmdlist[ch - 1].needitem)
mode = (*func)();
else if( num > 0 ){
@@ -1117,7 +1117,7 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
direct, locmem->crs_ln - locmem->top_ln);
}
else
- mode = (*func)(locmem->crs_ln,
+ mode = (*func)(locmem->crs_ln,
&headers[locmem->crs_ln - locmem->top_ln],
currdirect, locmem->crs_ln - locmem->top_ln);
if(mode == READ_SKIP)
@@ -1133,8 +1133,8 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
}
// 以下這幾種 mode 要再處理游標
- if(mode == READ_PREV || mode == READ_NEXT ||
- mode == RELATE_PREV || mode == RELATE_FIRST ||
+ if(mode == READ_PREV || mode == READ_NEXT ||
+ mode == RELATE_PREV || mode == RELATE_FIRST ||
mode == AUTHOR_NEXT || mode == AUTHOR_PREV ||
mode == RELATE_NEXT){
lastmode = mode;
@@ -1174,7 +1174,7 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
lastmode = DONOTHING;
}
} //end if (func != NULL)
- } // ch > 0 && ch <= onekey_size
+ } // ch > 0 && ch <= onekey_size
break;
} // end switch
@@ -1207,7 +1207,7 @@ get_records_and_bottom(const char *direct, fileheader_t* headers,
// 不顯示置底的情形
if( n >= headers_size || (currmode & (MODE_SELECT | MODE_DIGEST)) )
{
- rv = get_records(direct, headers, sizeof(fileheader_t),
+ rv = get_records(direct, headers, sizeof(fileheader_t),
recbase, headers_size);
ENDSTAT(STAT_BOARDREC);
return rv > 0 ? rv : 0;
@@ -1293,7 +1293,7 @@ i_read(int cmdmode, const char *direct, void (*dotitle) (),
last_line = getbtotal(currbid);
}
bottom_line = last_line;
- last_line += getbottomtotal(currbid);
+ last_line += getbottomtotal(currbid);
}
else
bottom_line = last_line = get_num_records(currdirect, FHSZ);
@@ -1301,7 +1301,7 @@ i_read(int cmdmode, const char *direct, void (*dotitle) (),
if (mode == NEWDIRECT) {
int num;
num = last_line - p_lines + 1;
- locmem = getkeep(currdirect, num < 1 ? 1 : num,
+ locmem = getkeep(currdirect, num < 1 ? 1 : num,
bottom_line ? bottom_line : last_line);
if(newdirect_new_ln >= 0)
{
@@ -1376,7 +1376,7 @@ i_read(int cmdmode, const char *direct, void (*dotitle) (),
case TITLE_REDRAW:
(*dotitle) ();
break;
-
+
case HEADERS_RELOAD:
if (recbase != locmem->top_ln) {
recbase = locmem->top_ln;
@@ -1392,7 +1392,7 @@ i_read(int cmdmode, const char *direct, void (*dotitle) (),
assert(headers);
}
/* XXX if entries return -1 */
- entries =
+ entries =
get_records_and_bottom(currdirect, headers, recbase,
headers_size, last_line, bottom_line);
}
diff --git a/pttbbs/mbbsd/record.c b/pttbbs/mbbsd/record.c
index ad0b2851..1c96fbbf 100644
--- a/pttbbs/mbbsd/record.c
+++ b/pttbbs/mbbsd/record.c
@@ -18,11 +18,11 @@ get_sum_records(const char *fpath, int size)
FILE *fp;
fileheader_t fhdr;
char buf[PATHLEN], *p;
-
+
// Ptt : should avoid big loop
if ((fp = fopen(fpath, "r"))==NULL)
return -1;
-
+
strlcpy(buf, fpath, sizeof(buf));
p = strrchr(buf, '/');
assert(p);
@@ -37,7 +37,7 @@ get_sum_records(const char *fpath, int size)
return ans / 1024;
}
-/* return index>0 if thisstamp==stamp[index],
+/* return index>0 if thisstamp==stamp[index],
* return -index<0 if stamp[index-1]<thisstamp<stamp[index+1], XXX thisstamp ?<>? stamp[index]
* or XXX filename[index]=""
* return 0 if error
@@ -64,11 +64,11 @@ getindex_m(const char *direct, fileheader_t *fhdr, int end, int isloadmoney)
else if( s == stamp ){
close(fd);
if(isloadmoney)
- fhdr->multi.money = fh.multi.money;
+ fhdr->multi.money = fh.multi.money;
return i;
}
else
- begin = i + 1;
+ begin = i + 1;
}
if( times < 20) // Not forever loop. It any because of deletion.
@@ -215,7 +215,7 @@ delete_range(const char *fpath, int id1, int id2)
/* rocker.011018: add new tag delete */
if (
(fhdr.filemode & FILE_MARKED) || /* 標記 */
- ((fhdr.filemode & FILE_DIGEST) && (currstat != RMAIL) )||
+ ((fhdr.filemode & FILE_DIGEST) && (currstat != RMAIL) )||
/* 文摘 , FILE_DIGEST is used as REPLIED in mail menu.*/
(id1 && (count < id1 || count > id2)) || /* range */
(!id1 && !FindTaggedItem(&fhdr))) { /* TagList */
@@ -226,7 +226,7 @@ delete_range(const char *fpath, int id1, int id2)
flock(fd, LOCK_UN);
close(fd);
return -1;
- }
+ }
} else {
unlink(fullpath);
dcount++;
@@ -246,7 +246,7 @@ delete_range(const char *fpath, int id1, int id2)
return dcount;
}
-void
+void
set_safedel_fhdr(fileheader_t *fhdr, const char *newtitle)
{
if (newtitle && *newtitle)
@@ -268,7 +268,7 @@ set_safedel_fhdr(fileheader_t *fhdr, const char *newtitle)
// i'm the one to delete it
snprintf(fhdr->title, sizeof(fhdr->title),
"%s [%s]", STR_SAFEDEL_TITLE, fhdr->owner);
- }
+ }
else // deleted by BM, system, SYSOP, or other services...
// maybe not revealing the names would be better.
{
@@ -474,7 +474,7 @@ stampadir(char *fpath, fileheader_t * fh, int large_set)
if (!large_set)
return -1;
mask = mask_large;
- }
+ }
if (retries > mask_large)
return -1;
@@ -537,7 +537,7 @@ append_record_forward(char *fpath, fileheader_t * record, int size, const char *
unlink(buf);
// TODO add a mail so that origid knows what happened.
LOG_IF(LOG_CONF_INTERNETMAIL,
- log_filef("log/internet_mail.log", LOG_CREAT,
+ log_filef("log/internet_mail.log", LOG_CREAT,
"%s [%s] (%s -> %s) mailbox overflow (%d > %d)\n",
Cdatelite(&now), __FUNCTION__,
origid, address,
@@ -554,7 +554,7 @@ append_record_forward(char *fpath, fileheader_t * record, int size, const char *
// delete the setting if we don't have timebombs.
unlink(buf);
LOG_IF(LOG_CONF_INTERNETMAIL,
- log_filef("log/internet_mail.log", LOG_CREAT,
+ log_filef("log/internet_mail.log", LOG_CREAT,
"%s [%s] Removed bad address: %s (%s)\n",
Cdatelite(&now), __FUNCTION__,
address, origid));
@@ -564,7 +564,7 @@ append_record_forward(char *fpath, fileheader_t * record, int size, const char *
setdirpath(buf, fpath, record->filename);
// because too many user set wrong forward address,
- // let's put their own address instead.
+ // let's put their own address instead.
// and again because some really stupid user
// does not understand they've set auto-forward,
// let's mark this in the title.
@@ -572,7 +572,7 @@ append_record_forward(char *fpath, fileheader_t * record, int size, const char *
"[自動轉寄] %s", record->title);
bsmtp(buf, fwd_title, address, origid);
LOG_IF(LOG_CONF_INTERNETMAIL,
- log_filef("log/internet_mail.log", LOG_CREAT,
+ log_filef("log/internet_mail.log", LOG_CREAT,
"%s [%s] %s -> (%s) %s: %s\n",
Cdatelite(&now), __FUNCTION__,
cuser.userid, origid, address, fwd_title));
@@ -580,63 +580,63 @@ append_record_forward(char *fpath, fileheader_t * record, int size, const char *
return 0;
}
-// return 1 if rotated, otherwise 0
-int
-rotate_bin_logfile(const char *filename, off_t record_size,
- off_t max_size, float keep_ratio)
-{
- off_t sz = dashs(filename);
- assert(keep_ratio >= 0 && keep_ratio <= 1.0f);
-
- if (sz < max_size)
- return 0;
-
- // delete from head
- delete_records(filename, record_size, 1,
- (1 - keep_ratio) * max_size / record_size );
- return 1;
-}
-
-// return 1 if rotated, otherwise 0
-int
-rotate_text_logfile(const char *filename, off_t max_size, float keep_ratio)
-{
- off_t sz = dashs(filename), newsz;
- char *buf, *newent;
- FILE *fp;
- assert(keep_ratio >= 0 && keep_ratio <= 1.0f);
-
- if (sz < max_size)
- return 0;
-
- // FIXME we sould lock the file here.
- // however since these log are just for reference...
- // let's pretend there's no race condition with it.
-
- // now, calculate a starting seek point
- fp = fopen(filename, "r+b");
- fseek(fp, - keep_ratio * max_size, SEEK_END);
- newsz = sz - ftell(fp);
- buf = (char*)malloc(newsz);
- memset(buf, 0, newsz);
- assert(buf);
- fread(buf, newsz, 1, fp);
- fclose(fp);
-
- // find a newline or \0
- newent = buf;
- while (*newent && *newent++ != '\n') ;
-
- // replace file with new content
- fp = fopen(filename, "wb");
- fwrite(newent, 1, newsz - (newent - buf), fp);
- fclose(fp);
-
- free(buf);
- return 1;
-}
-
-void
+// return 1 if rotated, otherwise 0
+int
+rotate_bin_logfile(const char *filename, off_t record_size,
+ off_t max_size, float keep_ratio)
+{
+ off_t sz = dashs(filename);
+ assert(keep_ratio >= 0 && keep_ratio <= 1.0f);
+
+ if (sz < max_size)
+ return 0;
+
+ // delete from head
+ delete_records(filename, record_size, 1,
+ (1 - keep_ratio) * max_size / record_size );
+ return 1;
+}
+
+// return 1 if rotated, otherwise 0
+int
+rotate_text_logfile(const char *filename, off_t max_size, float keep_ratio)
+{
+ off_t sz = dashs(filename), newsz;
+ char *buf, *newent;
+ FILE *fp;
+ assert(keep_ratio >= 0 && keep_ratio <= 1.0f);
+
+ if (sz < max_size)
+ return 0;
+
+ // FIXME we sould lock the file here.
+ // however since these log are just for reference...
+ // let's pretend there's no race condition with it.
+
+ // now, calculate a starting seek point
+ fp = fopen(filename, "r+b");
+ fseek(fp, - keep_ratio * max_size, SEEK_END);
+ newsz = sz - ftell(fp);
+ buf = (char*)malloc(newsz);
+ memset(buf, 0, newsz);
+ assert(buf);
+ fread(buf, newsz, 1, fp);
+ fclose(fp);
+
+ // find a newline or \0
+ newent = buf;
+ while (*newent && *newent++ != '\n') ;
+
+ // replace file with new content
+ fp = fopen(filename, "wb");
+ fwrite(newent, 1, newsz - (newent - buf), fp);
+ fclose(fp);
+
+ free(buf);
+ return 1;
+}
+
+void
setaidfile(char *buf, const char *bn, aidu_t aidu)
{
// try to load by AID
diff --git a/pttbbs/mbbsd/register.c b/pttbbs/mbbsd/register.c
index 03ae6e9c..a6ce43ec 100644
--- a/pttbbs/mbbsd/register.c
+++ b/pttbbs/mbbsd/register.c
@@ -27,13 +27,13 @@
////////////////////////////////////////////////////////////////////////////
// Value Validation
////////////////////////////////////////////////////////////////////////////
-static int
+static int
HaveRejectStr(const char *s, const char **rej)
{
int i;
char *rejectstr[] =
{"幹", "不", "你媽", "某", "笨", "呆", "..", "xx",
- "你管", "管我", "猜", "天才", "超人",
+ "你管", "管我", "猜", "天才", "超人",
/* "阿", (某些住址有) */
"ㄅ", "ㄆ", "ㄇ", "ㄈ", "ㄉ", "ㄊ", "ㄋ", "ㄌ", "ㄍ", "ㄎ", "ㄏ",
"ㄐ", "ㄑ", "ㄒ", "ㄓ", "ㄔ", "ㄕ", "ㄖ", "ㄗ", "ㄘ", "ㄙ",
@@ -109,7 +109,7 @@ isvalidname(char *rname)
#else
const char *rejectstr[] =
{"肥", "胖", "豬頭", "小白", "小明", "路人", "老王", "老李", "寶貝",
- "先生", "帥哥", "老頭", "小姊", "小姐", "美女", "小妹", "大頭",
+ "先生", "帥哥", "老頭", "小姊", "小姐", "美女", "小妹", "大頭",
"公主", "同學", "寶寶", "公子", "大頭", "小小", "小弟", "小妹",
"妹妹", "嘿", "嗯", "爺爺", "大哥", "無",
NULL};
@@ -144,10 +144,10 @@ isvalidcareer(char *career)
if( strlen(career) < 6 )
return "您的輸入不正確";
#endif
- if (DBCS_strcasestr(career, "學") &&
+ if (DBCS_strcasestr(career, "學") &&
DBCS_strcasestr(career, "系") &&
- DBCS_strcasestr(career, "級") == 0 &&
- (DBCS_strcasestr(career, "畢") == 0 &&
+ DBCS_strcasestr(career, "級") == 0 &&
+ (DBCS_strcasestr(career, "畢") == 0 &&
DBCS_strcasestr(career, "肄") == 0))
return "請加上年級";
return NULL;
@@ -173,12 +173,12 @@ isvalidaddr(char *addr)
#endif // DBG_DISABLE_CHECK
// addr[0] > 0: check if address is starting by Chinese.
- if (DBCS_strcasestr(addr, "信箱") != 0 || DBCS_strcasestr(addr, "郵政") != 0)
+ if (DBCS_strcasestr(addr, "信箱") != 0 || DBCS_strcasestr(addr, "郵政") != 0)
return "抱歉我們不接受郵政信箱";
if (strlen_without_space(addr) < 15 ||
- (DBCS_strcasestr(addr, "市") == 0 &&
+ (DBCS_strcasestr(addr, "市") == 0 &&
DBCS_strcasestr(addr, "巿") == 0 &&
- DBCS_strcasestr(addr, "縣") == 0 &&
+ DBCS_strcasestr(addr, "縣") == 0 &&
DBCS_strcasestr(addr, "室") == 0) ||
strcmp(&addr[strlen(addr) - 2], "段") == 0 ||
strcmp(&addr[strlen(addr) - 2], "路") == 0 ||
@@ -205,8 +205,8 @@ isvalidphone(char *phone)
for( i = 0 ; phone[i] != 0 ; ++i )
if( !isdigit((int)phone[i]) )
return "請不要加分隔符號";
- if (!removespace(phone) ||
- strlen(phone) < 9 ||
+ if (!removespace(phone) ||
+ strlen(phone) < 9 ||
strstr(phone, "00000000") != NULL ||
strstr(phone, "22222222") != NULL ) {
return "這個電話號碼並不正確(請含區碼)" ;
@@ -243,7 +243,7 @@ compute_user_value(const userec_t * urec, time4_t clock)
return 30 - value;
#endif
- return ((urec->userlevel & (PERM_LOGINOK|PERM_VIOLATELAW)) ?
+ return ((urec->userlevel & (PERM_LOGINOK|PERM_VIOLATELAW)) ?
KEEP_DAYS_REGGED : KEEP_DAYS_UNREGGED) * 24 * 60 - value;
}
@@ -339,15 +339,15 @@ delregcodefile(void)
// Justify Utilities
////////////////////////////////////////////////////////////////////////////
-static void
+static void
email_justify(const userec_t *muser)
{
char buf[256], genbuf[256];
- /*
+ /*
* It is intended to use BBSENAME instead of BBSNAME here.
* Because recently many poor users with poor mail clients
- * (or evil mail servers) cannot handle/decode Chinese
- * subjects (BBSNAME) correctly, so we'd like to use
+ * (or evil mail servers) cannot handle/decode Chinese
+ * subjects (BBSNAME) correctly, so we'd like to use
* BBSENAME here to prevent subject being messed up.
* And please keep BBSENAME short or it may be truncated
* by evil mail servers.
@@ -381,8 +381,8 @@ getfield(int line, const char *info, const char *notes_fn, const char *desc, cha
show_file(notes_fn, line+3, t_lines - (line+3), SHOWFILE_ALLOW_ALL);
}
move(line, 0); prints(" 原先設定:%-30.30s (%s)", buf, info);
- snprintf(prompt, sizeof(prompt),
- ANSI_COLOR(1) ">>%s" ANSI_RESET ":",
+ snprintf(prompt, sizeof(prompt),
+ ANSI_COLOR(1) ">>%s" ANSI_RESET ":",
desc);
if (getdata_str(line + 1, 0, prompt, genbuf, len, DOECHO, buf))
strcpy(buf, genbuf);
@@ -484,10 +484,10 @@ query_adbanner_usong_pref_changed(const userec_t *u, char force_yn)
outs(
"\n\n\t在使用 BBS 的過程中,您可能會在畫面上方此區看到一些動態的訊息告示,"
"\n\n\t其內容開放給各使用者與公益團體申請,所以會包含非商業的活動資訊/網宣,"
- "\n\n\t還有來自各使用者的心情點播 (可能包含該使用者的政治性言論或各種留言)。"
+ "\n\n\t還有來自各使用者的心情點播 (可能包含該使用者的政治性言論或各種留言)。"
"\n\n\n\n"
- "\n\n\t" ANSI_COLOR(1)
- "此類由使用者自行發表的文字與圖像並不代表站方立場。" ANSI_RESET
+ "\n\n\t" ANSI_COLOR(1)
+ "此類由使用者自行發表的文字與圖像並不代表站方立場。" ANSI_RESET
"\n\n\t由於心情點播部份較難定義出完整的審核標準,為了避免造成閱\讀者的不快或"
"\n\n\t誤會,在此要確認您是否希望顯示心情點播內容。"
"\n\n\t(若之後想改變此類設定,可至 (U)個人設定區->(U)個人化設定 調整)\n");
@@ -496,7 +496,7 @@ query_adbanner_usong_pref_changed(const userec_t *u, char force_yn)
do {
// alert if not first rounod
if (ans != 1) { move(b_lines-2, 0); outs("請確實輸入 y 或 n。"); bell(); }
- ans = vansf("請問您希望在動態告示區看到來自其它使用者的心情點播嗎? %s: ",
+ ans = vansf("請問您希望在動態告示區看到來自其它使用者的心情點播嗎? %s: ",
force_yn ? "[y/n]" : defyes ? "[Y/n]" : "[y/N]");
// adjust answers
@@ -582,22 +582,22 @@ new_register(void)
outs("無法接受這個代號,請使用英文字母,並且不要包含空格\n");
else if ((id = getuser(passbuf, &xuser)) &&
// >=: see check_and_expire_account definition
- (minute = check_and_expire_account(id, &xuser, 0)) >= 0)
+ (minute = check_and_expire_account(id, &xuser, 0)) >= 0)
{
// XXX Magic number >= MAX_USERS: never expires.
// Probably because of sysadmin perms, or due to violation.
if (minute == 999999)
outs("此代號已經有人使用,請使用別的代號\n");
else {
- prints("此代號已經有人使用 還有 %d 天才過期\n",
+ prints("此代號已經有人使用 還有 %d 天才過期\n",
minute / (60 * 24) + 1);
}
- }
+ }
else if (reserved_user_id(passbuf))
outs("此代號已由系統保留,請使用別的代號\n");
#if !defined(NO_CHECK_AMBIGUOUS_USERID) && defined(USE_REGCHECKD)
// XXX if we check id == 0 here, replacing an expired id will be delayed.
- else if (/*id == 0 && */
+ else if (/*id == 0 && */
regcheck_ambiguous_userid_exist(passbuf) > 0) // ignore if error occurs
outs("此代號過於近似它人帳號,請改用別的代號。\n");
#endif
@@ -618,7 +618,7 @@ new_register(void)
exit(1);
}
move(20, 0); clrtoeol();
- outs(ANSI_COLOR(1;33)
+ outs(ANSI_COLOR(1;33)
"為避免被偷看,您的密碼會顯示為 * ,直接輸入完後按 Enter 鍵即可。\n"
"另外請注意密碼只有前八個字元有效,超過的將自動忽略。"
ANSI_RESET);
@@ -668,7 +668,7 @@ new_register(void)
if ((errmsg = isvalidname(newuser.realname)))
{
memset(newuser.realname, 0, sizeof(newuser.realname));
- vmsg(errmsg);
+ vmsg(errmsg);
}
}
@@ -760,7 +760,7 @@ check_regmail(char *email)
if (c == NULL) return 0;
// reject multiple '@'
- if (c != strrchr(email, '@'))
+ if (c != strrchr(email, '@'))
{
vmsg("E-Mail 的格式不正確。");
return 0;
@@ -801,7 +801,7 @@ check_regmail(char *email)
if (allow) break;
}
fclose(fp);
- if (!allow)
+ if (!allow)
{
// show whitemail notice if it exists.
if (dashf(FN_NOTIN_WHITELIST_NOTICE))
@@ -882,10 +882,10 @@ check_register(void)
if (!HasUserPerm(PERM_BASIC))
return;
- /*
+ /*
* 避免使用者被退回註冊單後,在知道退回的原因之前,
* 又送出一次註冊單。
- */
+ */
setuserfile(fn, FN_REJECT_NOTIFY);
if (dashf(fn))
{
@@ -912,7 +912,7 @@ check_register(void)
// show message.
more(fn, YEA);
move(b_lines-4, 0); clrtobot();
- outs("\n" ANSI_COLOR(1;31)
+ outs("\n" ANSI_COLOR(1;31)
"前次註冊單審查失敗。 (本記錄已備份於您的信箱中)\n"
"請重新申請並照上面指示正確填寫註冊單。\n");
@@ -926,7 +926,7 @@ check_register(void)
while (!abort)
{
switch(vans(u.userid[0] ?
- "請輸入 y 繼續或輸入 r 回信給站務: " :
+ "請輸入 y 繼續或輸入 r 回信給站務: " :
"請輸入 y 繼續: "))
{
case 'y':
@@ -955,7 +955,7 @@ check_register(void)
}
unlink(fn);
- }
+ }
// 只有以下情形需要自動叫出註冊選單:
// 1. 首次註冊 (numlogindays < 2)
@@ -970,7 +970,7 @@ check_register(void)
clear();
vs_hdr2(" 未完成註冊認證 ", " 您的帳號尚未完成認證");
move(9, 0);
- outs(" 您目前尚未通過註冊認證程序,請細詳填寫"
+ outs(" 您目前尚未通過註冊認證程序,請細詳填寫"
ANSI_COLOR(32) "註冊申請單" ANSI_RESET ",\n"
" 通告站長以獲得進階使用權力。\n\n");
outs(" 如果您之前曾使用 email 等認證方式通過註冊認證但又看到此訊息,\n"
@@ -1050,7 +1050,7 @@ toregister(char *email)
move(18, 0); clrtobot();
outs("正在確認 email, 請稍候...\n");
doupdate();
-
+
email_count = emaildb_check_email(email, strlen(email));
if (email_count < 0) {
@@ -1059,7 +1059,7 @@ toregister(char *email)
outs("email 認證系統發生問題, 請稍後再試,或輸入 x 採手動認證。\n");
pressanykey();
return;
- } else if (email_count >= EMAILDB_LIMIT) {
+ } else if (email_count >= EMAILDB_LIMIT) {
move(15, 0); clrtobot();
move(17, 0);
outs("指定的 E-Mail 已註冊過多帳號, 請使用其他 E-Mail, 或輸入 x 採手動認證\n");
@@ -1068,7 +1068,7 @@ toregister(char *email)
} else {
#endif
move(17, 0);
- outs(ANSI_COLOR(1;31)
+ outs(ANSI_COLOR(1;31)
"\n提醒您: 如果之後發現您輸入的註冊資料有問題,不僅註冊會被取消,\n"
"原本認證用的 E-mail 也不能再用來認證。\n" ANSI_RESET);
getdata(16, 0, "請再次確認您輸入的 E-Mail 位置正確嗎? [y/N]",
@@ -1138,7 +1138,7 @@ u_register(void)
" 代表您的認證由於資料不完整已被取消 (由於建立新看板的流程中\n"
" 有驗證板主註冊資料的程序,若您最近有申請開新看板中則屬此項)\n\n"
" * 如果您已收到註冊碼卻看到這個畫面,代表您在使用 Email 註冊後\n"
- " " ANSI_COLOR(1;31) "又另外申請了站長直接人工審核的註冊申請單。"
+ " " ANSI_COLOR(1;31) "又另外申請了站長直接人工審核的註冊申請單。"
ANSI_RESET "\n"
" 進入人工審核程序後 Email 註冊碼自動失效,要等到審核完成\n"
" (會多花很多時間,數天到數週是正常的) ,所以請耐心等候。\n\n");
@@ -1166,14 +1166,14 @@ u_register(void)
if (cuser.email[0] && /* 已經第一次填過了~ ^^" */
strcmp(cuser.email, "x") != 0 && /* 上次手動認證失敗 */
- strcmp(cuser.email, "X") != 0)
+ strcmp(cuser.email, "X") != 0)
{
vs_hdr("EMail認證");
move(2, 0);
prints("請輸入您的認證碼。(由 %s 開頭無空白的十三碼)\n"
"若尚未收到信件或不想現在輸入可直接按 ENTER 離開,\n"
- "或輸入 x 來重新填寫 E-Mail 或改由站長手動認證\n",
+ "或輸入 x 來重新填寫 E-Mail 或改由站長手動認證\n",
REGCODE_INITIAL);
inregcode[0] = 0;
@@ -1243,7 +1243,7 @@ u_register(void)
regcode));
return FULLUPDATE;
}
- else
+ else
{
vmsg("認證碼已過期,請重新註冊。");
toregister(email);
@@ -1315,7 +1315,7 @@ u_register(void)
move(2, 0); prints(" 是否現在住在台灣: %s\n", isForeign ? "N (否)" : "Y (是)");
#endif
while (1) {
- getfield(4,
+ getfield(4,
#ifdef FOREIGN_REG
"請用本名",
#else
@@ -1353,7 +1353,7 @@ u_register(void)
}
while (1) {
- getfield(7, "不加-(), 包括長途區號",
+ getfield(7, "不加-(), 包括長途區號",
REGNOTES_ROOT "phone", "連絡電話", phone, 11);
if( (errcode = isvalidphone(phone)) == NULL )
break;
@@ -1499,7 +1499,7 @@ static const char *reasonstr[REJECT_REASONS] = {
#define REASON_EXPANDABBREV(x) reasonstr[(x) - REASON_FIRSTABBREV]
void
-regform_log2board(const RegformEntry *pre, char accepted,
+regform_log2board(const RegformEntry *pre, char accepted,
const char *reason, int priority)
{
#ifdef BN_ID_RECORD
@@ -1509,9 +1509,9 @@ regform_log2board(const RegformEntry *pre, char accepted,
// The message may contain ANSI escape sequences (regform_concat_reasons)
char msg[ANSILINELEN * REJECT_REASONS + REGFORM_LOCALIZED_ENTRIES_BUFSIZE];
- snprintf(title, sizeof(title),
- "[審核] %s: %s (%s: %s)",
- accepted ? "○通過":"╳退回", pre->u.userid,
+ snprintf(title, sizeof(title),
+ "[審核] %s: %s (%s: %s)",
+ accepted ? "○通過":"╳退回", pre->u.userid,
priority ? "指定審核" : "審核者",
cuser.userid);
@@ -1534,17 +1534,17 @@ regform_log2board(const RegformEntry *pre, char accepted,
}
void
-regform_log2file(const RegformEntry *pre, char accepted,
+regform_log2file(const RegformEntry *pre, char accepted,
const char *reason, int priority)
{
#ifdef FN_ID_RECORD
// The message may contain ANSI escape sequences (regform_concat_reasons)
char msg[ANSILINELEN * REJECT_REASONS + REGFORM_LOCALIZED_ENTRIES_BUFSIZE];
- snprintf(msg, sizeof(msg),
- "%s\n%s: %s (%s: %s)\n",
+ snprintf(msg, sizeof(msg),
+ "%s\n%s: %s (%s: %s)\n",
Cdate(&now),
- accepted ? "○通過":"╳退回", pre->u.userid,
+ accepted ? "○通過":"╳退回", pre->u.userid,
priority ? "指定審核" : "審核者",
cuser.userid);
@@ -1558,7 +1558,7 @@ regform_log2file(const RegformEntry *pre, char accepted,
#endif // FN_ID_RECORD
}
-void
+void
regform_accept(const char *userid, const char *justify)
{
char buf[PATHLEN];
@@ -1572,7 +1572,7 @@ regform_accept(const char *userid, const char *justify)
muser.userlevel |= (PERM_LOGINOK | PERM_POST);
strlcpy(muser.justify, justify, sizeof(muser.justify));
// manual accept sets email to 'x'
- strlcpy(muser.email, "x", sizeof(muser.email));
+ strlcpy(muser.email, "x", sizeof(muser.email));
// handle files
sethomefile(buf, muser.userid, FN_REJECT_NOTIFY);
@@ -1600,7 +1600,7 @@ regform_accept(const char *userid, const char *justify)
"[系統通知]", 1, 0);
}
-void
+void
regform_reject(const char *userid, const char *reason, const RegformEntry *pre)
{
char buf[PATHLEN];
@@ -1643,7 +1643,7 @@ regform_reject(const char *userid, const char *reason, const RegformEntry *pre)
// prompt user for how to contact if they have problem
// (deprecated because we allow direct reply now)
// fprintf(fp, ANSI_COLOR(1;31) "如有任何問題或需要與站務人員聯絡請至"
- // BN_ID_PROBLEM "看板。" ANSI_RESET "\n");
+ // BN_ID_PROBLEM "看板。" ANSI_RESET "\n");
// multiple abbrev loop
regform_print_reasons(reason, fp);
@@ -1660,7 +1660,7 @@ regform_reject(const char *userid, const char *reason, const RegformEntry *pre)
// XXX how to handle the notification file better?
// mail_log2id: do not use move.
// mail_muser(muser, "[註冊失敗]", buf);
-
+
// use regform2! no need to set 'newmail'.
mail_log2id(muser.userid, "[註冊失敗記錄]", buf, "[註冊系統]", 0, 0);
}
@@ -1682,14 +1682,14 @@ regform_concat_reasons(const char *reason, char *result, int maxlen)
{
int i = 0;
for (i = 0; reason[i] && REASON_IN_ABBREV(reason[i]); i++) {
- snprintf(result + len, maxlen - len,
+ snprintf(result + len, maxlen - len,
ANSI_COLOR(1;33)
- "[退回原因] %s" ANSI_RESET "\n",
+ "[退回原因] %s" ANSI_RESET "\n",
REASON_EXPANDABBREV(reason[i]));
len = strlen(result);
}
} else {
- snprintf(result + len, maxlen - len,
+ snprintf(result + len, maxlen - len,
ANSI_COLOR(1;33) "[退回原因] %s" ANSI_RESET "\n", reason);
}
}
@@ -1708,7 +1708,7 @@ static void
resolve_reason(char *s, int y, int force)
{
// should start with REASON_FIRSTABBREV
- const char *reason_prompt =
+ const char *reason_prompt =
" (0)真實姓名 (1)詳填系級 (2)完整住址"
" (3)詳填電話 (4)確實填寫 (5)中文填寫";
@@ -1738,7 +1738,7 @@ resolve_reason(char *s, int y, int force)
strip_blank(s, s);
strlcat(s, " [多重原因]", REASON_LEN);
}
- }
+ }
if (!force && !*s)
return;
@@ -1767,7 +1767,7 @@ regq_append(const char *userid)
return 1;
}
-int
+int
regq_find(const char *userid)
{
return file_find_record(FN_REQLIST, userid);
@@ -1780,7 +1780,7 @@ regq_delete(const char *userid)
}
// user home regform operation
-int
+int
regfrm_exist(const char *userid)
{
char fn[PATHLEN];
@@ -1847,7 +1847,7 @@ regfrm_load(const char *userid, RegformEntry *pre)
return 1;
}
-int
+int
regfrm_save(const char *userid, const RegformEntry *pre)
{
FILE *fp = NULL;
@@ -1863,7 +1863,7 @@ regfrm_save(const char *userid, const RegformEntry *pre)
return ret;
}
-int
+int
regfrm_trylock(const char *userid)
{
int fd = 0;
@@ -1878,7 +1878,7 @@ regfrm_trylock(const char *userid)
return 0;
}
-int
+int
regfrm_unlock(int lockfd)
{
int fd = lockfd;
@@ -1916,7 +1916,7 @@ regfrm_accept(RegformEntry *pre, int priority)
append_regform(pre, fnlog, "");
// log to global history
- snprintf(buf, sizeof(buf), "Approved: %s -> %s\n",
+ snprintf(buf, sizeof(buf), "Approved: %s -> %s\n",
cuser.userid, pre->u.userid);
append_regform(pre, FN_REGISTER_LOG, buf);
@@ -1948,7 +1948,7 @@ regfrm_reject(RegformEntry *pre, const char *reason, int priority)
regform_reject(pre->u.userid, reason, pre);
// log to global history
- snprintf(buf, sizeof(buf), "Rejected: %s -> %s [%s]\n",
+ snprintf(buf, sizeof(buf), "Rejected: %s -> %s [%s]\n",
cuser.userid, pre->u.userid, reason);
append_regform(pre, FN_REGISTER_LOG, buf);
@@ -1977,7 +1977,7 @@ regq_init_pull()
return fp;
}
-int
+int
regq_pull(FILE *fp, char *uid)
{
char buf[STRLEN];
@@ -2004,7 +2004,7 @@ regq_end_pull(FILE *fp)
// UI part
int
ui_display_regform_single(
- const RegformEntry *pre,
+ const RegformEntry *pre,
int tid, char *reason)
{
int c;
@@ -2015,15 +2015,15 @@ ui_display_regform_single(
move(1, 0);
user_display(xuser, 1);
move(14, 0);
- prints(ANSI_COLOR(1;32)
- "--------------- 這是第 %2d 份註冊單 -----------------------"
+ prints(ANSI_COLOR(1;32)
+ "--------------- 這是第 %2d 份註冊單 -----------------------"
ANSI_RESET "\n", tid);
prints(" %-12s: %s %s\n", "帳號", pre->u.userid,
- (xuser->userlevel & PERM_NOREGCODE) ?
- ANSI_COLOR(1;31) " [T:禁止使用認證碼註冊]" ANSI_RESET:
+ (xuser->userlevel & PERM_NOREGCODE) ?
+ ANSI_COLOR(1;31) " [T:禁止使用認證碼註冊]" ANSI_RESET:
"");
prints("0.%-12s: %s%s\n", "真實姓名", pre->u.realname,
- xuser->uflag & UF_FOREIGN ? " (外籍)" :
+ xuser->uflag & UF_FOREIGN ? " (外籍)" :
"");
prints("1.%-12s: %s\n", "服務單位", pre->u.career);
prints("2.%-12s: %s\n", "目前住址", pre->u.address);
@@ -2042,7 +2042,7 @@ ui_display_regform_single(
{
int n = 0;
move(3, 0);
- outs("\n" ANSI_COLOR(1;31)
+ outs("\n" ANSI_COLOR(1;31)
"請提出退回申請表原因,按 <Enter> 取消:\n" ANSI_RESET);
for (n = 0; n < REJECT_REASONS; n++)
prints("%d) %s\n", n, reasonstr[n]);
@@ -2054,7 +2054,7 @@ ui_display_regform_single(
continue;
// interprete reason
return 'n';
- }
+ }
else if (REASON_IN_ABBREV(c))
{
// quick set
@@ -2132,7 +2132,7 @@ regform2_validate_single(const char *xuid)
assert(0);
break;
}
-
+
// final processing
regfrm_unlock(lfd);
@@ -2220,23 +2220,23 @@ regform2_validate_page(int dryrun)
// display regform
move(i*2, 0);
- prints(" %2d%s %s%-12s " ANSI_RESET,
- i+1,
- ( (forms[i].u.userlevel & PERM_LOGINOK) ?
- ANSI_COLOR(1;33) "Y" :
+ prints(" %2d%s %s%-12s " ANSI_RESET,
+ i+1,
+ ( (forms[i].u.userlevel & PERM_LOGINOK) ?
+ ANSI_COLOR(1;33) "Y" :
#ifdef REGFORM_DISABLE_ONLINE_USER
- forms[i].online ? "s" :
+ forms[i].online ? "s" :
#endif
"."),
forms[i].online ? ANSI_COLOR(1;35) : ANSI_COLOR(1),
forms[i].u.userid);
- prints( ANSI_COLOR(1;31) "%19s "
- ANSI_COLOR(1;32) "%-40s" ANSI_RESET"\n",
+ prints( ANSI_COLOR(1;31) "%19s "
+ ANSI_COLOR(1;32) "%-40s" ANSI_RESET"\n",
forms[i].u.realname, forms[i].u.career);
- move(i*2+1, 0);
- prints(" %s ", (forms[i].u.userlevel & PERM_NOREGCODE) ?
+ move(i*2+1, 0);
+ prints(" %s ", (forms[i].u.userlevel & PERM_NOREGCODE) ?
ANSI_COLOR(1;31) "T" ANSI_RESET : " ");
// try to print lasthost if possible
int delta = 70 - 2 - strlen(forms[i].u.address) -
@@ -2326,7 +2326,7 @@ regform2_validate_page(int dryrun)
break;
// have more blanks
- ch = vansf("尚未指定的 %d 個項目要: (S跳過/y通過/n拒絕/e繼續編輯): ",
+ ch = vansf("尚未指定的 %d 個項目要: (S跳過/y通過/n拒絕/e繼續編輯): ",
blanks);
}
@@ -2411,7 +2411,7 @@ regform2_validate_page(int dryrun)
break;
move(yMsg, 0);
- prints("退回 %s 註冊單原因:\n %s\n",
+ prints("退回 %s 註冊單原因:\n %s\n",
forms[ci].u.userid, rejects[ci]);
// do reject
@@ -2439,7 +2439,7 @@ regform2_validate_page(int dryrun)
assert(ch == ' ' || ch == 'q');
// save/commit if required.
- if (dryrun)
+ if (dryrun)
{
// prmopt for debug
clear();
@@ -2455,13 +2455,13 @@ regform2_validate_page(int dryrun)
"%s %s", cuser.userid, Cdate(&now));
prints("%2d. %-12s - %c %s\n", i+1, forms[i].u.userid, ans[i],
- ans[i] == 'n' ? rejects[i] :
+ ans[i] == 'n' ? rejects[i] :
ans[i] == 'y' ? justify : "");
}
if (ch != 'q')
pressanykey();
- }
- else
+ }
+ else
{
// real functionality
for (i = 0; i < cforms; i++)
@@ -2510,7 +2510,7 @@ regform2_validate_page(int dryrun)
}
/////////////////////////////////////////////////////////////////////////////
-// Regform UI
+// Regform UI
// 處理 Register Form
/////////////////////////////////////////////////////////////////////////////
@@ -2547,8 +2547,8 @@ m_register(void)
fclose(fn);
- getdata(b_lines - 1, 0,
- "開始審核嗎 (Y:單筆模式/N:不審/E:整頁模式/U:指定ID)?[N] ",
+ getdata(b_lines - 1, 0,
+ "開始審核嗎 (Y:單筆模式/N:不審/E:整頁模式/U:指定ID)?[N] ",
ans, sizeof(ans), LCECHO);
if (ans[0] == 'y')
diff --git a/pttbbs/mbbsd/screen.c b/pttbbs/mbbsd/screen.c
index bf1d5d73..65ae53a8 100644
--- a/pttbbs/mbbsd/screen.c
+++ b/pttbbs/mbbsd/screen.c
@@ -79,7 +79,7 @@ initscr(void)
}
}
-int
+int
resizeterm(int w, int h)
{
screenline_t *new_picture;
@@ -89,7 +89,7 @@ resizeterm(int w, int h)
w = MAX(80, MIN(200, w));
if (h > t_lines && big_picture) {
- new_picture = (screenline_t *)
+ new_picture = (screenline_t *)
calloc(h, sizeof(screenline_t));
if (new_picture == NULL) {
syslog(LOG_ERR, "calloc(): %m");
@@ -277,7 +277,7 @@ redrawwin(void)
oflush();
}
-int
+int
typeahead(int fd)
{
switch(fd)
@@ -335,7 +335,7 @@ doupdate(void)
bp = &big_picture[j];
len = bp->len;
- if (bp->mode & MODIFIED && bp->smod < len)
+ if (bp->mode & MODIFIED && bp->smod < len)
{
bp->mode &= ~(MODIFIED);
@@ -370,7 +370,7 @@ doupdate(void)
}
}
#endif
-
+
if (bp->emod >= len)
bp->emod = len - 1;
rel_move(tc_col, tc_line, bp->smod, i);
@@ -504,7 +504,7 @@ outc(unsigned char c)
register screenline_t *slp = GetCurrentLine();
register int i;
- // 0xFF is invalid for most cases (even DBCS),
+ // 0xFF is invalid for most cases (even DBCS),
if (c == 0xFF || c == 0x00)
return;
@@ -600,7 +600,7 @@ void
outstr(const char *str)
{
// XXX TODO cannot prepare DBCS-ready environment?
-
+
outs(str);
}
@@ -676,7 +676,7 @@ region_scroll_up(int top, int bottom)
}
// readback
-int
+int
instr(char *str)
{
register screenline_t *slp = GetCurrentLine();
@@ -688,7 +688,7 @@ instr(char *str)
return strlen(str);
}
-int
+int
innstr(char *str, int n)
{
register screenline_t *slp = GetCurrentLine();
@@ -703,7 +703,7 @@ innstr(char *str, int n)
return strlen(str);
}
-int
+int
inansistr(char *str, int n)
{
register screenline_t *slp = GetCurrentLine();
@@ -715,7 +715,7 @@ inansistr(char *str, int n)
return strlen(str);
}
-// level:
+// level:
// -1 - bold out
// 0 - dark text
// 1 - text
@@ -777,7 +777,7 @@ grayout(int y, int end, int level)
// of course, t_columns should always be far smaller.
if (strlen((char*)slp->data) > (size_t)t_columns)
slp->data[t_columns] = 0;
- strcpy((char*)slp->data,
+ strcpy((char*)slp->data,
level < 0 ? ANSI_COLOR(1) : ANSI_COLOR(1;30;40));
strcat((char*)slp->data, buf);
strcat((char*)slp->data, ANSI_RESET ANSI_CLRTOEND);
diff --git a/pttbbs/mbbsd/stuff.c b/pttbbs/mbbsd/stuff.c
index 704d7e7c..a0bbf412 100644
--- a/pttbbs/mbbsd/stuff.c
+++ b/pttbbs/mbbsd/stuff.c
@@ -1,7 +1,7 @@
/* $Id$ */
#include "bbs.h"
-// TODO remove this
+// TODO remove this
/* ----------------------------------------------------- */
/* set file path for boards/user home */
/* ----------------------------------------------------- */
@@ -104,7 +104,7 @@ gettime(int line, time4_t dt, const char* head)
localtime4_r(&dt, &ptime);
endtime = ptime;
snprintf(yn, sizeof(yn), "%4d", ptime.tm_year + 1900);
- move(line, 0); SOLVE_ANSI_CACHE(); clrtoeol();
+ move(line, 0); SOLVE_ANSI_CACHE(); clrtoeol();
snprintf(prompt, sizeof(prompt), "%s 西元年:", head);
do {
getdata_buf(line, 0, prompt, yn, 5, NUMECHO);
@@ -181,7 +181,7 @@ wait_penalty(int sec)
* @param y: starting line on screen
* @param lines: max lines to be displayed
* @param mode: SHOWFILE_*, see modes.h
- * @return 失敗傳回 0,否則為 1。
+ * @return 失敗傳回 0,否則為 1。
* 2 表示有 PttPrints 碼
*/
int
@@ -190,7 +190,7 @@ show_file(const char *filename, int y, int lines, int mode)
FILE *fp;
char buf[ANSILINELEN];
int ret = 1;
- int strpmode = STRIP_ALL;
+ int strpmode = STRIP_ALL;
if (mode & SHOWFILE_ALLOW_COLOR)
strpmode = ONLY_COLOR;
@@ -204,7 +204,7 @@ show_file(const char *filename, int y, int lines, int mode)
while (fgets(buf, sizeof(buf), fp) && lines--)
{
move(y++, 0);
- if (mode == SHOWFILE_RAW)
+ if (mode == SHOWFILE_RAW)
{
outs(buf);
}
@@ -244,7 +244,7 @@ search_num(int ch, int max)
char genbuf[10];
genbuf[0] = ch; genbuf[1] = 0;
- clen = getdata_buf(y, 0,
+ clen = getdata_buf(y, 0,
" 跳至第幾項: ", genbuf, sizeof(genbuf)-1, NUMECHO);
move(y, 0); clrtoeol();
@@ -375,7 +375,7 @@ show_helpfile(const char *helpfile)
}
// vgets/getdata compatible helpers
-static int
+static int
getdata2vgetflag(int echo)
{
assert(echo != GCARRY);
diff --git a/pttbbs/mbbsd/syspost.c b/pttbbs/mbbsd/syspost.c
index 168bd0e4..6c4b89e5 100644
--- a/pttbbs/mbbsd/syspost.c
+++ b/pttbbs/mbbsd/syspost.c
@@ -114,7 +114,7 @@ post_violatelaw2(const char *crime, const char *police, const char *reason, cons
snprintf(title, sizeof(title), "[報告] %s:%-*s 判決", crime,
(int)(30 - strlen(crime)), reason);
- snprintf(msg, sizeof(msg),
+ snprintf(msg, sizeof(msg),
ANSI_COLOR(1;32) "%s" ANSI_RESET "判決:\n"
" " ANSI_COLOR(1;32) "%s" ANSI_RESET "因"
ANSI_COLOR(1;35) "%s" ANSI_RESET "行為,\n"
@@ -125,7 +125,7 @@ post_violatelaw2(const char *crime, const char *police, const char *reason, cons
if (!strstr(police, "警察")) {
post_msg(BN_POLICELOG, title, msg, "[" BBSMNAME "法院]");
- snprintf(msg, sizeof(msg),
+ snprintf(msg, sizeof(msg),
ANSI_COLOR(1;32) "%s" ANSI_RESET "判決:\n"
" " ANSI_COLOR(1;32) "%s" ANSI_RESET "因"
ANSI_COLOR(1;35) "%s" ANSI_RESET "行為,\n"
diff --git a/pttbbs/mbbsd/talk.c b/pttbbs/mbbsd/talk.c
index cb2e5e26..7d5b1423 100644
--- a/pttbbs/mbbsd/talk.c
+++ b/pttbbs/mbbsd/talk.c
@@ -13,9 +13,9 @@ static char * const withme_str[] = {
#define MAX_SHOW_MODE 7
/* M_INT: monitor mode update interval */
-#define M_INT 15
+#define M_INT 15
/* P_INT: interval to check for page req. in talk/chat */
-#define P_INT 20
+#define P_INT 20
#define BOARDFRI 1
typedef struct pickup_t {
@@ -46,7 +46,7 @@ iswritable_stat(const userinfo_t * uentp, int fri_stat)
if (!HasBasicUserPerm(PERM_LOGINOK) || HasUserPerm(PERM_VIOLATELAW))
return 0;
- return (uentp->pager != PAGER_ANTIWB &&
+ return (uentp->pager != PAGER_ANTIWB &&
(fri_stat & HFM || uentp->pager != PAGER_FRIENDONLY));
}
@@ -127,7 +127,7 @@ modestring(const userinfo_t * uentp, int simple)
getuserid(uentp->destuid) : "空氣");
else
snprintf(modestr, sizeof(modestr), "回應呼叫");
- }
+ }
else if (!mode && *uentp->chatid == 3)
snprintf(modestr, sizeof(modestr), "水球準備中");
else if (
@@ -139,7 +139,7 @@ modestring(const userinfo_t * uentp, int simple)
)
if (uentp->msgcount < 10) {
const char *cnum[10] =
- {"", "一", "兩", "三", "四", "五",
+ {"", "一", "兩", "三", "四", "五",
"六", "七", "八", "九"};
snprintf(modestr, sizeof(modestr),
"中%s顆水球", cnum[(int)(uentp->msgcount)]);
@@ -353,7 +353,7 @@ logout_friend_online(userinfo_t * utmp)
if( !(0 <= thefriend && thefriend < USHM_SIZE) )
continue;
- ui = &SHM->uinfo[thefriend];
+ ui = &SHM->uinfo[thefriend];
if(ui->pid==0 || ui==utmp)
continue;
if(ui->friendtotal > MAX_FRIEND || ui->friendtotal<0)
@@ -495,7 +495,7 @@ my_query(const char *uident)
Cdate(muser.lastseen ? &muser.lastseen : &muser.lastlogin));
// print out muser.lasthost
#ifdef USE_MASKED_FROMHOST
- if(!HasUserPerm(PERM_SYSOP|PERM_ACCOUNTS))
+ if(!HasUserPerm(PERM_SYSOP|PERM_ACCOUNTS))
obfuscate_ipstr(muser.lasthost);
#endif // !USE_MASKED_FROMHOST
outs(muser.lasthost[0] ? muser.lasthost : "(不詳)");
@@ -503,7 +503,7 @@ my_query(const char *uident)
}
// ------------------------------------------------------------
-
+
prints("《 五子棋 》%5d 勝 %5d 敗 %5d 和 "
"《象棋戰績》%5d 勝 %5d 敗 %5d 和\n",
muser.five_win, muser.five_lose, muser.five_tie,
@@ -513,7 +513,7 @@ my_query(const char *uident)
ENDSTAT(STAT_QUERY);
- if(HasUserPerm(PERM_SYSOP|PERM_POLICE) )
+ if(HasUserPerm(PERM_SYSOP|PERM_POLICE) )
{
if(vmsg("T: 開立罰單")=='T')
violate_law(&muser, tuid);
@@ -546,7 +546,7 @@ void check_water_init(void)
strlcpy(water[0].userid, " 全部 ", sizeof(water[0].userid));
}
}
-
+
static void
ofo_water_scr(const water_t * tw, int which, char type)
{
@@ -770,7 +770,7 @@ my_write(pid_t pid, const char *prompt, const char *id, int flag, userinfo_t * p
*/
if ((!uin || !uin->userid[0]) && !((flag == WATERBALL_GENERAL
#ifdef PLAY_ANGEL
- || flag == WATERBALL_ANGEL || flag == WATERBALL_ANSWER
+ || flag == WATERBALL_ANGEL || flag == WATERBALL_ANSWER
#endif
)
&& water_which->count > 0)) {
@@ -862,7 +862,7 @@ my_write(pid_t pid, const char *prompt, const char *id, int flag, userinfo_t * p
|| flag == WATERBALL_CONFIRM_ANGEL
|| flag == WATERBALL_CONFIRM_ANSWER
#endif
- ))
+ ))
{
snprintf(buf, sizeof(buf), "丟 %s: %s [Y/n]?", destid, msg);
@@ -988,7 +988,7 @@ my_write(pid_t pid, const char *prompt, const char *id, int flag, userinfo_t * p
#ifdef NOKILLWATERBALL
!(uin->wbtime = now) /* race */
#else
- (uin->pid <= 0 || kill(uin->pid, SIGUSR2) == -1)
+ (uin->pid <= 0 || kill(uin->pid, SIGUSR2) == -1)
#endif
&& flag != WATERBALL_ALOHA)
outmsg(ANSI_COLOR(1;33;41) "糟糕! 沒打中! " ANSI_COLOR(37) "~>_<~" ANSI_RESET);
@@ -1018,8 +1018,8 @@ my_write(pid_t pid, const char *prompt, const char *id, int flag, userinfo_t * p
void
getmessage(msgque_t msg)
{
- int write_pos = currutmp->msgcount;
- if ( write_pos < (MAX_MSGS - 1) ) {
+ int write_pos = currutmp->msgcount;
+ if ( write_pos < (MAX_MSGS - 1) ) {
unsigned char pager0 = currutmp->pager;
currutmp->msgcount = write_pos+1;
memcpy(&currutmp->msgs[write_pos], &msg, sizeof(msgque_t));
@@ -1190,7 +1190,7 @@ int make_connection_to_somebody(userinfo_t *uin, int timeout){
currutmp->sockaddr = server.sin_port;
currutmp->destuid = uin->uid;
// WORKAROUND setutmpmode() checks currstat as cache of currutmp->mode.
- // however if you invoke page -> rejected -> do something -> page again,
+ // however if you invoke page -> rejected -> do something -> page again,
// the currstat=PAGE but currutmp->mode!=PAGE, and then the paging will fail.
// so, let's temporary break currstat here.
currstat = IDLE;
@@ -1501,7 +1501,7 @@ my_talk(userinfo_t * uin, int fri_stat, char defact)
#define US_ACTION 1232
#define US_REDRAW 1231
-static const char
+static const char
*hlp_talkbasic[] = {
"【移動游標】", NULL,
" 往上一行", "↑ k",
@@ -1650,7 +1650,7 @@ descript(int show_mode, const userinfo_t * uentp, int diff, char *description, i
return description;
case 4:
snprintf(description, len,
- "%4d %s", uentp->chess_elo_rating,
+ "%4d %s", uentp->chess_elo_rating,
(uentp->withme&WITHME_CHESS)?"找我下棋":
(uentp->withme&WITHME_NOCHESS)?"別找我":"");
return description;
@@ -1676,7 +1676,7 @@ descript(int show_mode, const userinfo_t * uentp, int diff, char *description, i
/*
* userlist
- *
+ *
* 有別於其他大部份 bbs在實作使用者名單時, 都是將所有 online users 取一份到
* local space 中, 按照所須要的方式 sort 好 (如按照 userid , 五子棋, 來源等
* 等) . 這將造成大量的浪費: 為什麼每個人都要為了產生這一頁僅 20 個人的資料
@@ -1699,7 +1699,7 @@ descript(int show_mode, const userinfo_t * uentp, int diff, char *description, i
* 式 sort 好, 放置在 SHM->sorted中.
*
* 接下來, 我們每次只從確定的起始位置拿, 特別是除非有須要, 不然不會去產生好
- * 友區.
+ * 友區.
*
* 各個 function 摘要
* sort_cmpfriend() sort function, key: friend type
@@ -1828,7 +1828,7 @@ pickup(pickup_t * currpickup, int pickup_way, int *page,
/* 含板友, 好友區最多只會有 (friendtotal + 板友) 個*/
(currutmp->brc_id && which < (friendtotal + 1 +
getbcache(currutmp->brc_id)->nuser)) ||
-
+
/* 不含板友, 最多只會有 friendtotal個 */
(!currutmp->brc_id && which < friendtotal + 1)
))) {
@@ -1851,8 +1851,8 @@ pickup(pickup_t * currpickup, int pickup_way, int *page,
if (*nfriend > which) {
/* 只有在要秀出才有必要 sort */
/* TODO 好友跟板友可以分開 sort, 可能只需要其一 */
- /* TODO 好友上下站才需要 sort 一次, 不需要每次 sort.
- * 可維護一個 dirty bit 表示是否 sort 過.
+ /* TODO 好友上下站才需要 sort 一次, 不需要每次 sort.
+ * 可維護一個 dirty bit 表示是否 sort 過.
* suggested by WYchuang@ptt */
qsort(friends, *nfriend, sizeof(pickup_t), sort_cmpfriend);
size = *nfriend - which;
@@ -1970,30 +1970,30 @@ draw_pickup(int drawall, pickup_t * pickup, int pickup_way,
// modes should match ANGELPAUSE*
static const char *modestr[ANGELPAUSE_MODES] = {
ANSI_COLOR(0;30;47) "開放",
- ANSI_COLOR(0;32;47) "停收",
- ANSI_COLOR(0;31;47) "關閉",
+ ANSI_COLOR(0;32;47) "停收",
+ ANSI_COLOR(0;31;47) "關閉",
};
// reduced version
// TODO use vs_footer to replace.
move(b_lines, 0);
vbarf( ANSI_COLOR(34;46) " 休閒聊天 "
- ANSI_COLOR(31;47) " (TAB/f)" ANSI_COLOR(30) "排序/好友 "
- ANSI_COLOR(31) "(p)" ANSI_COLOR(30) "一般呼叫器 "
+ ANSI_COLOR(31;47) " (TAB/f)" ANSI_COLOR(30) "排序/好友 "
+ ANSI_COLOR(31) "(p)" ANSI_COLOR(30) "一般呼叫器 "
ANSI_COLOR(31) "(^P)" ANSI_COLOR(30) "神諭呼叫器\t"
ANSI_COLOR(1;30;47) "[神諭呼叫器] %s ",
modestr[currutmp->angelpause % ANGELPAUSE_MODES]);
- } else
+ } else
#endif
vs_footer(" 休閒聊天 ",
" (TAB/f)排序/好友 (a/o)交友 (q/w)查詢/丟水球 (t/m)聊天/寫信\t(h)說明");
}
move(1, 0);
- prints(" 排序:[%s] 上站人數:%-4d "
+ prints(" 排序:[%s] 上站人數:%-4d "
ANSI_COLOR(1;32) "我的朋友:%-3d "
- ANSI_COLOR(33) "與我為友:%-3d "
- ANSI_COLOR(36) "板友:%-4d "
- ANSI_COLOR(31) "壞人:%-2d"
+ ANSI_COLOR(33) "與我為友:%-3d "
+ ANSI_COLOR(36) "板友:%-4d "
+ ANSI_COLOR(31) "壞人:%-2d"
ANSI_RESET "\n",
msg_pickup_way[pickup_way], SHM->UTMPnumber,
myfriend, friendme, currutmp->brc_id ? bfriend : 0, badfriend);
@@ -2016,7 +2016,7 @@ draw_pickup(int drawall, pickup_t * pickup, int pickup_way,
}
// prepare user data
-
+
if (PERM_HIDE(uentp))
state = 9;
else if (currutmp == uentp)
@@ -2063,8 +2063,8 @@ draw_pickup(int drawall, pickup_t * pickup, int pickup_way,
vs_cols(ulist_coldef, cols, ULISTCOLS,
// Columns data (9 params)
num,
- pager,
- fcolor[state] ? xuid : uentp->userid,
+ pager,
+ fcolor[state] ? xuid : uentp->userid,
uentp->nickname,
descript(show_mode, uentp, uentp->pager & !(friend & HRM),
description, sizeof(description)),
@@ -2084,7 +2084,7 @@ void set_withme_flag(void)
int i;
char genbuf[20];
int line;
-
+
move(1, 0);
clrtobot();
@@ -2299,7 +2299,7 @@ userlist(void)
// XXX si 已經寫死了 pickup_way = 0
// 若使用者在 pickup_way != 0 時按 's'...
-
+
si = CompleteOnlineUser(msg_uid, swid);
if (si >= 0) {
pickup_t friends[MAX_FRIEND + 1];
@@ -2307,7 +2307,7 @@ userlist(void)
int *ulist =
SHM->sorted[SHM->currsorted]
[((pickup_way == 0) ? 0 : (pickup_way - 1))];
-
+
fi = ulist[si];
nGots = pickup_myfriend(friends, &myfriend,
&friendme, &badfriend);
@@ -2407,7 +2407,7 @@ userlist(void)
if (!getdata(0, 0, "廣播訊息:", genbuf+6, 54, DOECHO))
break;
-
+
if (!getdata(0, 0, "確定廣播? [N]",
ans, sizeof(ans), LCECHO) ||
ans[0] != 'y')
diff --git a/pttbbs/mbbsd/telnet.c b/pttbbs/mbbsd/telnet.c
index ed094abd..81a57c4d 100644
--- a/pttbbs/mbbsd/telnet.c
+++ b/pttbbs/mbbsd/telnet.c
@@ -6,14 +6,14 @@ static char raw_connection = 0;
#ifdef DETECT_CLIENT
extern void UpdateClientCode(unsigned char c);
-static void
+static void
telnet_cb_update_client_code(void *cc_arg GCC_UNUSED, unsigned char c)
{
UpdateClientCode(c);
}
#endif
-static void
+static void
telnet_cb_resize_term(void *resize_arg GCC_UNUSED, int w, int h)
{
term_resize(w, h);
@@ -70,4 +70,4 @@ telnet_turnoff_client_detect(void)
telnet_ctx_set_cc_arg(ctx, NULL);
}
-// vim: sw=4
+// vim: sw=4
diff --git a/pttbbs/mbbsd/timecap.c b/pttbbs/mbbsd/timecap.c
index 5afcf877..df846bba 100644
--- a/pttbbs/mbbsd/timecap.c
+++ b/pttbbs/mbbsd/timecap.c
@@ -63,7 +63,7 @@ enum TIME_CAPSULE_ACTION_TYPE {
static int
timecap_get_max_revision(const char *capsule_index) {
- off_t sz = dashs(capsule_index);
+ off_t sz = dashs(capsule_index);
// TODO we can change implementation to read int instead of dashs
return sz > 0 ? (int)sz : 0;
}
@@ -287,7 +287,7 @@ timecapsule_add_revision(const char *filename) {
return timecap_add_object(filename, TIME_CAPSULE_ACTION_REVISION, NULL, 0);
}
-int
+int
timecapsule_get_max_revision_number(const char *filename) {
return timecap_query_object_max_number(
filename, TIME_CAPSULE_ACTION_REVISION, 0);
@@ -299,7 +299,7 @@ timecapsule_get_max_archive_number(const char *filename, size_t szrefblob) {
filename, TIME_CAPSULE_ACTION_ARCHIVE, szrefblob);
}
-int
+int
timecapsule_archive(const char *filename, const void *ref, size_t szref) {
return timecap_add_object(
filename, TIME_CAPSULE_ACTION_ARCHIVE, ref, szref);
diff --git a/pttbbs/mbbsd/user.c b/pttbbs/mbbsd/user.c
index ea6d75ba..7ca234dd 100644
--- a/pttbbs/mbbsd/user.c
+++ b/pttbbs/mbbsd/user.c
@@ -55,11 +55,11 @@ u_set_mind()
// XXX 以往有 check 通緝/壽星,但我實在看不出這有什麼意義
memcpy(mindbuf, currutmp->mind, sizeof(mindbuf));
- getdata_buf(b_lines - 1, 0, "現在的心情? ", mindbuf, sizeof(mindbuf), DOECHO);
+ getdata_buf(b_lines - 1, 0, "現在的心情? ", mindbuf, sizeof(mindbuf), DOECHO);
if (memcmp(mindbuf, currutmp->mind, sizeof(currutmp->mind)) == 0)
return 0;
- memcpy(currutmp->mind, mindbuf, sizeof(currutmp->mind));
+ memcpy(currutmp->mind, mindbuf, sizeof(currutmp->mind));
return 1;
}
@@ -118,14 +118,14 @@ int u_cancelbadpost(void)
// early check.
if(cuser.badpost == 0) {
- vmsg("你並沒有劣文.");
+ vmsg("你並沒有劣文.");
return 0;
}
-
+
// early check for race condition
// XXX 由於帳號API已同步化 (pwcuAPI*) 所以這個 check 可有可無
if(search_ulistn(usernum,2)) {
- vmsg("請登出其他視窗, 否則不受理.");
+ vmsg("請登出其他視窗, 否則不受理.");
return 0;
}
@@ -166,12 +166,12 @@ int u_cancelbadpost(void)
}
if (pwcuCancelBadpost() != 0) {
- vmsg("刪除失敗,請洽站務人員。");
+ vmsg("刪除失敗,請洽站務人員。");
return 0;
}
log_filef("log/cancelbadpost.log", LOG_CREAT,
- "%s %s 刪除一篇劣文 (%d -> %d 篇)\n",
+ "%s %s 刪除一篇劣文 (%d -> %d 篇)\n",
Cdate(&now), cuser.userid, prev, cuser.badpost);
vmsgf("恭喜您已成功\刪除一篇劣文 (由 %d 變為 %d 篇)",
@@ -189,7 +189,7 @@ user_display(const userec_t * u, int adminmode)
prints(
" " ANSI_COLOR(30;41) "┴┬┴┬┴┬" ANSI_RESET
" " ANSI_COLOR(1;30;45) " 使 用 者" " 資 料 "
- " " ANSI_RESET " " ANSI_COLOR(30;41) "┴┬┴┬┴┬" ANSI_RESET
+ " " ANSI_RESET " " ANSI_COLOR(30;41) "┴┬┴┬┴┬" ANSI_RESET
"\n");
prints("\t代號暱稱: %s (%s)\n", u->userid, u->nickname);
prints("\t真實姓名: %s", u->realname);
@@ -206,7 +206,7 @@ user_display(const userec_t * u, int adminmode)
prints("\t職業學歷: %s\n", u->career);
prints("\t居住地址: %s\n", u->address);
prints("\t電話手機: %s", u->phone);
- if (u->mobile)
+ if (u->mobile)
prints(" / %010d", u->mobile);
outs("\n");
@@ -214,9 +214,9 @@ user_display(const userec_t * u, int adminmode)
prints("\t%6s幣: %d " MONEYNAME "\n", BBSMNAME, u->money);
prints("\t是否成年: %s滿18歲\n", u->over_18 ? "已" : "未");
- prints("\t註冊日期: %s (已滿 %d 天)\n",
+ prints("\t註冊日期: %s (已滿 %d 天)\n",
Cdate(&u->firstlogin), (int)((now - u->firstlogin)/DAY_SECONDS));
- prints("\t上次上站: %s (來自 %s)\n",
+ prints("\t上次上站: %s (來自 %s)\n",
Cdate(&u->lastlogin), u->lasthost);
if (adminmode) {
@@ -516,16 +516,16 @@ void Customize(void)
clrtoeol();
prints( ANSI_COLOR(1;36) "%c" ANSI_RESET
". %-*s%s\n",
- 'a' + ia,
+ 'a' + ia,
col_opt,
desc1[i],
- HasUserFlag(masks1[i]) ?
+ HasUserFlag(masks1[i]) ?
ANSI_COLOR(1;36) "是" ANSI_RESET : "否");
}
/* extended stuff */
{
char mindbuf[5];
- static const char *wm[PAGER_UI_TYPES+1] =
+ static const char *wm[PAGER_UI_TYPES+1] =
{"一般", "進階", "未來", ""};
prints("%c. %-*s%s\n",
@@ -549,8 +549,8 @@ void Customize(void)
"停收 (只接受已回應過的小主人的問題)",
"關閉 (停止接受所有小主人的問題)",
};
- prints("%c. %s%s\n",
- '1' + iax++,
+ prints("%c. %s%s\n",
+ '1' + iax++,
"ANGEL 小天使神諭呼叫器: ",
msgs[currutmp->angelpause % ANGELPAUSE_MODES]);
}
@@ -558,7 +558,7 @@ void Customize(void)
}
/* input */
- key = vmsgf("請按 [a-%c,1-%c] 切換設定,其它任意鍵結束: ",
+ key = vmsgf("請按 [a-%c,1-%c] 切換設定,其它任意鍵結束: ",
'a' + ia-1, '1' + iax -1);
if (key >= 'a' && key < 'a' + ia)
@@ -579,10 +579,10 @@ void Customize(void)
switch(key)
{
- case 0:
+ case 0:
{
pwcuSetPagerUIType((cuser.pager_ui_type +1) % PAGER_UI_TYPES_USER);
- vmsg("修改水球模式後請正常離線再重新上線");
+ vmsg("修改水球模式後請正常離線再重新上線");
dirty = 1;
}
continue;
@@ -592,12 +592,12 @@ void Customize(void)
continue;
}
#ifdef PLAY_ANGEL
- if( HasUserPerm(PERM_ANGEL) ){
- if (key == iax-1)
- {
+ if( HasUserPerm(PERM_ANGEL) ){
+ if (key == iax-1)
+ {
angel_toggle_pause();
// dirty = 1; // pure utmp change does not need pw dirty
- continue;
+ continue;
}
}
#endif //PLAY_ANGEL
@@ -700,10 +700,10 @@ uinfo_query(const char *orig_uid, int adminmode, int unum)
if (adminmode && ((ans >= '1' && ans <= '8') || ans == 'm') &&
search_ulist(unum))
{
- if (vans("使用者目前正在線上,修改資料會先踢下線。確定要繼續嗎? (y/N): ")
+ if (vans("使用者目前正在線上,修改資料會先踢下線。確定要繼續嗎? (y/N): ")
!= 'y')
return;
- if (unum == usernum &&
+ if (unum == usernum &&
vans("您正試圖修改自己的帳號;這可能會造成帳號損毀,確定要繼續嗎? (y/N): ")
!= 'y')
return;
@@ -717,7 +717,7 @@ uinfo_query(const char *orig_uid, int adminmode, int unum)
case 'm':
while (1) {
- getdata_str(y, 0,
+ getdata_str(y, 0,
adminmode ? "E-Mail (站長變更不需認證): " :
"電子信箱 [變動要重新認證]:",
buf, sizeof(x.email), DOECHO, x.email);
@@ -738,7 +738,7 @@ uinfo_query(const char *orig_uid, int adminmode, int unum)
if (email_count < 0)
vmsg("暫時不允許\ email 認證, 請稍後再試");
- else if (email_count >= EMAILDB_LIMIT)
+ else if (email_count >= EMAILDB_LIMIT)
vmsg("指定的 E-Mail 已註冊過多帳號, 請使用其他 E-Mail");
else
break; // valid mail
@@ -753,7 +753,7 @@ uinfo_query(const char *orig_uid, int adminmode, int unum)
// admins may want to use special names
if (buf[0] &&
- strcmp(buf, x.email) &&
+ strcmp(buf, x.email) &&
(strchr(buf, '@') || adminmode)) {
// TODO 這裡也要 emaildb_check
@@ -874,7 +874,7 @@ uinfo_query(const char *orig_uid, int adminmode, int unum)
sethomefile(genbuf, x.userid, chess_photo_name[j]);
sethomefile(mybuf, x.userid, chess_photo_name[j]);
strcat(mybuf, ".new");
-
+
Rename(mybuf, genbuf);
}
fclose(fp);
@@ -1014,7 +1014,7 @@ uinfo_query(const char *orig_uid, int adminmode, int unum)
fail++;
break;
}
- }
+ }
if (!getdata(y++, 0, "請設定新密碼:", buf, PASS_INPUT_LEN + 1,
PASSECHO)) {
outs("\n\n密碼設定取消, 繼續使用舊密碼\n");
@@ -1120,9 +1120,9 @@ uinfo_query(const char *orig_uid, int adminmode, int unum)
break;
}
pre_confirmed = 1;
- snprintf(title, sizeof(title),
+ snprintf(title, sizeof(title),
"刪除ID: %s (站長: %s)", x.userid, cuser.userid);
- snprintf(msg, sizeof(msg),
+ snprintf(msg, sizeof(msg),
"帳號 %s 由站長 %s 執行刪除,理由:\n %s\n\n"
"真實姓名:%s\n住址:%s\n認證資料:%s\nEmail:%s\n",
x.userid, cuser.userid, reason,
@@ -1132,7 +1132,7 @@ uinfo_query(const char *orig_uid, int adminmode, int unum)
break;
case '5':
- mvouts(b_lines - 8, 0, "\n"
+ mvouts(b_lines - 8, 0, "\n"
"已知很多使用者搞不清狀況改完 ID 大小寫會哭哭無法修改以前文章,\n"
"且有不少管理/維護的問題,"
ANSI_COLOR(1;31)
@@ -1380,7 +1380,7 @@ showsignature(char *fname, int *j, SigInfo *si)
lines--;
if(lines > MAX_SIGLINES/2)
si->show_max = si->max;
- for (i = 0; lines > 0 && i < MAX_SIGLINES &&
+ for (i = 0; lines > 0 && i < MAX_SIGLINES &&
fgets(buf, sizeof(buf), fp) != NULL; i++)
{
chomp(buf);
diff --git a/pttbbs/mbbsd/var.c b/pttbbs/mbbsd/var.c
index 6efbd822..4f3ddfda 100644
--- a/pttbbs/mbbsd/var.c
+++ b/pttbbs/mbbsd/var.c
@@ -120,7 +120,7 @@ const char * const str_permboard[] = {
};
/* modes.h */
-const char * const str_pager_modes[PAGER_MODES] =
+const char * const str_pager_modes[PAGER_MODES] =
{
"關閉", // PAGER_OFF
"打開", // PAGER_ON
@@ -387,7 +387,7 @@ int wmofo = NOTREPLYING;
* watermode = -1 沒在回水球
* = 0 在回上一顆水球 (Ctrl-R)
* > 0 在回前 n 顆水球 (Ctrl-R Ctrl-R)
- *
+ *
* PAGER_UI_IS(PAGER_UI_OFO) by in2
* wmofo = NOTREPLYING 沒在回水球
* = REPLYING 正在回水球
diff --git a/pttbbs/mbbsd/vote.c b/pttbbs/mbbsd/vote.c
index bc108a16..af137989 100644
--- a/pttbbs/mbbsd/vote.c
+++ b/pttbbs/mbbsd/vote.c
@@ -87,7 +87,7 @@ b_suckinfile_invis(FILE * fp, const char *fname, const char *boardname)
/* first time, try if boardname revealed. */
char *post = strstr(inbuf, str_post1);
if(!post) post = strstr(inbuf, str_post2);
- if(post)
+ if(post)
post = strstr(post, boardname);
if(post) {
/* found releaved stuff. */
@@ -248,7 +248,7 @@ b_result_one(const vote_buffer_t *vbuf, boardheader_t * fh, int *total)
for (junk = 0; junk < item_num; junk++) {
fgets(inbuf, sizeof(inbuf), cfp);
chomp(inbuf);
- fprintf(tfp, " %-42s %3d 票 %6.2f%% %6.2f%%\n", inbuf + 3, counts[junk],
+ fprintf(tfp, " %-42s %3d 票 %6.2f%% %6.2f%%\n", inbuf + 3, counts[junk],
(float)(counts[junk] * 100) / (float)(people_num),
(float)(counts[junk] * 100) / (float)(*total));
}
diff --git a/pttbbs/mbbsd/voteboard.c b/pttbbs/mbbsd/voteboard.c
index 27a27c3f..69fc8097 100644
--- a/pttbbs/mbbsd/voteboard.c
+++ b/pttbbs/mbbsd/voteboard.c
@@ -74,7 +74,7 @@ do_voteboardreply(const fileheader_t * fhdr)
{
if (!strncmp(genbuf, "----------",10))
{yes=-1; continue;}
- else
+ else
yes++;
}
if (yes>3) outs(genbuf);
@@ -89,7 +89,7 @@ do_voteboardreply(const fileheader_t * fhdr)
return;
}
}
- if(yes>=0) continue;
+ if(yes>=0) continue;
space = strpbrk(genbuf+4, " \n");
if(space) *space='\0';
@@ -122,7 +122,7 @@ do_voteboardreply(const fileheader_t * fhdr)
{close(fd); return;}
if(!(fi = fopen(oldfpath, "r")))
{flock(fd, LOCK_UN); close(fd); return;}
-
+
if(!(fo = fopen(fpath, "w")))
{
flock(fd, LOCK_UN);
@@ -142,7 +142,7 @@ do_voteboardreply(const fileheader_t * fhdr)
now -= 14 * 24 * 60 * 60;
}
fputs(genbuf, fo);
- len = strlen(cuser.userid);
+ len = strlen(cuser.userid);
for(yes=0; fgets(genbuf, sizeof(genbuf), fi);) {
if (!strncmp("----------", genbuf, 10))
break;
diff --git a/pttbbs/mbbsd/vtuikit.c b/pttbbs/mbbsd/vtuikit.c
index 2cf5d283..ee19cba3 100644
--- a/pttbbs/mbbsd/vtuikit.c
+++ b/pttbbs/mbbsd/vtuikit.c
@@ -11,7 +11,7 @@
* then re-implemented everything from scratch :)
*
* We will try to keep the API behavior similiar (to help porting)
- * but won't stick to it.
+ * but won't stick to it.
* Maybe at the end only 'vmsg' and 'vmsgf' will still be compatible....
*
* m3 visio = (ptt) vtuikit+vtkbd+screen/term.
@@ -260,13 +260,13 @@ vfill(int n, int flags, const char *s)
outc(' ');
// close fill.
- if (has_ansi)
+ if (has_ansi)
outs(ANSI_RESET);
}
/**
* vfill(n, flags, fmt, ...): 使用 vfill 輸出並格式化字串。
- *
+ *
* @param n space to occupy
* @param flags VFILL_* parameters
* @param fmt string to display
@@ -298,7 +298,7 @@ vpad(int n, const char *pattern)
while (n >= len)
{
- outs(pattern);
+ outs(pattern);
n -= len;
}
if (n) nblank(n);
@@ -386,7 +386,7 @@ vshowmsg(const char *msg)
nblank(w);
// able to print float?
- if (szfloat)
+ if (szfloat)
{
outs(VCLR_MSG_FLOAT);
outs(pfloat);
@@ -407,7 +407,7 @@ vans(const char *msg)
{
char buf[3];
- move(b_lines, 0);
+ move(b_lines, 0);
clrtoeol(); SOLVE_ANSI_CACHE();
outs(msg);
vgets(buf, sizeof(buf), VGET_LOWERCASE);
@@ -419,7 +419,7 @@ vans(const char *msg)
*
* @param s 指定訊息,見 vshowmsg
*/
-int
+int
vansf(const char *fmt, ...)
{
char msg[VBUFLEN];
@@ -570,7 +570,7 @@ vs_rectangle_simple(int l, int t, int r, int b)
* @param mid: 置中說明,可被切齊。
* @param right: 靠右的說明,空間夠才會顯示。
*/
-void
+void
vs_header(const char *title, const char *mid, const char *right)
{
int w = MAX_COL;
@@ -589,7 +589,7 @@ vs_header(const char *title, const char *mid, const char *right)
w -= strlen(title);
}
- // determine if we can display right message, and
+ // determine if we can display right message, and
// if if we need to truncate mid.
if (szmid + szright > w)
szright = 0;
@@ -719,7 +719,7 @@ vs_hdr2f(const char *fmt, ...)
* @param caption 左邊的分類字串
* @param msg 訊息字串, \t 後文字靠右、最後面會自動留一個空白。
*/
-void
+void
vs_footer(const char *caption, const char *msg)
{
int i = 0;
@@ -728,7 +728,7 @@ vs_footer(const char *caption, const char *msg)
if (caption)
{
outs(VCLR_FOOTER_CAPTION);
- outs(caption);
+ outs(caption);
i += (*caption == ESC_CHR) ?
strlen_noansi(caption) :
(int)strlen(caption);
@@ -749,7 +749,7 @@ vs_footer(const char *caption, const char *msg)
int l = strlen(++msg);
if (i + l > SAFE_MAX_COL) break;
l = SAFE_MAX_COL - l - i;
- nblank(l);
+ nblank(l);
i += l;
continue;
}
@@ -767,7 +767,7 @@ vs_footer(const char *caption, const char *msg)
* vs_cols_layout(cols, ws, n): 依據 cols (大小 n) 的定義計算適合的行寬於 ws
*/
-void
+void
vs_cols_layout(const VCOL *cols, VCOLW *ws, int n)
{
int i, tw;
@@ -808,7 +808,7 @@ vs_cols_layout(const VCOL *cols, VCOLW *ws, int n)
continue;
// lower priority, update pri2 and skip.
- if (cols[i].pri < pri1)
+ if (cols[i].pri < pri1)
{
if (cols[i].pri > pri2)
pri2 = cols[i].pri;
@@ -816,7 +816,7 @@ vs_cols_layout(const VCOL *cols, VCOLW *ws, int n)
}
// now increase fields
- ws[i] ++;
+ ws[i] ++;
if (++tw >= MAX_COL) break;
run ++;
}
@@ -848,13 +848,13 @@ vs_cols(const VCOL *cols, const VCOLW *ws, int n, ...)
s = va_arg(ap, char*);
// quick check input.
- if (!s)
+ if (!s)
{
s = "";
}
w = *ws;
- if (cols->attr)
+ if (cols->attr)
outs(cols->attr);
// build vfill flag
@@ -886,14 +886,14 @@ vs_cols(const VCOL *cols, const VCOLW *ws, int n, ...)
*/
void
vs_multi_T_table_simple(
- const char ***t_tables, int n_t_tables,
+ const char ***t_tables, int n_t_tables,
const int *col_widths, const int *l_widths,
const char *attr_caption, const char *attr_l, const char *attr_r)
{
int i;
int incomplete;
- do
+ do
{
incomplete = n_t_tables;
for (i = 0; i < n_t_tables; i++)
@@ -911,7 +911,7 @@ vs_multi_T_table_simple(
if (attr_caption) outs(attr_caption);
vfill(col_widths[i], 0, lvar);
continue;
- }
+ }
if (!lvar) {
// table is complete...
@@ -1102,13 +1102,13 @@ InputHistoryDelta(char *s, int sz, int d)
}
}
-void
+void
InputHistoryPrev(char *s, int sz)
{
InputHistoryDelta(s, sz, -1);
}
-void
+void
InputHistoryNext(char *s, int sz)
{
InputHistoryDelta(s, sz, +1);
@@ -1151,7 +1151,7 @@ _vgetcbhandler(VGET_FCALLBACK cbptr, int *pabort, int c, VGET_RUNTIME *prt, void
return 0;
}
-int
+int
vgetstring(char *_buf, int len, int flags, const char *defstr, const VGET_CALLBACKS *pcbs, void *instance)
{
// rt.iend points to NUL address, and
@@ -1161,7 +1161,7 @@ vgetstring(char *_buf, int len, int flags, const char *defstr, const VGET_CALLBA
int c = 0;
char ismsgline = 0;
- // callback
+ // callback
VGET_CALLBACKS cb = {NULL};
// always use internal buffer to prevent temporary input issue.
@@ -1189,7 +1189,7 @@ vgetstring(char *_buf, int len, int flags, const char *defstr, const VGET_CALLBA
}
// setup callbacks
- if (pcbs)
+ if (pcbs)
cb = *pcbs;
getyx(&line, &col); // now (line,col) is the beginning of our new fields.
@@ -1341,7 +1341,7 @@ vgetstring(char *_buf, int len, int flags, const char *defstr, const VGET_CALLBA
}
// the basic keys
- switch(c)
+ switch(c)
{
// exiting keys
case KEY_ENTER:
@@ -1465,7 +1465,7 @@ vgets(char *buf, int len, int flags)
return vgetstr(buf, len, flags, "");
}
-int
+int
vgetstr(char *buf, int len, int flags, const char *defstr)
{
return vgetstring(buf, len, flags, defstr, NULL, NULL);