summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/proto.h10
-rw-r--r--mbbsd/admin.c2
-rw-r--r--mbbsd/bbs.c6
-rw-r--r--mbbsd/board.c2
-rw-r--r--mbbsd/chat.c2
-rw-r--r--mbbsd/chc.c10
-rw-r--r--mbbsd/chicken.c10
-rw-r--r--mbbsd/dark.c6
-rw-r--r--mbbsd/edit.c2
-rw-r--r--mbbsd/friend.c6
-rw-r--r--mbbsd/gomo.c2
-rw-r--r--mbbsd/io.c2
-rw-r--r--mbbsd/mail.c4
-rw-r--r--mbbsd/mbbsd.c4
-rw-r--r--mbbsd/menu.c28
-rw-r--r--mbbsd/more.c2
-rw-r--r--mbbsd/name.c2
-rw-r--r--mbbsd/othello.c8
-rw-r--r--mbbsd/page.c4
-rw-r--r--mbbsd/read.c4
-rw-r--r--mbbsd/screen.c2
-rw-r--r--mbbsd/stuff.c2
-rw-r--r--mbbsd/talk.c6
-rw-r--r--mbbsd/user.c2
-rw-r--r--mbbsd/var.c96
-rw-r--r--mbbsd/vote.c14
26 files changed, 119 insertions, 119 deletions
diff --git a/include/proto.h b/include/proto.h
index c5a6ff28..28e60f78 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -19,7 +19,7 @@ int search_user_bybakpwd(void);
int m_board(void);
int m_register(void);
int cat_register(void);
-unsigned int setperms(unsigned int pbits, char *pstring[]);
+unsigned int setperms(unsigned int pbits, char * const pstring[]);
void setup_man(boardheader_t * board);
void delete_symbolic_link(boardheader_t *bh, int bid);
int make_symbolic_link(char *bname, int gid);
@@ -329,7 +329,7 @@ void my_talk(userinfo_t * uin, int fri_stat, char defact);
/* menu */
void showtitle(char *title, char *mid);
void movie(int i);
-void domenu(int cmdmode, char *cmdtitle, int cmd, commands_t cmdtable[]);
+void domenu(int cmdmode, char *cmdtitle, int cmd, const commands_t cmdtable[]);
int admin(void);
int Mail(void);
int Talk(void);
@@ -373,7 +373,7 @@ int othello_main(void);
int main_railway(void);
/* read */
-void i_read(int cmdmode, char *direct, void (*dotitle)(), void (*doentry)(), onekey_t *rcmdlist, int bidcache);
+void i_read(int cmdmode, char *direct, void (*dotitle)(), void (*doentry)(), const onekey_t *rcmdlist, int bidcache);
void fixkeep(char *s, int first);
keeploc_t *getkeep(char *s, int def_topline, int def_cursline);
int Tagger(time_t chrono, int recno, int mode);
@@ -422,7 +422,7 @@ void clear(void);
void refresh(void);
void clrtobot(void);
void outmsg(char *msg);
-void prints(char *fmt, ...) GCC_CHECK_FORMAT(1,2);
+void prints(const char *fmt, ...) GCC_CHECK_FORMAT(1,2);
void region_scroll_up(int top, int bottom);
void outc(unsigned char ch);
void redoscr(void);
@@ -476,7 +476,7 @@ int dashl(char *fname);
char *subject(char *title);
void setdirpath(char *buf, char *direct, char *fname);
int str_checksum(char *str);
-void show_help(char *helptext[]);
+void show_help(char * const helptext[]);
int belong(char *filelist, char *key);
char *Cdatedate(time_t *clock);
void sethomeman(char *buf, char *userid);
diff --git a/mbbsd/admin.c b/mbbsd/admin.c
index cab03ee4..a1a879f7 100644
--- a/mbbsd/admin.c
+++ b/mbbsd/admin.c
@@ -216,7 +216,7 @@ bperm_msg(boardheader_t * board)
}
unsigned int
-setperms(unsigned int pbits, char *pstring[])
+setperms(unsigned int pbits, char * const pstring[])
{
register int i;
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index a48ad6af..27e93996 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -6,7 +6,7 @@
static int recommend(int ent, fileheader_t * fhdr, char *direct);
#ifdef ASSESS
-static char *badpost_reason[] = {
+static char * const badpost_reason[] = {
"廣告", "不當用辭", "人身攻擊"
};
#endif
@@ -2183,7 +2183,7 @@ good_post(int ent, fileheader_t * fhdr, char *direct)
}
/* help for board reading */
-static char *board_help[] = {
+static char * const board_help[] = {
"\0全功\能看板操作說明",
"\01基本命令",
"(p)(↑) 上移一篇文章 (^P/^O/^V)發表文章/競標/活動連署",
@@ -2302,7 +2302,7 @@ change_counting(int ent, fileheader_t * fhdr, char *direct)
/* 看板功能表 */
/* ----------------------------------------------------- */
/* onekey_size was defined in ../include/pttstruct.h, as ((int)'z') */
-onekey_t read_comms[] = {
+const onekey_t read_comms[] = {
show_filename, // Ctrl('A')
NULL, // Ctrl('B')
NULL, // Ctrl('C')
diff --git a/mbbsd/board.c b/mbbsd/board.c
index 0075e8ec..27ce6021 100644
--- a/mbbsd/board.c
+++ b/mbbsd/board.c
@@ -546,7 +546,7 @@ show_brdlist(int head, int clsflag, int newflag)
}
}
-static char *choosebrdhelp[] = {
+static char * const choosebrdhelp[] = {
"\0看板選單輔助說明",
"\01基本指令",
"(p)(↑)/(n)(↓)上一個看板 / 下一個看板",
diff --git a/mbbsd/chat.c b/mbbsd/chat.c
index 06f706c3..0d7192e9 100644
--- a/mbbsd/chat.c
+++ b/mbbsd/chat.c
@@ -255,7 +255,7 @@ typedef struct chat_command_t {
void (*cmdfunc) (); /* Pointer to function */
} chat_command_t;
-static chat_command_t chat_cmdtbl[] = {
+const static chat_command_t chat_cmdtbl[] = {
{"help", chat_help},
{"clear", chat_clear},
{"date", chat_date},
diff --git a/mbbsd/chc.c b/mbbsd/chc.c
index d80cf276..373b97a0 100644
--- a/mbbsd/chc.c
+++ b/mbbsd/chc.c
@@ -26,19 +26,19 @@ static chc_act_list *act_list = NULL;
/* some constant variable definition */
-static const char *turn_str[2] = {"黑的", "紅的"};
+static const char * const turn_str[2] = {"黑的", "紅的"};
-static const char *num_str[10] = {
+static const char * const num_str[10] = {
"", "一", "二", "三", "四", "五", "六", "七", "八", "九"
};
-static const char *chess_str[2][8] = {
+static const char * const chess_str[2][8] = {
/* 0 1 2 3 4 5 6 7 */
{" ", "將", "士", "象", "車", "馬", "包", "卒"},
{" ", "帥", "仕", "相", "車", "傌", "炮", "兵"}
};
-static const char *chess_brd[BRD_ROW * 2 - 1] = {
+static const char * const chess_brd[BRD_ROW * 2 - 1] = {
/* 0 1 2 3 4 5 6 7 8 */
"┌─┬─┬─┬─┬─┬─┬─┬─┐", /* 0 */
"│ │ │ │\│/│ │ │ │",
@@ -61,7 +61,7 @@ static const char *chess_brd[BRD_ROW * 2 - 1] = {
"└─┴─┴─┴─┴─┴─┴─┴─┘" /* 9 */
};
-static char *hint_str[] = {
+static char * const hint_str[] = {
" q 認輸離開",
" p 要求和棋",
"方向鍵 移動遊標",
diff --git a/mbbsd/chicken.c b/mbbsd/chicken.c
index 17d6dad6..4050067c 100644
--- a/mbbsd/chicken.c
+++ b/mbbsd/chicken.c
@@ -3,16 +3,16 @@
#define NUM_KINDS 15 /* 有多少種動物 */
-static const char *cage[17] = {
+static const char * const cage[17] = {
"誕生", "週歲", "幼年", "少年", "青春", "青年",
"青年", "活力", "壯年", "壯年", "壯年", "中年",
"中年", "老年", "老年", "老摳摳", "古希"};
-static const char *chicken_type[NUM_KINDS] = {
+static const char * const chicken_type[NUM_KINDS] = {
"小雞", "美少女", "勇士", "蜘蛛",
"恐龍", "老鷹", "貓", "蠟筆小新",
"狗狗", "惡魔", "忍者", "ㄚ扁",
"馬英九", "就可人", "羅莉"};
-static const char *chicken_food[NUM_KINDS] = {
+static const char * const chicken_food[NUM_KINDS] = {
"雞飼料", "營養厚片", "雞排便當", "死蝴蝶",
"屍體", "小雞", "貓餅乾", "小熊餅乾",
"寶錄", "靈氣", "飯團", "便當",
@@ -27,13 +27,13 @@ static const int food_price[NUM_KINDS] = {
12, 12, 5, 6,
5, 20, 15, 23,
23, 10, 19};
-static const char *attack_type[NUM_KINDS] = {
+static const char * const attack_type[NUM_KINDS] = {
"啄", "鞭打", "槌", "咬",
"撞擊", "啄", "抓", "踢",
"咬", "燃燒", "暗擊", "棍打",
"劍擊", "冷凍光線", "香吻一枚"};
-static const char *damage_degree[] = {
+static const char * const damage_degree[] = {
"蚊子似的", "騷癢似的", "小力的", "輕微的",
"有點疼的", "使力的", "傷人的", "重重的",
"使全力的", "惡狠狠的", "危險的", "瘋狂的",
diff --git a/mbbsd/dark.c b/mbbsd/dark.c
index e26dd890..c567cced 100644
--- a/mbbsd/dark.c
+++ b/mbbsd/dark.c
@@ -16,10 +16,10 @@ typedef struct cur {
static item brd[4][8];
static cur curr; /* 6 個 bytes */
-static char *rname[] = {"兵", "炮", "傌", "車", "相", "仕", "帥"};
-static char *bname[] = {"卒", "包", "馬", "車", "象", "士", "將"};
+static char * const rname[] = {"兵", "炮", "傌", "車", "相", "仕", "帥"};
+static char * const bname[] = {"卒", "包", "馬", "車", "象", "士", "將"};
-static sint cury[] = {3, 5, 7, 9}, curx[] = {5, 9, 13, 17, 21, 25, 29, 33};
+const static sint cury[] = {3, 5, 7, 9}, curx[] = {5, 9, 13, 17, 21, 25, 29, 33};
static sint rcount, bcount, cont, fix; /* cont:是否可連吃 */
static sint my = 0, mx = 0, mly = -1, mlx = -1; /* 移動的座標 標 */
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index 4950598f..e420b584 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -396,7 +396,7 @@ insert_char(int ch)
}
static void
-insert_string(char *str)
+insert_string(const char *str)
{
int ch;
diff --git a/mbbsd/friend.c b/mbbsd/friend.c
index 92977969..3826e379 100644
--- a/mbbsd/friend.c
+++ b/mbbsd/friend.c
@@ -10,7 +10,7 @@ char special_list[] = "list.0";
char special_des[] = "ldes.0";
/* 特別名單的上限 */
-static unsigned int friend_max[8] = {
+const static unsigned int friend_max[8] = {
MAX_FRIEND,
MAX_REJECT,
MAX_LOGIN_INFO,
@@ -24,7 +24,7 @@ static unsigned int friend_max[8] = {
/* Ptt 各種特別名單的補述 */
-static char *friend_desc[8] = {
+static char * const friend_desc[8] = {
"友誼描述:",
"惡形惡狀:",
"",
@@ -36,7 +36,7 @@ static char *friend_desc[8] = {
};
/* Ptt 各種特別名單的中文敘述 */
-static char *friend_list[8] = {
+static char * const friend_list[8] = {
"好友名單",
"壞人名單",
"上線通知",
diff --git a/mbbsd/gomo.c b/mbbsd/gomo.c
index 31583d1d..78d6cab5 100644
--- a/mbbsd/gomo.c
+++ b/mbbsd/gomo.c
@@ -3,7 +3,7 @@
#define QCAST int (*)(const void *, const void *)
-static char *chess[] = {"●", "○"};
+static char * const chess[] = {"●", "○"};
static int tick, lastcount, mylasttick, hislasttick;
typedef struct {
diff --git a/mbbsd/io.c b/mbbsd/io.c
index c672e895..584faa29 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -411,7 +411,7 @@ int
strip_ansi(char *buf, char *str, int mode)
{
register int count = 0;
- static char EscapeFlag[] = {
+ const static char EscapeFlag[] = {
/* 0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 10 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ,0, 0, 0, 0, 0,
/* 20 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index b8da8226..cf353893 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -987,7 +987,7 @@ mail_mark(int ent, fileheader_t * fhdr, char *direct)
}
/* help for mail reading */
-static char *mail_help[] = {
+static char * const mail_help[] = {
"\0電子信箱操作說明",
"\01基本命令",
"(p)(↑) 前一篇文章",
@@ -1270,7 +1270,7 @@ mail_waterball(int ent, fileheader_t * fhdr, char *direct)
return FULLUPDATE;
}
#endif
-static onekey_t mail_comms[] = {
+const static onekey_t mail_comms[] = {
NULL, // Ctrl('A') 1
NULL, // Ctrl('B')
NULL, // Ctrl('C')
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 11c75d75..438a3294 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1075,13 +1075,13 @@ start_client()
static void
telnet_init()
{
- static char svr[] = {
+ const static char svr[] = {
IAC, DO, TELOPT_TTYPE,
IAC, SB, TELOPT_TTYPE, TELQUAL_SEND, IAC, SE,
IAC, WILL, TELOPT_ECHO,
IAC, WILL, TELOPT_SGA
};
- char *cmd;
+ const char *cmd;
int n, len;
struct timeval to;
char buf[64];
diff --git a/mbbsd/menu.c b/mbbsd/menu.c
index dc2fb8c7..ec6b1418 100644
--- a/mbbsd/menu.c
+++ b/mbbsd/menu.c
@@ -145,7 +145,7 @@ movie(int i)
}
static int
-show_menu(commands_t * p)
+show_menu(const commands_t * p)
{
register int n = 0;
register char *s;
@@ -167,7 +167,7 @@ show_menu(commands_t * p)
}
void
-domenu(int cmdmode, char *cmdtitle, int cmd, commands_t cmdtable[])
+domenu(int cmdmode, char *cmdtitle, int cmd, const commands_t cmdtable[])
{
int lastcmdptr;
int n, pos, total, i;
@@ -302,7 +302,7 @@ domenu(int cmdmode, char *cmdtitle, int cmd, commands_t cmdtable[])
/* INDENT OFF */
/* administrator's maintain menu */
-static commands_t adminlist[] = {
+const static commands_t adminlist[] = {
{m_user, PERM_ACCOUNTS, "UUser 使用者資料"},
{search_user_bypwd, PERM_SYSOP, "SSearch User 特殊搜尋使用者"},
{search_user_bybakpwd,PERM_SYSOP, "OOld User data 查閱\備份使用者資料"},
@@ -322,7 +322,7 @@ static commands_t adminlist[] = {
};
/* mail menu */
-static commands_t maillist[] = {
+const static commands_t maillist[] = {
{m_new, PERM_READMAIL, "RNew 閱\讀新進郵件"},
{m_read, PERM_READMAIL, "RRead 多功\能讀信選單"},
{m_send, PERM_BASIC, "RSend 站內寄信"},
@@ -338,7 +338,7 @@ static commands_t maillist[] = {
};
/* Talk menu */
-static commands_t talklist[] = {
+const static commands_t talklist[] = {
{t_users, 0, "UUsers 完全聊天手冊"},
{t_pager, PERM_BASIC, "PPager 切換呼叫器"},
{t_idle, 0, "IIdle 發呆"},
@@ -364,7 +364,7 @@ static int t_special() {
return 0;
}
-static commands_t namelist[] = {
+const static commands_t namelist[] = {
{t_override, PERM_LOGINOK,"OOverRide 好友名單"},
{t_reject, PERM_LOGINOK, "BBlack 壞人名單"},
{t_aloha,PERM_LOGINOK, "AALOHA 上站通知名單"},
@@ -376,7 +376,7 @@ static commands_t namelist[] = {
};
/* User menu */
-static commands_t userlist[] = {
+const static commands_t userlist[] = {
{u_info, PERM_LOGINOK, "IInfo 設定個人資料與密碼"},
{calendar, PERM_LOGINOK, "CCalendar 個人行事曆"},
{u_editcalendar, PERM_LOGINOK, "CDEditCalendar 編輯個人行事曆"},
@@ -400,7 +400,7 @@ static commands_t userlist[] = {
};
/* XYZ tool menu */
-static commands_t xyzlist[] = {
+const static commands_t xyzlist[] = {
#ifdef HAVE_LICENSE
{x_gpl, 0, "LLicense GNU 使用執照"},
#endif
@@ -423,7 +423,7 @@ static commands_t xyzlist[] = {
};
/* Ptt money menu */
-static commands_t moneylist[] = {
+const static commands_t moneylist[] = {
{p_give, 0, "00Give 給其他人錢"},
{save_violatelaw, 0,"11ViolateLaw 繳罰單"},
#if !HAVE_FREECLOAK
@@ -441,7 +441,7 @@ static int p_money() {
};
#if 0
-static commands_t jceelist[] = {
+const static commands_t jceelist[] = {
{x_90,PERM_LOGINOK, "0090 JCEE 【90學年度大學聯招查榜系統】"},
{x_89,PERM_LOGINOK, "1189 JCEE 【89學年度大學聯招查榜系統】"},
{x_88,PERM_LOGINOK, "2288 JCEE 【88學年度大學聯招查榜系統】"},
@@ -461,7 +461,7 @@ static int playground();
static int chessroom();
/* Ptt Play menu */
-static commands_t playlist[] = {
+const static commands_t playlist[] = {
#if 0
#if HAVE_JCEE
{m_jcee, PERM_LOGINOK, "JJCEE 【 大學聯考查榜系統 】"},
@@ -481,7 +481,7 @@ static commands_t playlist[] = {
{NULL, 0, NULL}
};
-static commands_t chesslist[] = {
+const static commands_t chesslist[] = {
{chc_main, PERM_LOGINOK, "1ChessFight 【\033[1;33m 邀 局 \033[m】"},
{chc_personal, PERM_LOGINOK, "2SelfPlay 【\033[1;34m 打 譜 \033[m】"},
{chc_watch, PERM_LOGINOK, "3ChessWatch 【\033[1;35m 觀 棋 \033[m】"},
@@ -493,7 +493,7 @@ static int chessroom() {
return 0;
}
-static commands_t plist[] = {
+const static commands_t plist[] = {
/* {p_ticket_main, PERM_LOGINOK,"00Pre 【 總統機 】"},
{alive, PERM_LOGINOK, "00Alive 【 訂票雞 】"},
@@ -514,7 +514,7 @@ static int playground() {
return 0;
}
-static commands_t slist[] = {
+const static commands_t slist[] = {
{x_dict,0, "11Dictionary "
"【\033[1;33m 趣味大字典 \033[m】"},
{x_mrtmap, 0, "22MRTmap "
diff --git a/mbbsd/more.c b/mbbsd/more.c
index c55d6220..9718be20 100644
--- a/mbbsd/more.c
+++ b/mbbsd/more.c
@@ -8,7 +8,7 @@ static int more_base, more_size, more_head;
static unsigned char more_pool[MORE_BUFSIZE];
-static char *more_help[] = {
+static char * const more_help[] = {
"\0閱\讀文章功\能鍵使用說明",
"\01游標移動功\能鍵",
"(↑) 上捲一行",
diff --git a/mbbsd/name.c b/mbbsd/name.c
index 3bd184ad..6ee8849f 100644
--- a/mbbsd/name.c
+++ b/mbbsd/name.c
@@ -2,7 +2,7 @@
#include "bbs.h"
static word_t *current = NULL;
-static char *msg_more = "-- More --";
+static char * const msg_more = "-- More --";
typedef char (*arrptr)[];
/* name complete for user ID */
diff --git a/mbbsd/othello.c b/mbbsd/othello.c
index eba90375..0eac4441 100644
--- a/mbbsd/othello.c
+++ b/mbbsd/othello.c
@@ -21,9 +21,9 @@
#define INVERT(COLOR) (((COLOR))==WHITE?BLACK:WHITE)
static char nowx = 3, nowy = 3;
-static char *CHESS_TYPE[] = {NONE_CHESS, HINT_CHESS, BLACK_CHESS, WHITE_CHESS};
-static char DIRX[] = {-1, -1, -1, 0, 1, 1, 1, 0};
-static char DIRY[] = {-1, 0, 1, 1, 1, 0, -1, -1};
+const static char *CHESS_TYPE[] = {NONE_CHESS, HINT_CHESS, BLACK_CHESS, WHITE_CHESS};
+const static char DIRX[] = {-1, -1, -1, 0, 1, 1, 1, 0};
+const static char DIRY[] = {-1, 0, 1, 1, 1, 0, -1, -1};
static char number[2];
static char pass = 0;
@@ -41,7 +41,7 @@ static char nowboard[10][10] =
{-1, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, -1},
{-1, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, -1},
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}};
-static char init_table[NR_TABLE + 1][5][5] = {
+const static char init_table[NR_TABLE + 1][5][5] = {
{{0, 0, 0, 0, 0},
{0, 30, -3, 2, 2},
{0, -3, -3, -1, -1},
diff --git a/mbbsd/page.c b/mbbsd/page.c
index 1757412f..ce6e6ea8 100644
--- a/mbbsd/page.c
+++ b/mbbsd/page.c
@@ -5,7 +5,7 @@
#define TITLE "\033[1;37;45m 火車查詢系統 \033[1;44;33m原作者:Heat\033[m"
static void
-print_station(const char *addr[6][100], int path, int *line, int *num)
+print_station(const char * const addr[6][100], int path, int *line, int *num)
{
int i;
@@ -30,7 +30,7 @@ main_railway()
int line, station_num;
char tt[2], type[2];
char command[256], buf[8];
- static const char *addr[6][100] = {
+ static const char * const addr[6][100] = {
{
"基隆", "八堵", "七堵", "五堵", "汐止", "南港", "松山", "台北", "萬華",
"板橋", "樹林", "山佳", "鶯歌", "桃園", "內壢", "中壢", "埔心", "楊梅",
diff --git a/mbbsd/read.c b/mbbsd/read.c
index f4c2a4b2..2ead1834 100644
--- a/mbbsd/read.c
+++ b/mbbsd/read.c
@@ -433,7 +433,7 @@ select_read(keeploc_t * locmem, int sr_mode)
}
static int
-i_read_key(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;
@@ -746,7 +746,7 @@ get_records_and_bottom(char *direct, fileheader_t* headers,
void
i_read(int cmdmode, char *direct, void (*dotitle) (),
- void (*doentry) (), onekey_t * rcmdlist, int bidcache)
+ void (*doentry) (), const onekey_t * rcmdlist, int bidcache)
{
keeploc_t *locmem = NULL;
int recbase = 0, mode;
diff --git a/mbbsd/screen.c b/mbbsd/screen.c
index c84a6a2d..22838b98 100644
--- a/mbbsd/screen.c
+++ b/mbbsd/screen.c
@@ -434,7 +434,7 @@ outmsg(char *msg)
}
void
-prints(char *fmt,...)
+prints(const char *fmt,...)
{
va_list args;
char buff[1024];
diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c
index 1381d61f..ed671596 100644
--- a/mbbsd/stuff.c
+++ b/mbbsd/stuff.c
@@ -669,7 +669,7 @@ log_file(char *fn, int flag, const char *fmt,...)
}
void
-show_help(char *helptext[])
+show_help(char * const helptext[])
{
char *str;
int i;
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 33e46ad4..7d5400ab 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -3,10 +3,10 @@
#define QCAST int (*)(const void *, const void *)
-static char *IdleTypeTable[] = {
+static char * const IdleTypeTable[] = {
"偶在花呆啦", "情人來電", "覓食中", "拜見周公", "假死狀態", "我在思考"
};
-static char *sig_des[] = {
+static char * const sig_des[] = {
"鬥雞", "聊天", "", "下棋", "象棋", "暗棋"
};
@@ -30,7 +30,7 @@ typedef struct pickup_t {
//
#define PICKUP_WAYS 7
-static char *fcolor[11] = {
+static char * const fcolor[11] = {
"", "\033[36m", "\033[32m", "\033[1;32m",
"\033[33m", "\033[1;33m", "\033[1;37m", "\033[1;37m",
"\033[31m", "\033[1;35m", "\033[1;36m"
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 3745309a..b8f1dc44 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -4,7 +4,7 @@
#include "bbs.h"
-static char *sex[8] = {
+static char * const sex[8] = {
MSG_BIG_BOY, MSG_BIG_GIRL, MSG_LITTLE_BOY, MSG_LITTLE_GIRL,
MSG_MAN, MSG_WOMAN, MSG_PLANT, MSG_MIME
};
diff --git a/mbbsd/var.c b/mbbsd/var.c
index c499663b..66d61e9e 100644
--- a/mbbsd/var.c
+++ b/mbbsd/var.c
@@ -2,7 +2,7 @@
#define INCLUDE_VAR_H
#include "bbs.h"
-char *str_permid[] = {
+char * const str_permid[] = {
"基本權力", /* PERM_BASIC */
"進入聊天室", /* PERM_CHAT */
"找人聊天", /* PERM_PAGE */
@@ -41,7 +41,7 @@ char *str_permid[] = {
"Ptt" /* PERM_PTT */
};
-char *str_permboard[] = {
+char * const str_permboard[] = {
"不可 Zap", /* BRD_NOZAP */
"不列入統計", /* BRD_NOCOUNT */
"不轉信", /* BRD_NOTRAN */
@@ -91,7 +91,7 @@ char vetitle[TTLEN + 1] = "\0";
char currauthor[IDLEN + 2] = "\0";
char *currboard = "\0";
char currBM[IDLEN * 3 + 10];
-char reset_color[4] = "\033[m";
+const char reset_color[4] = "\033[m";
char margs[64] = "\0"; /* main argv list */
pid_t currpid; /* current process ID */
time_t login_start_time;
@@ -125,7 +125,7 @@ char *fn_proverb = "proverb";
/* are descript in userec.loginview */
-char *loginview_file[NUMVIEWFILE][2] = {
+char * const loginview_file[NUMVIEWFILE][2] = {
{FN_NOTE_ANS, "酸甜苦辣流言板"},
{FN_TOPSONG, "點歌排行榜"},
{"etc/topusr", "十大排行榜"},
@@ -143,47 +143,47 @@ char *loginview_file[NUMVIEWFILE][2] = {
};
/* message */
-char *msg_seperator = MSG_SEPERATOR;
-char *msg_mailer = MSG_MAILER;
-char *msg_shortulist = MSG_SHORTULIST;
-
-char *msg_cancel = MSG_CANCEL;
-char *msg_usr_left = MSG_USR_LEFT;
-char *msg_nobody = MSG_NOBODY;
-
-char *msg_sure_ny = MSG_SURE_NY;
-char *msg_sure_yn = MSG_SURE_YN;
-
-char *msg_bid = MSG_BID;
-char *msg_uid = MSG_UID;
-
-char *msg_del_ok = MSG_DEL_OK;
-char *msg_del_ny = MSG_DEL_NY;
-
-char *msg_fwd_ok = MSG_FWD_OK;
-char *msg_fwd_err1 = MSG_FWD_ERR1;
-char *msg_fwd_err2 = MSG_FWD_ERR2;
-
-char *err_board_update = ERR_BOARD_UPDATE;
-char *err_bid = ERR_BID;
-char *err_uid = ERR_UID;
-char *err_filename = ERR_FILENAME;
-
-char *str_mail_address = "." BBSUSER "@" MYHOSTNAME;
-char *str_new = "new";
-char *str_reply = "Re: ";
-char *str_space = " \t\n\r";
-char *str_sysop = "SYSOP";
-char *str_author1 = STR_AUTHOR1;
-char *str_author2 = STR_AUTHOR2;
-char *str_post1 = STR_POST1;
-char *str_post2 = STR_POST2;
-char *BBSName = BBSNAME;
+char * const msg_seperator = MSG_SEPERATOR;
+char * const msg_mailer = MSG_MAILER;
+char * const msg_shortulist = MSG_SHORTULIST;
+
+char * const msg_cancel = MSG_CANCEL;
+char * const msg_usr_left = MSG_USR_LEFT;
+char * const msg_nobody = MSG_NOBODY;
+
+char * const msg_sure_ny = MSG_SURE_NY;
+char * const msg_sure_yn = MSG_SURE_YN;
+
+char * const msg_bid = MSG_BID;
+char * const msg_uid = MSG_UID;
+
+char * const msg_del_ok = MSG_DEL_OK;
+char * const msg_del_ny = MSG_DEL_NY;
+
+char * const msg_fwd_ok = MSG_FWD_OK;
+char * const msg_fwd_err1 = MSG_FWD_ERR1;
+char * const msg_fwd_err2 = MSG_FWD_ERR2;
+
+char * const err_board_update = ERR_BOARD_UPDATE;
+char * const err_bid = ERR_BID;
+char * const err_uid = ERR_UID;
+char * const err_filename = ERR_FILENAME;
+
+char * const str_mail_address = "." BBSUSER "@" MYHOSTNAME;
+char * const str_new = "new";
+char * const str_reply = "Re: ";
+char * const str_space = " \t\n\r";
+char * const str_sysop = "SYSOP";
+char * const str_author1 = STR_AUTHOR1;
+char * const str_author2 = STR_AUTHOR2;
+char * const str_post1 = STR_POST1;
+char * const str_post2 = STR_POST2;
+char * const BBSName = BBSNAME;
/* #define MAX_MODES 78 */
/* MAX_MODES is defined in common.h */
-char *ModeTypeTable[MAX_MODES] = {
+char * const ModeTypeTable[MAX_MODES] = {
"發呆", /* IDLE */
"主選單", /* MMENU */
"系統維護", /* ADMIN */
@@ -320,11 +320,11 @@ int b_lines = 23; // bottom line of screen
int t_lines = 24; // term lines
int p_lines = 20;
int t_columns = 80;
-char *strtstandout = "\33[7m";
+char * const strtstandout = "\33[7m";
int strtstandoutlen = 4;
-char *endstandout = "\33[m";
+char * const endstandout = "\33[m";
int endstandoutlen = 3;
-char *clearbuf = "\33[H\33[J";
+char * const clearbuf = "\33[H\33[J";
int clearbuflen = 6;
char *cleolbuf = "\33[K";
int cleolbuflen = 3;
@@ -408,7 +408,7 @@ char roll;
/* gomo.c */
char ku[BRDSIZ][BRDSIZ];
unsigned char *pat, *adv;
-unsigned char *pat_gomoku /* [1954] */ =
+unsigned char * const pat_gomoku /* [1954] */ =
/* 0 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
/* 16 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\x55\xcc\x00\x00\x00\x00"
/* 32 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x33\x00\x44\x00\x33\x00\x00\x00"
@@ -533,7 +533,7 @@ unsigned char *pat_gomoku /* [1954] */ =
/* 1936 */ "\x5a\xcc\x05\x05\x05\x05\x05\x05\x05\x06\x05\x05\x05\x0a\x05\x0a"
/* 1952 */ "\x0a";
-unsigned char *adv_gomoku /* [978] */ =
+unsigned char * const adv_gomoku /* [978] */ =
/* 0 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
/* 16 */ "\x00\x00\x00\x00\xa0\x00\xa0\x00\x04\x00\x04\x00\x00\xd0\x00\xd0"
/* 32 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -602,7 +602,7 @@ word_t *toplev;
#ifndef _BBS_UTIL_C_
/* menu.c */
-commands_t cmdlist[] = {
+const commands_t cmdlist[] = {
{admin, PERM_SYSOP | PERM_VIEWSYSOP, "00Admin 【 系統維護區 】"},
{Announce, 0, "AAnnounce 【 精華公佈欄 】"},
{Boards, 0, "FFavorite 【 我 的 最愛 】"},
@@ -625,7 +625,7 @@ char *friend_file[8] = {
FN_REJECT,
"alohaed",
"postlist",
- "",
+ "", /* may point to other filename */
FN_CANVOTE,
FN_WATER,
FN_VISABLE
diff --git a/mbbsd/vote.c b/mbbsd/vote.c
index 1f64ad1f..25341f00 100644
--- a/mbbsd/vote.c
+++ b/mbbsd/vote.c
@@ -3,13 +3,13 @@
#define MAX_VOTE_PAGE 5
-static char STR_bv_control[] = "control"; /* 投票日期 選項 */
-static char STR_bv_desc[] = "desc"; /* 投票目的 */
-static char STR_bv_ballots[] = "ballots";
-static char STR_bv_flags[] = "flags";
-static char STR_bv_comments[] = "comments"; /* 投票者的建議 */
-static char STR_bv_limited[] = "limited"; /* 私人投票 */
-static char STR_bv_title[] = "vtitle";
+static char *STR_bv_control = "control"; /* 投票日期 選項 */
+static char *STR_bv_desc = "desc"; /* 投票目的 */
+static char *STR_bv_ballots = "ballots";
+static char *STR_bv_flags = "flags";
+static char *STR_bv_comments = "comments"; /* 投票者的建議 */
+static char *STR_bv_limited = "limited"; /* 私人投票 */
+static char *STR_bv_title = "vtitle";
static char STR_bv_results[] = "results";