diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-06-04 04:48:54 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-06-04 04:48:54 +0800 |
commit | cfe2d30c2a8fb3a5c1e6b99c0b26bfd61fca520b (patch) | |
tree | 4dbd531777a74b9d4da86a2433db23795a79ac3e | |
parent | 6458d8379fc2bf2262ecc55f753aab70ea8a0ac4 (diff) | |
download | pttbbs-cfe2d30c2a8fb3a5c1e6b99c0b26bfd61fca520b.tar pttbbs-cfe2d30c2a8fb3a5c1e6b99c0b26bfd61fca520b.tar.gz pttbbs-cfe2d30c2a8fb3a5c1e6b99c0b26bfd61fca520b.tar.bz2 pttbbs-cfe2d30c2a8fb3a5c1e6b99c0b26bfd61fca520b.tar.lz pttbbs-cfe2d30c2a8fb3a5c1e6b99c0b26bfd61fca520b.tar.xz pttbbs-cfe2d30c2a8fb3a5c1e6b99c0b26bfd61fca520b.tar.zst pttbbs-cfe2d30c2a8fb3a5c1e6b99c0b26bfd61fca520b.zip |
use 'const' keyword to reduce 7904 bytes data segment
from 9320 to 1416
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2049 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | include/proto.h | 10 | ||||
-rw-r--r-- | mbbsd/admin.c | 2 | ||||
-rw-r--r-- | mbbsd/bbs.c | 6 | ||||
-rw-r--r-- | mbbsd/board.c | 2 | ||||
-rw-r--r-- | mbbsd/chat.c | 2 | ||||
-rw-r--r-- | mbbsd/chc.c | 10 | ||||
-rw-r--r-- | mbbsd/chicken.c | 10 | ||||
-rw-r--r-- | mbbsd/dark.c | 6 | ||||
-rw-r--r-- | mbbsd/edit.c | 2 | ||||
-rw-r--r-- | mbbsd/friend.c | 6 | ||||
-rw-r--r-- | mbbsd/gomo.c | 2 | ||||
-rw-r--r-- | mbbsd/io.c | 2 | ||||
-rw-r--r-- | mbbsd/mail.c | 4 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 4 | ||||
-rw-r--r-- | mbbsd/menu.c | 28 | ||||
-rw-r--r-- | mbbsd/more.c | 2 | ||||
-rw-r--r-- | mbbsd/name.c | 2 | ||||
-rw-r--r-- | mbbsd/othello.c | 8 | ||||
-rw-r--r-- | mbbsd/page.c | 4 | ||||
-rw-r--r-- | mbbsd/read.c | 4 | ||||
-rw-r--r-- | mbbsd/screen.c | 2 | ||||
-rw-r--r-- | mbbsd/stuff.c | 2 | ||||
-rw-r--r-- | mbbsd/talk.c | 6 | ||||
-rw-r--r-- | mbbsd/user.c | 2 | ||||
-rw-r--r-- | mbbsd/var.c | 96 | ||||
-rw-r--r-- | mbbsd/vote.c | 14 |
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[] = { "�s�i", "��������", "�H������" }; #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���\\��ݪO�ާ@����", "\01�R�O", "(p)(��) �W���@�g�峹 (^P/^O/^V)�o���峹/�v��/���ʳs�p", @@ -2302,7 +2302,7 @@ change_counting(int ent, fileheader_t * fhdr, char *direct) /* �ݪO�\��� */ /* ----------------------------------------------------- */ /* 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�ݪO��滲�U����", "\01���O", "(p)(��)/(n)(��)�W�@�ӬݪO / �U�@�ӬݪO", 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] = { "", "�@", "�G", "�T", "�|", "��", "��", "�C", "�K", "�E" }; -static const char *chess_str[2][8] = { +static const char * const chess_str[2][8] = { /* 0 1 2 3 4 5 6 7 */ {" ", "�N", "�h", "�H", "��", "��", "�]", "��"}, {" ", "��", "�K", "��", "��", "�X", "��", "�L"} }; -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 */ "�z�w�s�w�s�w�s�w�s�w�s�w�s�w�s�w�{", /* 0 */ "�x �x �x �x�@�x���x �x �x �x", @@ -61,7 +61,7 @@ static const char *chess_brd[BRD_ROW * 2 - 1] = { "�|�w�r�w�r�w�r�w�r�w�r�w�r�w�r�w�}" /* 9 */ }; -static char *hint_str[] = { +static char * const hint_str[] = { " q �{�����}", " p �n�D�M��", "��V�� ���ʹC��", 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 /* ���h�ֺذʪ� */ -static const char *cage[17] = { +static const char * const cage[17] = { "�ϥ�", "�g��", "���~", "�֦~", "�C�K", "�C�~", "�C�~", "���O", "���~", "���~", "���~", "���~", "���~", "�Ѧ~", "�Ѧ~", "������", "�j��"}; -static const char *chicken_type[NUM_KINDS] = { +static const char * const chicken_type[NUM_KINDS] = { "�p��", "���֤k", "�i�h", "�j��", "���s", "���N", "��", "�����p�s", "����", "�c�]", "�Ԫ�", "����", "���^�E", "�N�i�H", "ù��"}; -static const char *chicken_food[NUM_KINDS] = { +static const char * const chicken_food[NUM_KINDS] = { "���}��", "��i�p��", "���ƫK��", "������", "����", "�p��", "�氮", "�p���氮", "�_��", "�F��", "����", "�K��", @@ -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] = { "��", "�@��", "�l", "�r", "����", "��", "��", "��", "�r", "�U�N", "�t��", "�ҥ�", "�C��", "�N����u", "���k�@�T"}; -static const char *damage_degree[] = { +static const char * const damage_degree[] = { "�A�l����", "���o����", "�p�O��", "���L��", "���I�k��", "�ϤO��", "�ˤH��", "������", "�ϥ��O��", "�c������", "�M�I��", "�ƨg��", 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[] = {"�L", "��", "�X", "��", "��", "�K", "��"}; -static char *bname[] = {"��", "�]", "��", "��", "�H", "�h", "�N"}; +static char * const rname[] = {"�L", "��", "�X", "��", "��", "�K", "��"}; +static char * const bname[] = {"��", "�]", "��", "��", "�H", "�h", "�N"}; -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:�O�_�i�s�Y */ static sint my = 0, mx = 0, mly = -1, mlx = -1; /* ���ʪ��y�� �� */ 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"; /* �S�O�W�檺�W�� */ -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 �U�دS�O�W�檺�ɭz */ -static char *friend_desc[8] = { +static char * const friend_desc[8] = { "�ͽ˴y�z�G", "�c�δc���G", "", @@ -36,7 +36,7 @@ static char *friend_desc[8] = { }; /* Ptt �U�دS�O�W�檺����ԭz */ -static char *friend_list[8] = { +static char * const friend_list[8] = { "�n�ͦW��", "�a�H�W��", "�W�u�q��", 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 { @@ -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�q�l�H�c�ާ@����", "\01�R�O", "(p)(��) �e�@�g�峹", @@ -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 �S���j�M�ϥΪ�"}, {search_user_bybakpwd,PERM_SYSOP, "OOld User data �d�\\�ƥ��ϥΪ̸��"}, @@ -322,7 +322,7 @@ static commands_t adminlist[] = { }; /* mail menu */ -static commands_t maillist[] = { +const static commands_t maillist[] = { {m_new, PERM_READMAIL, "RNew �\\Ū�s�i�l��"}, {m_read, PERM_READMAIL, "RRead �h�\\��Ū�H���"}, {m_send, PERM_BASIC, "RSend �����H�H"}, @@ -338,7 +338,7 @@ static commands_t maillist[] = { }; /* Talk menu */ -static commands_t talklist[] = { +const static commands_t talklist[] = { {t_users, 0, "UUsers ������Ѥ�U"}, {t_pager, PERM_BASIC, "PPager �����I�s��"}, {t_idle, 0, "IIdle �o�b"}, @@ -364,7 +364,7 @@ static int t_special() { return 0; } -static commands_t namelist[] = { +const static commands_t namelist[] = { {t_override, PERM_LOGINOK,"OOverRide �n�ͦW��"}, {t_reject, PERM_LOGINOK, "BBlack �a�H�W��"}, {t_aloha,PERM_LOGINOK, "AALOHA �W���q���W��"}, @@ -376,7 +376,7 @@ static commands_t namelist[] = { }; /* User menu */ -static commands_t userlist[] = { +const static commands_t userlist[] = { {u_info, PERM_LOGINOK, "IInfo �]�w�ӤH��ƻP�K�X"}, {calendar, PERM_LOGINOK, "CCalendar �ӤH��ƾ�"}, {u_editcalendar, PERM_LOGINOK, "CDEditCalendar �s��ӤH��ƾ�"}, @@ -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 ����L�H��"}, {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 �i90�Ǧ~�פj���p�۬d�]�t�Ρj"}, {x_89,PERM_LOGINOK, "1189 JCEE �i89�Ǧ~�פj���p�۬d�]�t�Ρj"}, {x_88,PERM_LOGINOK, "2288 JCEE �i88�Ǧ~�פj���p�۬d�]�t�Ρj"}, @@ -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 �i �j���p�Ҭd�]�t�� �j"}, @@ -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 �i\033[1;33m �� �� \033[m�j"}, {chc_personal, PERM_LOGINOK, "2SelfPlay �i\033[1;34m �� �� \033[m�j"}, {chc_watch, PERM_LOGINOK, "3ChessWatch �i\033[1;35m �[ �� \033[m�j"}, @@ -493,7 +493,7 @@ static int chessroom() { return 0; } -static commands_t plist[] = { +const static commands_t plist[] = { /* {p_ticket_main, PERM_LOGINOK,"00Pre �i �`�ξ� �j"}, {alive, PERM_LOGINOK, "00Alive �i �q���� �j"}, @@ -514,7 +514,7 @@ static int playground() { return 0; } -static commands_t slist[] = { +const static commands_t slist[] = { {x_dict,0, "11Dictionary " "�i\033[1;33m ����j�r�� \033[m�j"}, {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��в��ʥ\\����", "(��) �W���@��", 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 �����d�ߨt�� \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] = { { "��", "�K��", "�C��", "����", "����", "�n��", "�Q�s", "�x�_", "�U��", "�O��", "��L", "�s��", "�a�q", "���", "���c", "���c", "�H��", "����", 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[] = { "���b��b��", "���H�ӹq", "�V����", "�����P��", "�������A", "�ڦb���" }; -static char *sig_des[] = { +static char * const sig_des[] = { "����", "���", "", "�U��", "�H��", "�t��" }; @@ -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[] = { "���v�O", /* PERM_BASIC */ "�i�J��ѫ�", /* PERM_CHAT */ "��H���", /* PERM_PAGE */ @@ -41,7 +41,7 @@ char *str_permid[] = { "�ޢ���" /* PERM_PTT */ }; -char *str_permboard[] = { +char * const str_permboard[] = { "���i Zap", /* BRD_NOZAP */ "���C�J�έp", /* BRD_NOCOUNT */ "����H", /* 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, "�IJ��W���y���O"}, {FN_TOPSONG, "�I�q�Ʀ�]"}, {"etc/topusr", "�Q�j�Ʀ�]"}, @@ -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] = { "�o�b", /* IDLE */ "�D���", /* MMENU */ "�t�κ��@", /* 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 �i �t�κ��@�� �j"}, {Announce, 0, "AAnnounce �i ��ؤ��G�� �j"}, {Boards, 0, "FFavorite �i �� �� �̷R �j"}, @@ -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"; /* �벼�̪���ij */ -static char STR_bv_limited[] = "limited"; /* �p�H�벼 */ -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"; /* �벼�̪���ij */ +static char *STR_bv_limited = "limited"; /* �p�H�벼 */ +static char *STR_bv_title = "vtitle"; static char STR_bv_results[] = "results"; |