diff options
author | jack <jack@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-05-14 05:14:09 +0800 |
---|---|---|
committer | jack <jack@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-05-14 05:14:09 +0800 |
commit | 141aead11424b045ffa3fbee4d1909e38023f3d8 (patch) | |
tree | 5331db656e463473c946ae937834d004454051cd | |
parent | ca9e454af4d8cc270abd65cf4d34a74b640ac041 (diff) | |
download | pttbbs-Jaky.i18n.tar pttbbs-Jaky.i18n.tar.gz pttbbs-Jaky.i18n.tar.bz2 pttbbs-Jaky.i18n.tar.lz pttbbs-Jaky.i18n.tar.xz pttbbs-Jaky.i18n.tar.zst pttbbs-Jaky.i18n.zip |
Merged with trunk versionJaky.i18n
git-svn-id: http://opensvn.csie.org/pttbbs/branches/Jaky.i18n@1979 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/admin.c | 320 | ||||
-rw-r--r-- | mbbsd/announce.c | 142 | ||||
-rw-r--r-- | mbbsd/bbs.c | 493 | ||||
-rw-r--r-- | mbbsd/board.c | 308 | ||||
-rw-r--r-- | mbbsd/cache.c | 6 | ||||
-rw-r--r-- | mbbsd/cal.c | 98 | ||||
-rw-r--r-- | mbbsd/calendar.c | 8 | ||||
-rw-r--r-- | mbbsd/card.c | 112 | ||||
-rw-r--r-- | mbbsd/chat.c | 92 | ||||
-rw-r--r-- | mbbsd/chc.c | 66 | ||||
-rw-r--r-- | mbbsd/chicken.c | 146 | ||||
-rw-r--r-- | mbbsd/dark.c | 56 | ||||
-rw-r--r-- | mbbsd/dice.c | 122 | ||||
-rw-r--r-- | mbbsd/edit.c | 108 | ||||
-rw-r--r-- | mbbsd/fav.c | 5 | ||||
-rw-r--r-- | mbbsd/friend.c | 38 | ||||
-rw-r--r-- | mbbsd/gamble.c | 70 | ||||
-rw-r--r-- | mbbsd/gomo.c | 58 | ||||
-rw-r--r-- | mbbsd/guess.c | 80 | ||||
-rw-r--r-- | mbbsd/indict.c | 30 | ||||
-rw-r--r-- | mbbsd/lovepaper.c | 12 | ||||
-rw-r--r-- | mbbsd/mail.c | 260 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 66 | ||||
-rw-r--r-- | mbbsd/menu.c | 70 | ||||
-rw-r--r-- | mbbsd/more.c | 23 | ||||
-rw-r--r-- | mbbsd/name.c | 7 | ||||
-rw-r--r-- | mbbsd/othello.c | 82 | ||||
-rw-r--r-- | mbbsd/read.c | 11 | ||||
-rw-r--r-- | mbbsd/record.c | 4 | ||||
-rw-r--r-- | mbbsd/register.c | 45 | ||||
-rw-r--r-- | mbbsd/stuff.c | 50 | ||||
-rw-r--r-- | mbbsd/syspost.c | 42 | ||||
-rw-r--r-- | mbbsd/talk.c | 325 | ||||
-rw-r--r-- | mbbsd/topsong.c | 2 | ||||
-rw-r--r-- | mbbsd/user.c | 433 | ||||
-rw-r--r-- | mbbsd/var.c | 3 | ||||
-rw-r--r-- | mbbsd/vice.c | 10 | ||||
-rw-r--r-- | mbbsd/vote.c | 106 | ||||
-rw-r--r-- | mbbsd/voteboard.c | 160 | ||||
-rw-r--r-- | mbbsd/xyz.c | 48 |
40 files changed, 2111 insertions, 2006 deletions
diff --git a/mbbsd/admin.c b/mbbsd/admin.c index 30a2fd65..dc0f9cec 100644 --- a/mbbsd/admin.c +++ b/mbbsd/admin.c @@ -10,16 +10,16 @@ m_loginmsg() clrtobot(); if(SHM->loginmsg.pid && SHM->loginmsg.pid != currutmp->pid) { - prints(I18N[0]); + prints(gettext[0]); getmessage(SHM->loginmsg); } getdata(22, 0, - I18N[1], + gettext[1], msg, 3, LCECHO); if(msg[0]=='y' && - getdata_str(23, 0, I18N[2], msg, 56, DOECHO, SHM->loginmsg.last_call_in)) + getdata_str(23, 0, gettext[2], msg, 56, DOECHO, SHM->loginmsg.last_call_in)) { SHM->loginmsg.pid=currutmp->pid; /*站長不多 就不管race condition */ strcpy(SHM->loginmsg.last_call_in, msg); @@ -36,7 +36,7 @@ m_user() int id; char genbuf[200]; - stand_title(I18N[3]); + stand_title(gettext[3]); usercomplete(msg_uid, genbuf); if (*genbuf) { move(2, 0); @@ -66,13 +66,13 @@ search_key_user(char *passwdfile, int mode) assert(fp1); clear(); - getdata(0, 0, mode ? I18N[4] : I18N[5], key, sizeof(key), DOECHO); + getdata(0, 0, mode ? gettext[4] : gettext[5], key, sizeof(key), DOECHO); if(!key[0]) return 0; while ((fread(&user, sizeof(user), 1, fp1)) > 0 && coun < MAX_USERS) { if (!(++coun & 15)) { move(1, 0); - prints(I18N[6], coun); + prints(gettext[6], coun); refresh(); } keymatch = NULL; @@ -98,15 +98,15 @@ search_key_user(char *passwdfile, int mode) } if(keymatch) { move(1, 0); - prints(I18N[7], coun); + prints(gettext[7], coun); refresh(); user_display(&user, 1); uinfo_query(&user, 1, coun); - outs(I18N[8]); + outs(gettext[8]); outs(mode ? " A: add to namelist \033[m " : - I18N[9]); + gettext[9]); while (1) { while ((ch = igetch()) == 0); if (ch == 'a' || ch=='A' ) @@ -132,26 +132,25 @@ search_key_user(char *passwdfile, int mode) fclose(fp1); return 0; } else { - move(b_lines - 1, 0); getdata(0, 0, - I18N[10], + gettext[10], genbuf, 3, LCECHO); if (genbuf[0] != 'y') { - outs(I18N[11]); + outs(gettext[11]); } else { int allocid = getnewuserid(); if (allocid > MAX_USERS || allocid <= 0) { - fprintf(stderr, I18N[12]); + fprintf(stderr, gettext[12]); exit(1); } if (passwd_update(allocid, &user) == -1) { - fprintf(stderr, I18N[13]); + fprintf(stderr, gettext[13]); exit(1); } setuserid(allocid, user.userid); if (!searchuser(user.userid)) { - fprintf(stderr, I18N[14]); + fprintf(stderr, gettext[14]); exit(1); } fclose(fp1); @@ -188,13 +187,13 @@ search_user_bybakpwd() clear(); move(1, 1); - outs(I18N[15]); - outs(I18N[16]); - outs(I18N[17]); - outs(I18N[18]); + outs(gettext[15]); + outs(gettext[16]); + outs(gettext[17]); + outs(gettext[18]); do { move(5, 1); - outs(I18N[19]); + outs(gettext[19]); ch = igetch(); if (ch == 'q' || ch == 'Q') return 0; @@ -207,8 +206,8 @@ search_user_bybakpwd() static void bperm_msg(boardheader_t * board) { - prints(I18N[20], board->brdname, - board->brdattr & BRD_POSTMASK ? I18N[21] : I18N[22]); + prints(gettext[20], board->brdname, + board->brdattr & BRD_POSTMASK ? gettext[21] : gettext[22]); } unsigned int @@ -220,15 +219,15 @@ setperms(unsigned int pbits, int *pstring) move(4, 0); for (i = 0; i < NUMPERMS / 2; i++) { prints("%c. %-20s %-15s %c. %-20s %s\n", - 'A' + i, I18N[pstring[i]], - ((pbits >> i) & 1 ? I18N[23] : I18N[24]), + 'A' + i, gettext[pstring[i]], + ((pbits >> i) & 1 ? gettext[23] : gettext[24]), i < 10 ? 'Q' + i : '0' + i - 10, - I18N[pstring[i + 16]], - ((pbits >> (i + 16)) & 1 ? I18N[25] : I18N[26])); + gettext[pstring[i + 16]], + ((pbits >> (i + 16)) & 1 ? gettext[25] : gettext[26])); } clrtobot(); while( - (i = getkey(I18N[27]))!='\r') + (i = getkey(gettext[27]))!='\r') { i = i - 'a'; if (i < 0) @@ -238,7 +237,7 @@ setperms(unsigned int pbits, int *pstring) else { pbits ^= (1 << i); move(i % 16 + 4, i <= 15 ? 24 : 64); - prints((pbits >> i) & 1 ? I18N[28] : I18N[29]); + prints((pbits >> i) & 1 ? gettext[28] : gettext[29]); } } return pbits; @@ -259,7 +258,7 @@ void delete_symbolic_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); } @@ -276,14 +275,14 @@ m_mod_board(char *bname) pressanykey(); return -1; } - prints(I18N[30], bh.brdname, bh.title, bid, bh.gid, bh.BM); + prints(gettext[30], bh.brdname, bh.title, bid, bh.gid, bh.BM); bperm_msg(&bh); /* Ptt 這邊斷行會檔到下面 */ move(9, 0); - snprintf(genbuf, sizeof(genbuf), I18N[31], - HAS_PERM(PERM_SYSOP) ? I18N[32] : "", - HAS_PERM(PERM_SYSSUBOP) ? I18N[33] : ""); + snprintf(genbuf, sizeof(genbuf), gettext[31], + HAS_PERM(PERM_SYSOP) ? gettext[32] : "", + HAS_PERM(PERM_SYSSUBOP) ? gettext[33] : ""); getdata(10, 0, genbuf, ans, sizeof(ans), LCECHO); switch (*ans) { @@ -310,8 +309,8 @@ m_mod_board(char *bname) memcpy(&newbh, &bh, sizeof(bh)); snprintf(bvotebuf, sizeof(bvotebuf), "%d", newbh.bvote); move(20, 0); - prints(I18N[34], bh.brdname, bh.bvote); - getdata_str(21, 0, I18N[35], genbuf, 5, LCECHO, bvotebuf); + prints(gettext[34], bh.brdname, bh.bvote); + getdata_str(21, 0, gettext[35], genbuf, 5, LCECHO, bvotebuf); newbh.bvote = atoi(genbuf); substitute_record(fn_board, &newbh, sizeof(newbh), bid); reset_board(bid); @@ -321,9 +320,9 @@ m_mod_board(char *bname) break; case 'v': memcpy(&newbh, &bh, sizeof(bh)); - outs(I18N[36]); - outs((bh.brdattr & BRD_BAD) ? I18N[37] : I18N[38]); - getdata(21, 0, I18N[39], genbuf, 5, LCECHO); + outs(gettext[36]); + outs((bh.brdattr & BRD_BAD) ? gettext[37] : gettext[38]); + getdata(21, 0, gettext[39], genbuf, 5, LCECHO); if (genbuf[0] == 'y') { if (newbh.brdattr & BRD_BAD) newbh.brdattr = newbh.brdattr & (!BRD_BAD); @@ -352,24 +351,24 @@ m_mod_board(char *bname) system(genbuf); memset(&bh, 0, sizeof(bh)); snprintf(bh.title, sizeof(bh.title), - I18N[40], bname, cuser.userid); - post_msg("Security", bh.title, I18N[41], I18N[42]); + gettext[40], bname, cuser.userid); + post_msg("Security", bh.title, gettext[41], gettext[42]); substitute_record(fn_board, &bh, sizeof(bh), bid); reset_board(bid); - sort_bcache(); + sort_bcache(); log_usies("DelBoard", bh.title); - outs(I18N[43]); + outs(gettext[43]); } break; case 'e': move(8, 0); - outs(I18N[44]); + outs(gettext[44]); memcpy(&newbh, &bh, sizeof(bh)); - while (getdata(9, 0, I18N[45], genbuf, IDLEN + 1, DOECHO)) { + while (getdata(9, 0, gettext[45], genbuf, IDLEN + 1, DOECHO)) { if (getbnum(genbuf)) { move(3, 0); - outs(I18N[46]); + outs(gettext[46]); } else if ( !invalid_brdname(genbuf) ){ strlcpy(newbh.brdname, genbuf, sizeof(newbh.brdname)); break; @@ -377,7 +376,7 @@ m_mod_board(char *bname) } do { - getdata_str(12, 0, I18N[47], genbuf, 5, DOECHO, bh.title); + getdata_str(12, 0, gettext[47], genbuf, 5, DOECHO, bh.title); if (strlen(genbuf) == 4) break; } while (1); @@ -387,11 +386,11 @@ m_mod_board(char *bname) newbh.title[4] = ' '; - getdata_str(14, 0, I18N[48], genbuf, BTLEN + 1, DOECHO, + getdata_str(14, 0, gettext[48], genbuf, BTLEN + 1, DOECHO, bh.title + 7); if (genbuf[0]) strlcpy(newbh.title + 7, genbuf, sizeof(newbh.title) - 7); - if (getdata_str(15, 0, I18N[49], genbuf, IDLEN * 3 + 3, DOECHO, + if (getdata_str(15, 0, gettext[49], genbuf, IDLEN * 3 + 3, DOECHO, bh.BM)) { trim(genbuf); strlcpy(newbh.BM, genbuf, sizeof(newbh.BM)); @@ -404,16 +403,16 @@ m_mod_board(char *bname) clrtobot(); } if (newbh.brdattr & BRD_GROUPBOARD) - strncpy(newbh.title + 5, I18N[50], 2); + strncpy(newbh.title + 5, gettext[50], 2); else if (newbh.brdattr & BRD_NOTRAN) - strncpy(newbh.title + 5, I18N[51], 2); + strncpy(newbh.title + 5, gettext[51], 2); else - strncpy(newbh.title + 5, I18N[52], 2); + strncpy(newbh.title + 5, gettext[52], 2); if (HAS_PERM(PERM_SYSOP) && !(newbh.brdattr & BRD_HIDE)) { - getdata_str(14, 0, I18N[53], ans, sizeof(ans), LCECHO, "N"); + getdata_str(14, 0, gettext[53], ans, sizeof(ans), LCECHO, "N"); if (*ans == 'y') { - getdata_str(15, 0, I18N[54], ans, sizeof(ans), LCECHO, + getdata_str(15, 0, gettext[54], ans, sizeof(ans), LCECHO, "R"); if (*ans == 'p') newbh.brdattr |= BRD_POSTMASK; @@ -427,7 +426,7 @@ m_mod_board(char *bname) clear(); } } - getdata(b_lines - 1, 0, I18N[55], genbuf, 4, LCECHO); + getdata(b_lines - 1, 0, gettext[55], genbuf, 4, LCECHO); if ((*genbuf != 'n') && memcmp(&newbh, &bh, sizeof(bh))) { if (strcmp(bh.brdname, newbh.brdname)) { @@ -444,7 +443,7 @@ m_mod_board(char *bname) setup_man(&newbh); substitute_record(fn_board, &newbh, sizeof(newbh), bid); reset_board(bid); - sort_bcache(); + sort_bcache(); log_usies("SetBoard", newbh.brdname); } } @@ -457,7 +456,7 @@ m_board() { char bname[32]; - stand_title(I18N[56]); + stand_title(gettext[56]); generalnamecomplete(msg_bid, bname, sizeof(bname), SHM->Bnumber, completeboard_compar, completeboard_permission, @@ -477,16 +476,16 @@ x_file() move(b_lines - 6, 0); /* Ptt */ - outs(I18N[57]); - outs(I18N[58]); - outs(I18N[59]); + outs(gettext[57]); + outs(gettext[58]); + outs(gettext[59]); #ifdef MULTI_WELCOME_LOGIN - outs(I18N[60]); + outs(gettext[60]); #endif outs("\n"); - outs(I18N[61]); - outs(I18N[62]); - getdata(b_lines - 1, 0, I18N[63], ans, sizeof(ans), LCECHO); + outs(gettext[61]); + outs(gettext[62]); + getdata(b_lines - 1, 0, gettext[63], ans, sizeof(ans), LCECHO); switch (ans[0]) { case '1': @@ -527,7 +526,7 @@ x_file() break; case 'g': #ifdef MULTI_WELCOME_LOGIN - getdata(b_lines - 1, 0, I18N[64], ans, sizeof(ans), LCECHO); + getdata(b_lines - 1, 0, gettext[64], ans, sizeof(ans), LCECHO); if (ans[0] == '1') { fpath = "etc/Welcome_login.1"; } else if (ans[0] == '2') { @@ -546,7 +545,7 @@ x_file() #ifdef MULTI_WELCOME_LOGIN case 'x': - getdata(b_lines - 1, 0, I18N[65], ans, sizeof(ans), LCECHO); + getdata(b_lines - 1, 0, gettext[65], ans, sizeof(ans), LCECHO); if (ans[0] == '1') { unlink("etc/Welcome_login.1"); outs("ok"); @@ -560,7 +559,7 @@ x_file() unlink("etc/Welcome_login.4"); outs("ok"); } else { - outs(I18N[66]); + outs(gettext[66]); } pressanykey(); return FULLUPDATE; @@ -592,8 +591,8 @@ x_file() return FULLUPDATE; } aborted = vedit(fpath, NA, NULL); - prints(I18N[67], fpath, - (aborted == -1) ? I18N[68] : I18N[69]); + prints(gettext[67], fpath, + (aborted == -1) ? gettext[68] : gettext[69]); pressanykey(); return FULLUPDATE; } @@ -604,7 +603,7 @@ static int add_board_record(boardheader_t *board) if ((bid = getbnum("")) > 0) { substitute_record(fn_board, board, sizeof(boardheader_t), bid); reset_board(bid); - sort_bcache(); + sort_bcache(); } else if (append_record(fn_board, (fileheader_t *)board, sizeof(boardheader_t)) == -1) { return -1; } else { @@ -620,13 +619,13 @@ m_newbrd(int recover) char ans[4]; char genbuf[200]; - stand_title(I18N[70]); + stand_title(gettext[70]); memset(&newboard, 0, sizeof(newboard)); newboard.gid = class_bid; if (newboard.gid == 0) { move(6, 0); - outs(I18N[71]); + outs(gettext[71]); pressanykey(); return -1; } @@ -637,7 +636,7 @@ m_newbrd(int recover) } while (invalid_brdname(newboard.brdname)); do { - getdata(6, 0, I18N[72], genbuf, 5, DOECHO); + getdata(6, 0, gettext[72], genbuf, 5, DOECHO); if (strlen(genbuf) == 4) break; } while (1); @@ -646,19 +645,19 @@ m_newbrd(int recover) newboard.title[4] = ' '; - getdata(8, 0, I18N[73], genbuf, BTLEN + 1, DOECHO); + getdata(8, 0, gettext[73], genbuf, BTLEN + 1, DOECHO); if (genbuf[0]) strlcpy(newboard.title + 7, genbuf, sizeof(newboard.title) - 7); setbpath(genbuf, newboard.brdname); if (recover) { if (dashd(genbuf)) { - outs(I18N[74]); + outs(gettext[74]); pressanykey(); return -1; } } else if (getbnum(newboard.brdname) > 0 || mkdir(genbuf, 0755) == -1) { - outs(I18N[75]); + outs(gettext[75]); pressanykey(); return -1; } @@ -671,24 +670,24 @@ m_newbrd(int recover) move(1, 0); clrtobot(); } - getdata(9, 0, I18N[76], genbuf, 3, LCECHO); + getdata(9, 0, gettext[76], genbuf, 3, LCECHO); if (genbuf[0] == 'n') newboard.brdattr |= BRD_GROUPBOARD; if (newboard.brdattr & BRD_GROUPBOARD) - strncpy(newboard.title + 5, I18N[77], 2); + strncpy(newboard.title + 5, gettext[77], 2); else if (newboard.brdattr & BRD_NOTRAN) - strncpy(newboard.title + 5, I18N[78], 2); + strncpy(newboard.title + 5, gettext[78], 2); else - strncpy(newboard.title + 5, I18N[79], 2); + strncpy(newboard.title + 5, gettext[79], 2); newboard.level = 0; - getdata(11, 0, I18N[80], newboard.BM, sizeof(newboard.BM), DOECHO); + getdata(11, 0, gettext[80], newboard.BM, sizeof(newboard.BM), DOECHO); if (HAS_PERM(PERM_SYSOP) && !(newboard.brdattr & BRD_HIDE)) { - getdata_str(14, 0, I18N[81], ans, sizeof(ans), LCECHO, "N"); + getdata_str(14, 0, gettext[81], ans, sizeof(ans), LCECHO, "N"); if (*ans == 'y') { - getdata_str(15, 0, I18N[82], ans, sizeof(ans), LCECHO, "R"); + getdata_str(15, 0, gettext[82], ans, sizeof(ans), LCECHO, "R"); if (*ans == 'p') newboard.brdattr |= BRD_POSTMASK; else @@ -707,7 +706,7 @@ m_newbrd(int recover) pressanykey(); setup_man(&newboard); - outs(I18N[83]); + outs(gettext[83]); post_newboard(newboard.title, newboard.brdname, newboard.BM); log_usies("NewBoard", newboard.title); pressanykey(); @@ -738,7 +737,7 @@ int make_symbolic_link(char *bname, int gid) strlcpy(newboard.brdname, bname, sizeof(newboard.brdname)); newboard.brdname[strlen(bname) - 1] = '~'; strlcpy(newboard.title, bcache[bid - 1].title, sizeof(newboard.title)); - strcpy(newboard.title + 5, I18N[84]); + strcpy(newboard.title + 5, gettext[84]); newboard.gid = gid; BRD_LINK_TARGET(&newboard) = bid; @@ -760,10 +759,10 @@ int make_symbolic_link_interactively(int gid) if (!buf[0]) return -1; - stand_title(I18N[85]); + stand_title(gettext[85]); if (make_symbolic_link(buf, gid) < 0) { - vmsg(I18N[86]); + vmsg(gettext[86]); return -1; } log_usies("NewSymbolic", buf); @@ -778,8 +777,8 @@ auto_scan(char fdata[][STRLEN], char ans[]) int i; char temp[10]; - if (!strncmp(fdata[2], I18N[87], 2) || strstr(fdata[2], I18N[88]) - || strstr(fdata[2], I18N[89]) || strstr(fdata[2], I18N[90])) { + if (!strncmp(fdata[2], gettext[87], 2) || strstr(fdata[2], gettext[88]) + || strstr(fdata[2], gettext[89]) || strstr(fdata[2], gettext[90])) { ans[0] = '0'; return 1; } @@ -792,17 +791,17 @@ auto_scan(char fdata[][STRLEN], char ans[]) return 1; } if (strlen(fdata[2]) >= 6) { - if (strstr(fdata[2], I18N[91])) { + if (strstr(fdata[2], gettext[91])) { ans[0] = '0'; return 1; } - if (strstr(I18N[92], temp)) + if (strstr(gettext[92], temp)) good++; - else if (strstr(I18N[93], temp)) + else if (strstr(gettext[93], temp)) good++; - else if (strstr(I18N[94], temp)) + else if (strstr(gettext[94], temp)) good++; - else if (strstr(I18N[95], temp)) + else if (strstr(gettext[95], temp)) good++; } if (!good) @@ -814,25 +813,25 @@ auto_scan(char fdata[][STRLEN], char ans[]) ans[0] = '4'; return 5; } - if (strstr(fdata[3], I18N[96])) { - if (strstr(fdata[3], I18N[97]) || strstr(fdata[3], I18N[98]) || - strstr(fdata[3], I18N[99]) || strstr(fdata[3], I18N[100]) || - strstr(fdata[3], I18N[101]) || strstr(fdata[3], I18N[102]) || - strstr(fdata[3], I18N[103]) || strstr(fdata[3], I18N[104]) || - strstr(fdata[3], I18N[105]) || strstr(fdata[3], I18N[106]) || - strstr(fdata[3], I18N[107]) || strstr(fdata[3], I18N[108])) + if (strstr(fdata[3], gettext[96])) { + if (strstr(fdata[3], gettext[97]) || strstr(fdata[3], gettext[98]) || + strstr(fdata[3], gettext[99]) || strstr(fdata[3], gettext[100]) || + strstr(fdata[3], gettext[101]) || strstr(fdata[3], gettext[102]) || + strstr(fdata[3], gettext[103]) || strstr(fdata[3], gettext[104]) || + strstr(fdata[3], gettext[105]) || strstr(fdata[3], gettext[106]) || + strstr(fdata[3], gettext[107]) || strstr(fdata[3], gettext[108])) good++; - } else if (strstr(fdata[3], I18N[109])) + } else if (strstr(fdata[3], gettext[109])) good++; - if (strstr(fdata[4], I18N[110]) || strstr(fdata[4], I18N[111]) || - strstr(fdata[4], I18N[112])) { + if (strstr(fdata[4], gettext[110]) || strstr(fdata[4], gettext[111]) || + strstr(fdata[4], gettext[112])) { ans[0] = '2'; return 3; } - if (strstr(fdata[4], I18N[113]) || strstr(fdata[4], I18N[114])) { - if (strstr(fdata[4], I18N[115]) || strstr(fdata[4], I18N[116])) { - if (strstr(fdata[4], I18N[117])) + if (strstr(fdata[4], gettext[113]) || strstr(fdata[4], gettext[114])) { + if (strstr(fdata[4], gettext[115]) || strstr(fdata[4], gettext[116])) { + if (strstr(fdata[4], gettext[117])) good++; } } @@ -864,17 +863,17 @@ scan_register_form(char *regfile, int automode, int neednum) "uid", "ident", "name", "career", "addr", "phone", "email", NULL }; char *finfo[] = { - I18N[118], I18N[119], I18N[120], I18N[121], I18N[122], - I18N[123], I18N[124], NULL + gettext[118], gettext[119], gettext[120], gettext[121], gettext[122], + gettext[123], gettext[124], NULL }; char *reason[] = { - I18N[125], - I18N[126], - I18N[127], - I18N[128], - I18N[129], - I18N[130], - I18N[131], + gettext[125], + gettext[126], + gettext[127], + gettext[128], + gettext[129], + gettext[130], + gettext[131], NULL }; char *autoid = "AutoScan"; @@ -891,22 +890,22 @@ scan_register_form(char *regfile, int automode, int neednum) move(2, 0); if (dashf(fname)) { if (neednum == 0) { /* 自己進 Admin 來審的 */ - outs(I18N[132]); + outs(gettext[132]); pressanykey(); } return -1; } Rename(regfile, fname); if ((fn = fopen(fname, "r")) == NULL) { - prints(I18N[133], fname); + prints(gettext[133], fname); pressanykey(); return -1; } if (neednum) { /* 被強迫審的 */ move(1, 0); clrtobot(); - prints(I18N[134], neednum); - prints(I18N[135]); + prints(gettext[134], neednum); + prints(gettext[135]); pressanykey(); } memset(fdata, 0, sizeof(fdata)); @@ -923,7 +922,7 @@ scan_register_form(char *regfile, int automode, int neednum) } else if ((unum = getuser(fdata[0])) == 0) { move(2, 0); clrtobot(); - outs(I18N[136]); + outs(gettext[136]); for (n = 0; field[n]; n++) prints("%s : %s\n", finfo[n], fdata[n]); pressanykey(); @@ -938,27 +937,27 @@ scan_register_form(char *regfile, int automode, int neednum) uid = cuser.userid; move(1, 0); - prints(I18N[137], unum); + prints(gettext[137], unum); user_display(&muser, 1); move(14, 0); - prints(I18N[138], neednum); - prints(I18N[139], finfo[0], fdata[0]); - prints(I18N[140], finfo[1], fdata[1]); + prints(gettext[138], neednum); + prints(gettext[139], finfo[0], fdata[0]); + prints(gettext[140], finfo[1], fdata[1]); #ifdef FOREIGN_REG - prints(I18N[141], finfo[2], fdata[2], muser.uflag2 & FOREIGN ? I18N[142] : ""); + prints(gettext[141], finfo[2], fdata[2], muser.uflag2 & FOREIGN ? gettext[142] : ""); #else - prints(I18N[143], finfo[2], fdata[2]); + prints(gettext[143], finfo[2], fdata[2]); #endif for (n = 3; field[n]; n++) { - prints(I18N[144], n - 2, finfo[n], fdata[n]); + prints(gettext[144], n - 2, finfo[n], fdata[n]); } if (muser.userlevel & PERM_LOGINOK) { - ans[0] = getkey(I18N[145]); + ans[0] = getkey(gettext[145]); if (ans[0] != 'y' && ans[0] != 's') ans[0] = 'd'; } else { if (search_ulist(unum) == NULL) - ans[0] = vmsg_lines(22, I18N[146]); + ans[0] = vmsg_lines(22, gettext[146]); else ans[0] = 's'; if ('A' <= ans[0] && ans[0] <= 'Z') @@ -974,7 +973,7 @@ scan_register_form(char *regfile, int automode, int neednum) if (neednum > 0 && ans[0] == 'q') { move(2, 0); clrtobot(); - prints(I18N[147]); + prints(gettext[147]); pressanykey(); ans[0] = 's'; } @@ -1000,13 +999,13 @@ scan_register_form(char *regfile, int automode, int neednum) for (n = 0; field[n]; n++) prints("%s: %s\n", finfo[n], fdata[n]); move(9, 0); - prints(I18N[148]); + prints(gettext[148]); for (n = 0; reason[n]; n++) - prints(I18N[149], n, reason[n]); + prints(gettext[149], n, reason[n]); } else buf[0] = ans[0]; if (ans[0] != 'n' || - getdata(10 + n, 0, I18N[150], buf, 60, DOECHO)) + getdata(10 + n, 0, gettext[150], buf, 60, DOECHO)) if ((buf[0] - '0') >= 0 && (buf[0] - '0') < n) { int i; fileheader_t mhdr; @@ -1016,7 +1015,7 @@ scan_register_form(char *regfile, int automode, int neednum) sethomepath(buf1, muser.userid); stampfile(buf1, &mhdr); strlcpy(mhdr.owner, cuser.userid, sizeof(mhdr.owner)); - strlcpy(mhdr.title, I18N[151], TTLEN); + strlcpy(mhdr.title, gettext[151], TTLEN); mhdr.filemode = 0; sethomedir(title, muser.userid); if (append_record(title, &mhdr, sizeof(mhdr)) != -1) { @@ -1026,7 +1025,7 @@ scan_register_form(char *regfile, int automode, int neednum) if (!isdigit(buf[i])) continue; snprintf(genbuf, sizeof(genbuf), - I18N[152], reason[buf[i] - '0']); + gettext[152], reason[buf[i] - '0']); fprintf(fp, "%s\n", genbuf); } @@ -1044,7 +1043,7 @@ scan_register_form(char *regfile, int automode, int neednum) } move(10, 0); clrtobot(); - prints(I18N[153]); + prints(gettext[153]); case 's': if ((freg = fopen(regfile, "a"))) { for (n = 0; field[n]; n++) @@ -1054,19 +1053,22 @@ scan_register_form(char *regfile, int automode, int neednum) } break; default: - prints(I18N[154]); - mail_muser(muser, I18N[155], "etc/registered"); + prints(gettext[154]); + mail_muser(muser, gettext[155], "etc/registered"); if(muser.uflag2 & FOREIGN) - mail_muser(muser, I18N[156], "etc/foreign_welcome"); + mail_muser(muser, gettext[156], "etc/foreign_welcome"); muser.userlevel |= (PERM_LOGINOK | PERM_POST); strlcpy(muser.realname, fdata[2], sizeof(muser.realname)); strlcpy(muser.address, fdata[4], sizeof(muser.address)); strlcpy(muser.email, fdata[6], sizeof(muser.email)); - strncpy(muser.justify, genbuf, REGLEN); - sethomefile(buf, muser.userid, "justify"); - log_file(buf, 1, "%s:%s:%s\n", fdata[5], fdata[3], uid); + snprintf(genbuf, sizeof(genbuf), "%s:%s:%s", + fdata[5], fdata[3], uid); + strlcpy(muser.justify, genbuf, sizeof(muser.justify)); passwd_update(unum, &muser); + sethomefile(buf, muser.userid, "justify"); + log_file(buf, LOG_CREAT, genbuf); + if ((fout = fopen(logfile, "a"))) { for (n = 0; field[n]; n++) fprintf(fout, "%s: %s\n", field[n], fdata[n]); @@ -1088,7 +1090,7 @@ scan_register_form(char *regfile, int automode, int neednum) clrtobot(); move(5, 0); - prints(I18N[157], nSelf, nAuto); + prints(gettext[157], nSelf, nAuto); /** DickG: 將審了幾份的相關資料 post 到 Security 板上 ***********/ /* @@ -1118,10 +1120,10 @@ m_register() char genbuf[200]; if ((fn = fopen(fn_register, "r")) == NULL) { - outs(I18N[158]); + outs(gettext[158]); return XEASY; } - stand_title(I18N[159]); + stand_title(gettext[159]); y = 2; x = wid = 0; @@ -1139,7 +1141,7 @@ m_register() } } fclose(fn); - getdata(b_lines - 1, 0, I18N[160], ans, sizeof(ans), LCECHO); + getdata(b_lines - 1, 0, gettext[160], ans, sizeof(ans), LCECHO); if (ans[0] == 'a') scan_register_form(fn_register, 1, 0); else if (ans[0] == 'y') @@ -1153,9 +1155,9 @@ cat_register() { if (system("cat register.new.tmp >> register.new") == 0 && system("rm -f register.new.tmp") == 0) - vmsg(I18N[161]); + vmsg(gettext[161]); else - vmsg(I18N[162]); + vmsg(gettext[162]); return 0; } @@ -1167,12 +1169,12 @@ give_id_money(char *user_id, int money, FILE * log_fp, char *mail_title, time_t if (deumoney(searchuser(user_id), money) < 0) { move(12, 0); clrtoeol(); - prints(I18N[163], user_id, money); + prints(gettext[163], user_id, money); pressanykey(); } else { fprintf(log_fp, "%d %s %d", (int)t, user_id, money); - snprintf(tt, sizeof(tt), I18N[164], mail_title, money); - mail_id(user_id, tt, "etc/givemoney.why", I18N[165]); + snprintf(tt, sizeof(tt), gettext[164], mail_title, money); + mail_id(user_id, tt, "etc/givemoney.why", gettext[165]); } } @@ -1185,16 +1187,16 @@ give_money() struct tm *pt = localtime(&now); int to_all = 0, money = 0; - getdata(0, 0, I18N[166], buf, sizeof(buf), LCECHO); + getdata(0, 0, gettext[166], buf, sizeof(buf), LCECHO); if (buf[0] == 'q') return 1; else if (buf[0] == 'a') { to_all = 1; - getdata(1, 0, I18N[167], buf, 20, DOECHO); + getdata(1, 0, gettext[167], buf, 20, DOECHO); money = atoi(buf); if (money <= 0) { move(2, 0); - prints(I18N[168]); + prints(gettext[168]); pressanykey(); return 1; } @@ -1204,7 +1206,7 @@ give_money() } clear(); - getdata(0, 0, I18N[169], buf, 3, LCECHO); + getdata(0, 0, gettext[169], buf, 3, LCECHO); if (buf[0] != 'y') return 1; @@ -1214,17 +1216,17 @@ give_money() fprintf(fp2, "%s\n", buf); - getdata(1, 0, I18N[170], tt, TTLEN, DOECHO); + getdata(1, 0, gettext[170], tt, TTLEN, DOECHO); move(2, 0); - prints(I18N[171]); + prints(gettext[171]); pressanykey(); if (vedit("etc/givemoney.why", NA, NULL) < 0) { fclose(fp2); return 1; } - stand_title(I18N[172]); + stand_title(gettext[172]); if (to_all) { int i, unum; for (unum = SHM->number, i = 0; i < unum; i++) { @@ -1234,7 +1236,7 @@ give_money() give_id_money(id, money, fp2, tt, now); } //something wrong @ _ @ - //give_money_post(I18N[173], atoi(money)); + //give_money_post(gettext[173], atoi(money)); } else { if (!(fp = fopen("etc/givemoney.txt", "r+"))) { fclose(fp2); diff --git a/mbbsd/announce.c b/mbbsd/announce.c index 184cf3e9..7939844a 100644 --- a/mbbsd/announce.c +++ b/mbbsd/announce.c @@ -17,7 +17,7 @@ a_copyitem(char *fpath, char *title, char *owner, int mode) else *copyowner = 0; if (mode) { - vmsg(I18N[174]); + vmsg(gettext[174]); } } @@ -52,9 +52,9 @@ a_showmenu(menu_t * pm) char buf[PATHLEN]; time_t dtime; - showtitle(I18N[175], pm->mtitle); - prints(I18N[176], - I18N[177]); + showtitle(gettext[175], pm->mtitle); + prints(gettext[176], + gettext[177]); if (pm->num) { setadir(buf, pm->path); @@ -76,12 +76,12 @@ a_showmenu(menu_t * pm) buf); } } else - outs(I18N[178]); + outs(gettext[178]); move(b_lines, 1); outs(pm->level ? - I18N[179] : - I18N[180]); + gettext[179] : + gettext[180]); } static int @@ -90,7 +90,7 @@ a_searchtitle(menu_t * pm, int rev) static char search_str[40] = ""; int pos; - getdata(b_lines - 1, 1, I18N[181], search_str, sizeof(search_str), DOECHO); + getdata(b_lines - 1, 1, gettext[181], search_str, sizeof(search_str), DOECHO); if (!*search_str) return pm->now; @@ -123,14 +123,14 @@ static void a_showhelp(int level) { clear(); - outs(I18N[182]); + outs(gettext[182]); outs(BBSNAME); - outs(I18N[183]); + outs(gettext[183]); if (level >= MANAGER) { - outs(I18N[184]); + outs(gettext[184]); } if (level >= SYSOP) { - outs(I18N[185]); + outs(gettext[185]); } pressanykey(); } @@ -183,9 +183,9 @@ static void a_newitem(menu_t * pm, int mode) { char *mesg[3] = { - I18N[186], /* ADDITEM */ - I18N[187], /* ADDGROUP */ - I18N[188] /* ADDLINK */ + gettext[186], /* ADDITEM */ + gettext[187], /* ADDGROUP */ + gettext[188] /* ADDLINK */ }; char fpath[PATHLEN], buf[PATHLEN], lpath[PATHLEN]; @@ -197,20 +197,20 @@ a_newitem(menu_t * pm, int mode) switch (mode) { case ADDITEM: stampfile(fpath, &item); - strlcpy(item.title, I18N[189], sizeof(item.title)); /* A1BA */ + strlcpy(item.title, gettext[189], sizeof(item.title)); /* A1BA */ break; case ADDGROUP: stampdir(fpath, &item); - strlcpy(item.title, I18N[190], sizeof(item.title)); /* A1BB */ + strlcpy(item.title, gettext[190], sizeof(item.title)); /* A1BB */ break; case ADDLINK: stamplink(fpath, &item); - if (!getdata(b_lines - 2, 1, I18N[191], buf, 61, DOECHO)) + if (!getdata(b_lines - 2, 1, gettext[191], buf, 61, DOECHO)) return; if (invalid_pname(buf)) { unlink(fpath); - outs(I18N[192]); + outs(gettext[192]); igetch(); return; } @@ -237,10 +237,10 @@ a_newitem(menu_t * pm, int mode) break; } if (dashf(lpath)) { - strlcpy(item.title, I18N[193], sizeof(item.title)); /* A1B3 */ + strlcpy(item.title, gettext[193], sizeof(item.title)); /* A1B3 */ break; } else if (dashd(lpath)) { - strlcpy(item.title, I18N[194], sizeof(item.title)); /* A1B4 */ + strlcpy(item.title, gettext[194], sizeof(item.title)); /* A1B4 */ break; } if (!HAS_PERM(PERM_BBSADM) && d == 1) @@ -249,7 +249,7 @@ a_newitem(menu_t * pm, int mode) if (!item.title[0]) { unlink(fpath); - outs(I18N[195]); + outs(gettext[195]); igetch(); return; } @@ -273,7 +273,7 @@ a_newitem(menu_t * pm, int mode) case ADDLINK: unlink(fpath); if (symlink(lpath, fpath) == -1) { - outs(I18N[196]); + outs(gettext[196]); igetch(); return; } @@ -298,13 +298,13 @@ a_pasteitem(menu_t * pm, int mode) if (dashd(copyfile)) { for (i = 0; copyfile[i] && copyfile[i] == pm->path[i]; i++); if (!copyfile[i]) { - vmsg(I18N[197]); + vmsg(gettext[197]); return; } } if (mode) { snprintf(buf, sizeof(buf), - I18N[198], copytitle); + gettext[198], copytitle); getdata(b_lines - 1, 1, buf, ans, sizeof(ans), LCECHO); } else ans[0] = 'y'; @@ -322,7 +322,7 @@ a_pasteitem(menu_t * pm, int mode) mkdir(pm->path, 0755); memset(&item, 0, sizeof(fileheader_t)); strlcpy(item.filename, fname + 1, sizeof(item.filename)); - memcpy(copytitle, I18N[199], 2); + memcpy(copytitle, gettext[199], 2); if (HAS_PERM(PERM_BBSADM)) Link(copyfile, newpath); else { @@ -330,17 +330,17 @@ a_pasteitem(menu_t * pm, int mode) } } else if (dashf(copyfile)) { stampfile(newpath, &item); - memcpy(copytitle, I18N[200], 2); + memcpy(copytitle, gettext[200], 2); Copy(copyfile, newpath); } else if (dashd(copyfile)) { stampdir(newpath, &item); - memcpy(copytitle, I18N[201], 2); + memcpy(copytitle, gettext[201], 2); snprintf(buf, sizeof(buf), "/bin/cp -r %s/* %s/.D* %s", copyfile, copyfile, newpath); system(buf); } else { - outs(I18N[202]); + outs(gettext[202]); igetch(); return; } @@ -351,7 +351,7 @@ a_pasteitem(menu_t * pm, int mode) copyfile[0] = '\0'; } } else { - outs(I18N[203]); + outs(gettext[203]); igetch(); } } @@ -372,7 +372,7 @@ a_appenditem(menu_t * pm, int isask) if (dashf(fname)) { if (isask) { snprintf(buf, sizeof(buf), - I18N[204], copytitle); + gettext[204], copytitle); getdata(b_lines - 2, 1, buf, ans, sizeof(ans), LCECHO); } if (ans[0] == 'y') { @@ -383,7 +383,7 @@ a_appenditem(menu_t * pm, int isask) fprintf(fp, "\n> %s <\n\n", buf); if (isask) getdata(b_lines - 1, 1, - I18N[205], + gettext[205], ans, sizeof(ans), LCECHO); while (fgets(buf, sizeof(buf), fin)) { if ((ans[0] == 'n') && @@ -398,15 +398,15 @@ a_appenditem(menu_t * pm, int isask) } } } else { - outs(I18N[206]); + outs(gettext[206]); igetch(); } } else { - outs(I18N[207]); + outs(gettext[207]); igetch(); } } else { - outs(I18N[208]); + outs(gettext[208]); igetch(); } } @@ -440,7 +440,7 @@ a_pastetagpost(menu_t * pm, int mode) setbfile(buf, bh->brdname, fhdr.filename); if (dashf(buf)) { - strcpy(title, I18N[209]); + strcpy(title, gettext[209]); strncpy(title + 3, fhdr.title, TTLEN - 3); title[TTLEN] = '\0'; a_copyitem(buf, title, 0, 0); @@ -466,7 +466,7 @@ a_moveitem(menu_t * pm) char buf[PATHLEN]; int fail; - snprintf(buf, sizeof(buf), I18N[210], pm->now + 1); + snprintf(buf, sizeof(buf), gettext[210], pm->now + 1); if (!getdata(b_lines - 1, 1, buf, newnum, sizeof(newnum), DOECHO)) return; num = (newnum[0] == '$') ? 9999 : atoi(newnum) - 1; @@ -522,14 +522,14 @@ a_delete(menu_t * pm) if (pm->header[pm->now - pm->page].filename[0] == 'H' && pm->header[pm->now - pm->page].filename[1] == '.') { - getdata(b_lines - 1, 1, I18N[211], + getdata(b_lines - 1, 1, gettext[211], ans, sizeof(ans), LCECHO); if (ans[0] != 'y') return; if (delete_record(buf, FHSZ, pm->now + 1) == -1) return; } else if (dashl(fpath)) { - getdata(b_lines - 1, 1, I18N[212], + getdata(b_lines - 1, 1, gettext[212], ans, sizeof(ans), LCECHO); if (ans[0] != 'y') return; @@ -537,7 +537,7 @@ a_delete(menu_t * pm) return; unlink(fpath); } else if (dashf(fpath)) { - getdata(b_lines - 1, 1, I18N[213], ans, + getdata(b_lines - 1, 1, gettext[213], ans, sizeof(ans), LCECHO); if (ans[0] != 'y') return; @@ -557,7 +557,7 @@ a_delete(menu_t * pm) setbdir(buf, "deleted"); append_record(buf, &backup, sizeof(backup)); } else if (dashd(fpath)) { - getdata(b_lines - 1, 1, I18N[214], ans, + getdata(b_lines - 1, 1, gettext[214], ans, sizeof(ans), LCECHO); if (ans[0] != 'y') return; @@ -579,7 +579,7 @@ a_delete(menu_t * pm) setadir(buf, buf); append_record(buf, &backup, sizeof(backup)); } else { /* Ptt 損毀的項目 */ - getdata(b_lines - 1, 1, I18N[215], + getdata(b_lines - 1, 1, gettext[215], ans, sizeof(ans), LCECHO); if (ans[0] != 'y') return; @@ -597,7 +597,7 @@ a_newtitle(menu_t * pm) memcpy(&item, &pm->header[pm->now - pm->page], FHSZ); strlcpy(buf, item.title + 3, sizeof(buf)); - if (getdata_buf(b_lines - 1, 1, I18N[216], buf, 60, DOECHO)) { + if (getdata_buf(b_lines - 1, 1, gettext[216], buf, 60, DOECHO)) { strlcpy(item.title + 3, buf, sizeof(item.title) - 3); setadir(buf, pm->path); substitute_record(buf, &item, FHSZ, pm->now + 1); @@ -626,7 +626,7 @@ a_editsign(menu_t * pm) memcpy(&item, &pm->header[pm->now - pm->page], FHSZ); snprintf(buf, sizeof(buf), "%c%c", item.title[0], item.title[1]); - if (getdata_buf(b_lines - 1, 1, I18N[217], buf, 5, DOECHO)) { + if (getdata_buf(b_lines - 1, 1, gettext[217], buf, 5, DOECHO)) { item.title[0] = buf[0] ? buf[0] : ' '; item.title[1] = buf[1] ? buf[1] : ' '; item.title[2] = buf[2] ? buf[2] : ' '; @@ -647,7 +647,7 @@ a_showname(menu_t * pm) snprintf(buf, sizeof(buf), "%s/%s", pm->path, pm->header[pm->now - pm->page].filename); if (dashl(buf)) { - prints(I18N[218], + prints(gettext[218], pm->header[pm->now - pm->page].filename); if ((len = readlink(buf, buf, PATHLEN - 1)) >= 0) { buf[len] = '\0'; @@ -663,16 +663,16 @@ a_showname(menu_t * pm) sym = 1; } if (sym) { - vmsg(I18N[219], &buf[i + 1]); + vmsg(gettext[219], &buf[i + 1]); } } } } else if (dashf(buf)) - prints(I18N[220], pm->header[pm->now - pm->page].filename); + prints(gettext[220], pm->header[pm->now - pm->page].filename); else if (dashd(buf)) - prints(I18N[221], pm->header[pm->now - pm->page].filename); + prints(gettext[221], pm->header[pm->now - pm->page].filename); else - outs(I18N[222]); + outs(gettext[222]); pressanykey(); } @@ -682,8 +682,8 @@ static char *a_title; static void atitle() { - showtitle(I18N[223], a_title); - outs(I18N[224]); + showtitle(gettext[223], a_title); + outs(gettext[224]); } #endif @@ -849,7 +849,7 @@ a_menu(char *maintitle, char *path, int lastlevel) */ if( !lastlevel && !HAS_PERM(PERM_SYSOP) && !is_BM_cache(currbid) && dashd(fname) ) - vmsg(I18N[225]); + vmsg(gettext[225]); else a_copyitem(fname, me.header[me.now - me.page].title, 0, 1); me.page = 9999; @@ -868,7 +868,7 @@ a_menu(char *maintitle, char *path, int lastlevel) #endif snprintf(fname, sizeof(fname), "%s/%s", path, fhdr->filename); if (*fhdr->filename == 'H' && fhdr->filename[1] == '.') { - vmsg(I18N[226]); + vmsg(gettext[226]); vmsg("gopher://%s/1/",fhdr->filename+2); } else if (dashf(fname)) { int more_result; @@ -882,8 +882,8 @@ a_menu(char *maintitle, char *path, int lastlevel) clrtoeol(); getdata(22, 1, currstat == EDITEXP ? - I18N[227] : - I18N[228], + gettext[227] : + gettext[228], ans, sizeof(ans), LCECHO); if (ans[0] == 'y') { strlcpy(trans_buffer, @@ -937,7 +937,7 @@ a_menu(char *maintitle, char *path, int lastlevel) a_forward(path, &me.header[me.now - me.page], ch /* == 'U' */ ); /* By CharlieL */ } else - vmsg(I18N[229]); + vmsg(gettext[229]); me.page = 9999; break; @@ -945,20 +945,20 @@ a_menu(char *maintitle, char *path, int lastlevel) #ifdef BLOG case 'b': if( !HAS_PERM(PERM_SYSOP) && !is_BM_cache(currbid) ) - vmsg(I18N[230]); + vmsg(gettext[230]); else{ char genbuf[128]; snprintf(genbuf, sizeof(genbuf), "bin/builddb.pl -f -n %d %s", me.now, currboard); system(genbuf); - vmsg(I18N[231]); + vmsg(gettext[231]); } me.page = 9999; break; case 'B': if( !HAS_PERM(SYSOP) && !is_BM_cache(currbid) ) - vmsg(I18N[232]); + vmsg(gettext[232]); else BlogMain(me.now); me.page = 9999; @@ -1054,7 +1054,7 @@ Announce() { setutmpmode(ANNOUNCE); char mytitle[256]; - sprintf(mytitle, "%s%s", BBSNAME, I18N[233]); + sprintf(mytitle, "%s%s", BBSNAME, gettext[233]); a_menu(mytitle, "man", ((HAS_PERM(PERM_SYSOP) || HAS_PERM(PERM_ANNOUNCE)) ? SYSOP : NOBODY)); @@ -1069,13 +1069,13 @@ void BlogMain(int num) char genbuf[128], exit = 0; //setutmpmode(BLOGGING); /* will crash someone using old program */ - sprintf(genbuf, I18N[234], currboard); - showtitle(I18N[235], genbuf); + sprintf(genbuf, gettext[234], currboard); + showtitle(gettext[235], genbuf); while( !exit ){ move(1, 0); - prints(I18N[236] + prints(gettext[236] ); - switch( getans(I18N[237]) ){ + switch( getans(gettext[237]) ){ case '1': snprintf(genbuf, sizeof(genbuf), "bin/builddb.pl -c %s", currboard); @@ -1094,17 +1094,17 @@ void BlogMain(int num) case '4':{ char hash[35]; int i; - getdata(16, 0, I18N[238], + getdata(16, 0, gettext[238], hash, sizeof(hash), DOECHO); for( i = 0 ; hash[i] != 0 ; ++i ) /* 前面用 getdata() 保證有 \0 */ if( !islower(hash[i]) && !isnumber(hash[i]) ) break; if( i != 32 ){ - vmsg(I18N[239]); + vmsg(gettext[239]); break; } if( hash[0] != 0 && - getans(I18N[240]) == 'y' ){ + getans(gettext[240]) == 'y' ){ MYSQL mysql; char cmd[256]; @@ -1117,7 +1117,7 @@ void BlogMain(int num) BLOGDB_PASSWD, BLOGDB_DB, BLOGDB_PORT, BLOGDB_SOCK, 0) || mysql_query(&mysql, cmd)) ) - vmsg(I18N[241]); + vmsg(gettext[241]); else vmsg( #ifdef DEBUG @@ -1133,7 +1133,7 @@ void BlogMain(int num) case '5': { char date[9]; - getdata(16, 0, I18N[242], + getdata(16, 0, gettext[242], date, sizeof(date), DOECHO); snprintf(genbuf, sizeof(genbuf), "bin/builddb.pl -D %s %s", date, currboard); @@ -1146,7 +1146,7 @@ void BlogMain(int num) char fpath[PATHLEN], adir[PATHLEN], buf[256]; sprintf(fpath, "man/boards/%c/%s", currboard[0], currboard); stampdir(fpath, &item); - strlcpy(item.title, I18N[243], sizeof(item.title)); + strlcpy(item.title, gettext[243], sizeof(item.title)); strlcpy(item.owner, cuser.userid, sizeof(item.owner)); sprintf(adir, "man/boards/%c/%s/.DIR", currboard[0], currboard); @@ -1166,7 +1166,7 @@ void BlogMain(int num) break; } if( !exit ) - vmsg(I18N[244]); + vmsg(gettext[244]); } currutmp->mode = oldmode; pressanykey(); diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 860d9628..9a4538d0 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -1,11 +1,13 @@ /* $Id$ */ #include "bbs.h" +#define WHEREAMI_LEVEL 16 + static int recommend(int ent, fileheader_t * fhdr, char *direct); #ifdef ASSESS static char *badpost_reason[] = { - I18N[245], I18N[246], I18N[247] + gettext[245], gettext[246], gettext[247] }; #endif @@ -30,11 +32,11 @@ mail_by_link(char *owner, char *title, char *path) void anticrosspost() { - log_file("etc/illegal_money", 1, I18N[248], cuser.userid, ctime(&now)); - post_violatelaw(cuser.userid, I18N[249], "Cross-post", I18N[250]); + log_file("etc/illegal_money", 1, gettext[248], cuser.userid, ctime(&now)); + post_violatelaw(cuser.userid, gettext[249], "Cross-post", gettext[250]); cuser.userlevel |= PERM_VIOLATELAW; cuser.vl_count++; - mail_by_link(I18N[251], I18N[252], + mail_by_link(gettext[251], gettext[252], BBSHOME "/etc/crosspost.txt"); u_exit("Cross Post"); exit(0); @@ -48,39 +50,39 @@ save_violatelaw() setutmpmode(VIOLATELAW); clear(); - stand_title(I18N[253]); + stand_title(gettext[253]); if (!(cuser.userlevel & PERM_VIOLATELAW)) { - mouts(22, 0, I18N[254]); + mouts(22, 0, gettext[254]); pressanykey(); return 0; } reload_money(); if (cuser.money < (int)cuser.vl_count * 1000) { - snprintf(buf, sizeof(buf), I18N[255], + snprintf(buf, sizeof(buf), gettext[255], (int)cuser.vl_count, (int)cuser.vl_count * 1000, cuser.money); mouts(22, 0, buf); pressanykey(); return 0; } move(5, 0); - prints(I18N[256]); - prints(I18N[257]); + prints(gettext[256]); + prints(gettext[257]); - if (!getdata(10, 0, I18N[258], ok, sizeof(ok), LCECHO) || + if (!getdata(10, 0, gettext[258], ok, sizeof(ok), LCECHO) || ok[0] == 'n' || ok[0] == 'N') { - mouts(22, 0, I18N[259]); + mouts(22, 0, gettext[259]); pressanykey(); return 0; } - snprintf(buf, sizeof(buf), I18N[260], + snprintf(buf, sizeof(buf), gettext[260], cuser.vl_count, cuser.vl_count * 1000); mouts(11, 0, buf); - if (!getdata(10, 0, I18N[261], ok, sizeof(ok), LCECHO) || + if (!getdata(10, 0, gettext[261], ok, sizeof(ok), LCECHO) || ok[0] == 'N' || ok[0] == 'n') { - mouts(22, 0, I18N[262]); + mouts(22, 0, gettext[262]); pressanykey(); return 0; } @@ -109,9 +111,9 @@ set_board() } board_note_time = &bp->bupdate; if(bp->BM[0] <= ' ') - strcpy(currBM, I18N[263]); + strcpy(currBM, gettext[263]); else - snprintf(currBM, sizeof(currBM), I18N[264], bp->BM); + snprintf(currBM, sizeof(currBM), gettext[264], bp->BM); /* init basic perm, but post perm is checked on demand */ currmode = (currmode & (MODE_DIRTY | MODE_GROUPOP)) | MODE_STARTED; @@ -143,12 +145,12 @@ readtitle() bp = getbcache(currbid); if(bp->bvote != 2 && bp->bvote) - brd_title = I18N[265]; + brd_title = gettext[265]; else brd_title = bp->title + 7; showtitle(currBM, brd_title); - prints(I18N[266], SHM->bcache[currbid - 1].nuser); + prints(gettext[266], SHM->bcache[currbid - 1].nuser); } static void @@ -175,18 +177,18 @@ readdoent(int num, fileheader_t * ent) } title = subject(mark = ent->title); if (ent->filemode & FILE_VOTE) - color = '2', mark = I18N[267]; + color = '2', mark = gettext[267]; else if (ent->filemode & FILE_BID) - color = '6', mark = I18N[268]; + color = '6', mark = gettext[268]; else if (title == mark) - color = '1', mark = I18N[269]; + color = '1', mark = gettext[269]; else color = '3', mark = "R:"; if (title[45]) - strlcpy(title + 42, I18N[270], sizeof(title) - 42); /* 把多餘的 string 砍掉 */ + strlcpy(title + 42, gettext[270], sizeof(title) - 42); /* 把多餘的 string 砍掉 */ - if (!strncmp(title, I18N[271], 6)) + if (!strncmp(title, gettext[271], 6)) special = 1; #if 1 if (!strchr(ent->owner, '.') && !SHM->GV2.e.noonlineuser && @@ -199,11 +201,15 @@ readdoent(int num, fileheader_t * ent) isonline = 1; #endif if(ent->recommend>99) - strcpy(recom,I18N[272]); + strcpy(recom,gettext[272]); else if(ent->recommend>9) sprintf(recom,"3m%2d",ent->recommend); else if(ent->recommend>0) sprintf(recom,"2m%2d",ent->recommend); + else if(ent->recommend<-99) + sprintf(recom,"1m劣"); + else if(ent->recommend<-10) + sprintf(recom,"0mX%d",-ent->recommend); else strcpy(recom,"0m "); prints( @@ -229,7 +235,7 @@ readdoent(int num, fileheader_t * ent) int whereami(int ent, fileheader_t * fhdr, char *direct) { - boardheader_t *bh, *p[32], *root; + boardheader_t *bh, *p[WHEREAMI_LEVEL], *root; int i, j; if (!currutmp->brc_id) @@ -240,10 +246,10 @@ whereami(int ent, fileheader_t * fhdr, char *direct) bh = getbcache(currutmp->brc_id); root = getbcache(1); p[0] = bh; - for (i = 0; i < 31 && p[i]->parent != root && p[i]->parent; i++) + for (i = 0; i < WHEREAMI_LEVEL && p[i]->parent != root && p[i]->parent; i++) p[i + 1] = p[i]->parent; j = i; - prints(I18N[273], p[j]->title + 7, p[j]->BM); + prints(gettext[273], p[j]->title + 7, p[j]->BM); for (j--; j >= 0; j--) prints("%*s %-13.13s %-37.37s %.13s\n", (i - j) * 2, "", p[j]->brdname, p[j]->title, @@ -370,10 +376,10 @@ do_reply_title(int row, char *title) else strlcpy(save_title, title, sizeof(save_title)); save_title[TTLEN - 1] = '\0'; - snprintf(genbuf, sizeof(genbuf), I18N[274], save_title); + snprintf(genbuf, sizeof(genbuf), gettext[274], save_title); getdata(row, 0, genbuf, genbuf2, 4, LCECHO); if (genbuf2[0] == 'n' || genbuf2[0] == 'N') - getdata(++row, 0, I18N[275], save_title, TTLEN, DOECHO); + getdata(++row, 0, gettext[275], save_title, TTLEN, DOECHO); } static void @@ -415,7 +421,7 @@ do_crosspost(char *brd, fileheader_t *postfile, const char *fpath) stampfile(genbuf, &fh); strcpy(fh.owner, postfile->owner); strcpy(fh.date, postfile->date); - sprintf(fh.title,I18N[276], len, len, postfile->title, currboard); + sprintf(fh.title,gettext[276], len, len, postfile->title, currboard); unlink(genbuf); Link((char *)fpath, genbuf); postfile->filemode = FILE_LOCAL; @@ -428,53 +434,53 @@ static void setupbidinfo(bid_t *bidinfo) { char buf[256]; - bidinfo->enddate = gettime(20, now+86400,I18N[277]); + bidinfo->enddate = gettime(20, now+86400,gettext[277]); do - getdata_str(21,0,I18N[278],buf, 8, LCECHO, "1"); + getdata_str(21,0,gettext[278],buf, 8, LCECHO, "1"); while((bidinfo->high=atoi(buf))<=0); do - getdata_str(21,20, I18N[279],buf, 5, LCECHO, "1"); + getdata_str(21,20, gettext[279],buf, 5, LCECHO, "1"); while((bidinfo->increment=atoi(buf))<=0); - getdata(21,44, I18N[280],buf, 10, LCECHO); + getdata(21,44, gettext[280],buf, 10, LCECHO); bidinfo->buyitnow=atoi(buf); getdata_str(22,0, - I18N[281], + gettext[281], buf, 3, LCECHO,"1"); bidinfo->payby=(buf[0]-'1'); if(bidinfo->payby<0 ||bidinfo->payby>3)bidinfo->payby=0; - getdata_str(23,0, I18N[282], buf, 6, LCECHO, "0"); + getdata_str(23,0, gettext[282], buf, 6, LCECHO, "0"); bidinfo->shipping = atoi(buf); if(bidinfo->shipping<0) bidinfo->shipping=0; } static void print_bidinfo(FILE *io, bid_t bidinfo) { - char *payby[4]={ I18N[283],I18N[284],I18N[285],I18N[286]}; + char *payby[4]={ gettext[283],gettext[284],gettext[285],gettext[286]}; if(io) { if(!bidinfo.userid[0]) - fprintf(io,I18N[287],bidinfo.high); + fprintf(io,gettext[287],bidinfo.high); else - fprintf(io, I18N[288],bidinfo.high, bidinfo.userid); - fprintf(io, I18N[289],payby[bidinfo.payby%4],Cdate(& bidinfo.enddate)); + fprintf(io, gettext[288],bidinfo.high, bidinfo.userid); + fprintf(io, gettext[289],payby[bidinfo.payby%4],Cdate(& bidinfo.enddate)); if(bidinfo.buyitnow) - fprintf(io, I18N[290],bidinfo.buyitnow); + fprintf(io, gettext[290],bidinfo.buyitnow); if(bidinfo.shipping) - fprintf(io, I18N[291], bidinfo.shipping); + fprintf(io, gettext[291], bidinfo.shipping); fprintf(io, "\n"); } else { if(!bidinfo.userid[0]) - prints(I18N[292],bidinfo.high); + prints(gettext[292],bidinfo.high); else - prints(I18N[293],bidinfo.high, bidinfo.userid); - prints(I18N[294],payby[bidinfo.payby%4],Cdate(& bidinfo.enddate)); + prints(gettext[293],bidinfo.high, bidinfo.userid); + prints(gettext[294],payby[bidinfo.payby%4],Cdate(& bidinfo.enddate)); if(bidinfo.buyitnow) - prints(I18N[295],bidinfo.buyitnow); + prints(gettext[295],bidinfo.buyitnow); if(bidinfo.shipping) - prints(I18N[296], bidinfo.shipping); + prints(gettext[296], bidinfo.shipping); prints("\n"); } @@ -500,7 +506,7 @@ do_general(int isbid) && !((cuser.uflag2 & FOREIGN) && strcmp(bp->brdname, "PttForeign") == 0) #endif ) { - vmsg(I18N[305]); + vmsg(gettext[305]); return READ_REDRAW; } #ifdef NO_WATER_POST @@ -508,7 +514,7 @@ do_general(int isbid) /* 三分鐘內最多發表五篇文章 */ if (currutmp->lastact - last_post_time < 60 * 3) { if (water_counts >= 5) { - vmsg(I18N[306]); + vmsg(gettext[306]); return READ_REDRAW; } } else { @@ -531,8 +537,8 @@ do_general(int isbid) more("etc/" FN_POST_BID, NA); } move(19, 0); - prints(I18N[307], - isbid?I18N[308]:I18N[309], + prints(gettext[307], + isbid?gettext[308]:gettext[309], currboard, bp->title + 7); if(isbid) @@ -549,15 +555,15 @@ do_general(int isbid) if(!isbid) { move(21,0); - prints(I18N[310]); + prints(gettext[310]); for(i=0; i<8 ; i++) - strlcpy(ctype[i], I18N[297 + i], sizeof(ctype[0])); + strlcpy(ctype[i], gettext[297 + i], sizeof(ctype[0])); for(i=0; i<8 && bp->posttype[i*4]; i++) strncpy(ctype[i],bp->posttype+4*i,4); if(i==0) i=8; for(aborted=0; aborted<i; aborted++) prints("%d.%4.4s ", aborted+1, ctype[aborted]); - sprintf(buf,I18N[311],i); + sprintf(buf,gettext[311],i); getdata(21, 6+7*i, buf, save_title, 3, LCECHO); posttype = save_title[0] - '1'; if (posttype >= 0 && posttype < i) @@ -569,7 +575,7 @@ do_general(int isbid) posttype=-1; } } - getdata_buf(22, 0, I18N[312], save_title, TTLEN, DOECHO); + getdata_buf(22, 0, gettext[312], save_title, TTLEN, DOECHO); strip_ansi(save_title, save_title, STRIP_ALL); } if (save_title[0] == '\0') @@ -661,29 +667,29 @@ do_general(int isbid) (!bp->level || (currbrdattr & BRD_POSTMASK))) { do_crosspost(ALLPOST, &postfile, fpath); } - outs(I18N[313]); + outs(gettext[313]); #ifdef MAX_POST_MONEY aborted = (aborted > MAX_POST_MONEY) ? MAX_POST_MONEY : aborted; #endif if (strcmp(currboard, "Test") && !ifuseanony) { - prints(I18N[314],++cuser.numposts); + prints(gettext[314],++cuser.numposts); if(postfile.filemode&FILE_BID) - prints(I18N[315]); + prints(gettext[315]); else if(currbrdattr&BRD_BAD) - prints(I18N[316]); + prints(gettext[316]); else { - prints(I18N[317],aborted); + prints(gettext[317],aborted); demoney(aborted); } } else - outs(I18N[318]); + outs(gettext[318]); /* 回應到原作者信箱 */ if (curredit & EDIT_BOTH) { - char *str, *msg = I18N[319]; + char *str, *msg = gettext[319]; if ((str = strchr(quote_user, '.'))) { if ( @@ -693,7 +699,7 @@ do_general(int isbid) bsmtp(fpath, save_title, str + 1, 0) #endif < 0) - msg = I18N[320]; + msg = gettext[320]; } else { sethomepath(genbuf, quote_user); stampfile(genbuf, &postfile); @@ -749,7 +755,7 @@ do_generalboardreply(fileheader_t * fhdr) { char genbuf[3]; getdata(b_lines - 1, 0, - I18N[321], + gettext[321], genbuf, sizeof(genbuf), LCECHO); switch (genbuf[0]) { case 'm': @@ -813,7 +819,7 @@ b_posttype(int ent, fileheader_t * fhdr, char *direct) for(i=0; i<8; i++) { move(2,0); - outs(I18N[322]); + outs(gettext[322]); strncpy(genbuf, bp->posttype+i*4, 4); genbuf[4]=0; sprintf(title,"%d.",i+1); @@ -821,14 +827,14 @@ b_posttype(int ent, fileheader_t * fhdr, char *direct) sprintf(posttype+i*4,"%-4.4s", genbuf); if( posttype_f & (1<<i) ) { - if(getdata(2, 20, I18N[323], genbuf, 3, LCECHO) && + if(getdata(2, 20, gettext[323], genbuf, 3, LCECHO) && genbuf[0]=='n') { posttype_f &= ~(1<<i); continue; } } - else if (!getdata(2, 20, I18N[324], genbuf, 3, LCECHO) || + else if (!getdata(2, 20, gettext[324], genbuf, 3, LCECHO) || genbuf[0]!='y') continue; setbnfile(filepath, bp->brdname, "postsample", i); @@ -927,7 +933,7 @@ cross_post(int ent, fileheader_t * fhdr, char *direct) boardheader_t *bp; if (!CheckPostPerm()) { move(5, 10); - outs(I18N[325]); + outs(gettext[325]); pressanykey(); return FULLUPDATE; } @@ -937,7 +943,7 @@ cross_post(int ent, fileheader_t * fhdr, char *direct) bp = getbcache(currbid); if (bp && (bp->brdattr & BRD_VOTEBOARD) ) return FULLUPDATE; - generalnamecomplete(I18N[326], xboard, sizeof(xboard), + generalnamecomplete(gettext[326], xboard, sizeof(xboard), SHM->Bnumber, completeboard_compar, completeboard_permission, @@ -957,27 +963,27 @@ cross_post(int ent, fileheader_t * fhdr, char *direct) ent = 1; if (HAS_PERM(PERM_SYSOP) || !strcmp(fhdr->owner, cuser.userid)) { - getdata(2, 0, I18N[327], + getdata(2, 0, gettext[327], genbuf, 3, DOECHO); if (genbuf[0] != '2') { ent = 0; - getdata(2, 0, I18N[328], inputbuf, 3, DOECHO); + getdata(2, 0, gettext[328], inputbuf, 3, DOECHO); if (inputbuf[0] != 'n' && inputbuf[0] != 'N') author = 1; } } if (ent) - snprintf(xtitle, sizeof(xtitle), I18N[329], fhdr->title); + snprintf(xtitle, sizeof(xtitle), gettext[329], fhdr->title); else strlcpy(xtitle, fhdr->title, sizeof(xtitle)); - snprintf(genbuf, sizeof(genbuf), I18N[330], xtitle); + snprintf(genbuf, sizeof(genbuf), gettext[330], xtitle); getdata(2, 0, genbuf, genbuf2, 4, LCECHO); if (genbuf2[0] == 'n' || genbuf2[0] == 'N') { - if (getdata_str(2, 0, I18N[331], genbuf, TTLEN, DOECHO, xtitle)) + if (getdata_str(2, 0, gettext[331], genbuf, TTLEN, DOECHO, xtitle)) strlcpy(xtitle, genbuf, sizeof(xtitle)); } - getdata(2, 0, I18N[332], genbuf, 3, LCECHO); + getdata(2, 0, gettext[332], genbuf, 3, LCECHO); if (genbuf[0] == 'l' || genbuf[0] == 's') { int currmode0 = currmode; char *save_currboard; @@ -1002,7 +1008,7 @@ cross_post(int ent, fileheader_t * fhdr, char *direct) write_header(xptr); currboard = save_currboard; - fprintf(xptr, I18N[333], currboard); + fprintf(xptr, gettext[333], currboard); b_suckinfile(xptr, fname); addsignature(xptr, 0); @@ -1018,7 +1024,7 @@ cross_post(int ent, fileheader_t * fhdr, char *direct) setbtotal(getbnum(xboard)); cuser.numposts++; UPDATE_USEREC; - outs(I18N[334]); + outs(gettext[334]); pressanykey(); currmode = currmode0; } @@ -1105,7 +1111,7 @@ join_gamble(int ent, fileheader_t * fhdr, char *direct) if (!HAS_PERM(PERM_LOGINOK)) return DONOTHING; if (stop_gamble()) { - vmsg(I18N[336]); + vmsg(gettext[336]); return DONOTHING; } ticket(currbid); @@ -1126,7 +1132,7 @@ hold_gamble(int ent, fileheader_t * fhdr, char *direct) setbfile(fn_ticket_end, currboard, FN_TICKET_END); setbfile(genbuf, currboard, FN_TICKET_LOCK); if (dashf(fn_ticket)) { - getdata(b_lines - 1, 0, I18N[337], yn, 3, LCECHO); + getdata(b_lines - 1, 0, gettext[337], yn, 3, LCECHO); if (yn[0] != 'y') return FULLUPDATE; rename(fn_ticket, fn_ticket_end); @@ -1138,26 +1144,26 @@ hold_gamble(int ent, fileheader_t * fhdr, char *direct) return FULLUPDATE; } if (dashf(fn_ticket_end)) { - getdata(b_lines - 1, 0, I18N[338], yn, 3, LCECHO); + getdata(b_lines - 1, 0, gettext[338], yn, 3, LCECHO); if (yn[0] != 'y') return FULLUPDATE; openticket(currbid); return FULLUPDATE; } else if (dashf(genbuf)) { - vmsg(I18N[339]); + vmsg(gettext[339]); return FULLUPDATE; } - getdata(b_lines - 2, 0, I18N[340], yn, 3, LCECHO); + getdata(b_lines - 2, 0, gettext[340], yn, 3, LCECHO); if (yn[0] != 'y') return FULLUPDATE; - getdata(b_lines - 1, 0, I18N[341], + getdata(b_lines - 1, 0, gettext[341], msg, 20, DOECHO); if (msg[0] == 0 || vedit(fn_ticket_end, NA, NULL) < 0) return FULLUPDATE; clear(); - showtitle(I18N[342], BBSNAME); + showtitle(gettext[342], BBSNAME); setbfile(genbuf, currboard, FN_TICKET_ITEMS); //sprintf(genbuf, "%s/" FN_TICKET_ITEMS, direct); @@ -1165,25 +1171,25 @@ hold_gamble(int ent, fileheader_t * fhdr, char *direct) if (!(fp = fopen(genbuf, "w"))) return FULLUPDATE; do { - getdata(2, 0, I18N[343], yn, 6, LCECHO); + getdata(2, 0, gettext[343], yn, 6, LCECHO); i = atoi(yn); } while (i < 10 || i > 10000); fprintf(fp, "%d\n", i); - if (!getdata(3, 0, I18N[344], yn, 3, LCECHO) || yn[0] != 'n') { - bp->endgamble = gettime(4, now, I18N[345]); + if (!getdata(3, 0, gettext[344], yn, 3, LCECHO) || yn[0] != 'n') { + bp->endgamble = gettime(4, now, gettext[345]); substitute_record(fn_board, bp, sizeof(boardheader_t), currbid); } move(6, 0); snprintf(genbuf, sizeof(genbuf), - I18N[346], + gettext[346], currboard, - i, i < 100 ? I18N[347] : i < 500 ? I18N[348] : - i < 1000 ? I18N[349] : i < 5000 ? I18N[350] : I18N[351], - bp->endgamble ? I18N[352] : "", + i, i < 100 ? gettext[347] : i < 500 ? gettext[348] : + i < 1000 ? gettext[349] : i < 5000 ? gettext[350] : gettext[351], + bp->endgamble ? gettext[352] : "", bp->endgamble ? Cdate(&bp->endgamble) : "" ); strcat(msg, genbuf); - prints(I18N[353]); + prints(gettext[353]); for (i = 0; i < 8; i++) { snprintf(yn, sizeof(yn), " %d)", i + 1); getdata(7 + i, 0, yn, genbuf, 9, DOECHO); @@ -1199,10 +1205,10 @@ hold_gamble(int ent, fileheader_t * fhdr, char *direct) unlink(genbuf); // Ptt: 防堵利用不同id同時舉辦賭場 move(8 + i, 0); - prints(I18N[354]); - snprintf(genbuf, sizeof(genbuf), I18N[355], currboard); + prints(gettext[354]); + snprintf(genbuf, sizeof(genbuf), gettext[355], currboard); post_msg(currboard, genbuf, msg, cuser.userid); - post_msg("Record", genbuf + 7, msg, I18N[356]); + post_msg("Record", genbuf + 7, msg, gettext[356]); /* Tim 控制CS, 以免正在玩的user把資料已經寫進來 */ rename(fn_ticket_end, fn_ticket); /* 設定完才把檔名改過來 */ @@ -1218,7 +1224,7 @@ cite_post(int ent, fileheader_t * fhdr, char *direct) char title[TTLEN + 1]; setbfile(fpath, currboard, fhdr->filename); - strlcpy(title, I18N[357], sizeof(title)); + strlcpy(title, gettext[357], sizeof(title)); strlcpy(title + 3, fhdr->title, TTLEN - 3); title[TTLEN] = '\0'; a_copyitem(fpath, title, 0, 1); @@ -1234,23 +1240,23 @@ edit_title(int ent, fileheader_t * fhdr, char *direct) int dirty = 0; if (currmode & MODE_BOARD || !strcmp(cuser.userid, fhdr->owner)) { - if (getdata(b_lines - 1, 0, I18N[358], genbuf, TTLEN, DOECHO)) { + if (getdata(b_lines - 1, 0, gettext[358], genbuf, TTLEN, DOECHO)) { strlcpy(tmpfhdr.title, genbuf, sizeof(tmpfhdr.title)); dirty++; } } if (HAS_PERM(PERM_SYSOP)) { - if (getdata(b_lines - 1, 0, I18N[359], genbuf, IDLEN + 2, DOECHO)) { + if (getdata(b_lines - 1, 0, gettext[359], genbuf, IDLEN + 2, DOECHO)) { strlcpy(tmpfhdr.owner, genbuf, sizeof(tmpfhdr.owner)); dirty++; } - if (getdata(b_lines - 1, 0, I18N[360], genbuf, 6, DOECHO)) { + if (getdata(b_lines - 1, 0, gettext[360], genbuf, 6, DOECHO)) { snprintf(tmpfhdr.date, sizeof(tmpfhdr.date), "%.5s", genbuf); dirty++; } } if (currmode & MODE_BOARD || !strcmp(cuser.userid, fhdr->owner)) { - getdata(b_lines - 1, 0, I18N[361], genbuf, 3, DOECHO); + getdata(b_lines - 1, 0, gettext[361], genbuf, 3, DOECHO); if ((genbuf[0] == 'y' || genbuf[0] == 'Y') && dirty) { *fhdr = tmpfhdr; substitute_ref_record(direct, fhdr, ent); @@ -1277,7 +1283,7 @@ recommend_cancel(int ent, fileheader_t * fhdr, char *direct) char yn[5]; if (!(currmode & MODE_BOARD)) return DONOTHING; - getdata(b_lines - 1, 0, I18N[362], yn, 5, LCECHO); + getdata(b_lines - 1, 0, gettext[362], yn, 5, LCECHO); if (yn[0] != 'y') return FULLUPDATE; #ifdef ASSESS @@ -1291,10 +1297,10 @@ recommend_cancel(int ent, fileheader_t * fhdr, char *direct) return FULLUPDATE; } static int -do_add_recommend(char *direct, fileheader_t *fhdr, int ent, char *buf) +do_add_recommend(char *direct, fileheader_t *fhdr, int ent, char *buf, int type) { char path[256]; - int fd; + int update=0; /* race here: 為了減少 system calls , 現在直接用當前的推文數 +1 寫入 .DIR 中. @@ -1302,27 +1308,35 @@ do_add_recommend(char *direct, fileheader_t *fhdr, int ent, char *buf) 1.若該文檔名被換掉的話, 推文將寫至舊檔名中 (造成幽靈檔) 2.沒有重新讀一次, 所以推文數可能被少算 3.若推的時候前文被刪, 將加到後文的推文數 + */ setdirpath(path, direct, fhdr->filename); if( log_file(path, 0, buf) == -1 ){ // 不 CREATE - vmsg(I18N[363]); + vmsg(gettext[363]); return -1; } - /* get_record(direct, fhdr, sizeof(fhdr), ent); - * This is a solution to avoid most racing (still some), but cost four + /* This is a solution to avoid most racing (still some), but cost four * system calls. */ - - if( fhdr->recommend < 100 ){ - fileheader_t t; - if( (fd = open(direct, O_WRONLY)) < 0 ) + if(type == 0 && fhdr->recommend < 100 ) + update = 1; + else if(type == 1 && fhdr->recommend > -100) + update = -1; + + if( update ){ + int fd; + //Ptt: update only necessary + if( (fd = open(direct, O_RDWR)) < 0 ) return -1; - - ++(fhdr->recommend); - if( lseek(fd, (off_t)(sizeof(*fhdr) * (ent - 1) + - (int)&t.recommend - (int)&t), SEEK_SET) >= 0) + if( lseek(fd, (off_t)(sizeof(fileheader_t) * (ent - 1) + + (int)&fhdr->recommend - (int)fhdr), SEEK_SET) >= 0) // 如果 lseek 失敗就不會 write + { + read(fd, &fhdr->recommend, sizeof(char)); + fhdr->recommend += update; + lseek(fd, -1, SEEK_CUR); write(fd, &fhdr->recommend, sizeof(char)); + } close(fd); } @@ -1340,21 +1354,21 @@ do_bid(int ent, fileheader_t * fhdr, boardheader_t *bp, char *direct, struct t get_record(fpath, &bidinfo, sizeof(bidinfo), 1); move(18,0); clrtobot(); - prints(I18N[364], fhdr->title); + prints(gettext[364], fhdr->title); print_bidinfo(0, bidinfo); if(!bidinfo.payby) money="Ptt$ "; else money=" NT$ "; if(now>bidinfo.enddate || bidinfo.high==bidinfo.buyitnow) { - prints(I18N[365]); + prints(gettext[365]); if( bidinfo.userid[0]) { /*if(!payby && bidinfo.usermax!=-1) {以Ptt幣自動扣款 }*/ - prints(I18N[366], bidinfo.userid, + prints(gettext[366], bidinfo.userid, bidinfo.high); #ifdef ASSESS if (!(bidinfo.flag & SALE_COMMENTED) && strcmp(bidinfo.userid, currutmp->userid) == 0){ - char tmp = getans(I18N[367]); + char tmp = getans(gettext[367]); if ('1' <= tmp && tmp <= '3'){ switch(tmp){ case 1: @@ -1365,45 +1379,46 @@ do_bid(int ent, fileheader_t * fhdr, boardheader_t *bp, char *direct, struct t break; } bidinfo.flag |= SALE_COMMENTED; + substitute_record(fpath, &bidinfo, sizeof(bidinfo), 1); } } #endif } - else prints(I18N[368]); + else prints(gettext[368]); pressanykey(); return FULLUPDATE; } if(bidinfo.userid[0]) { - prints(I18N[369], money,bidinfo.high + bidinfo.increment); + prints(gettext[369], money,bidinfo.high + bidinfo.increment); if(bidinfo.buyitnow) - prints(I18N[370],bidinfo.buyitnow); + prints(gettext[370],bidinfo.buyitnow); next=bidinfo.high + bidinfo.increment; } else { - prints(I18N[371], bidinfo.high); + prints(gettext[371], bidinfo.high); next=bidinfo.high; } if(!strcmp(cuser.userid,bidinfo.userid)) { - prints(I18N[372]); + prints(gettext[372]); pressanykey(); return FULLUPDATE; } if (strcmp(cuser.userid, fhdr->owner) == 0){ - vmsg(I18N[373]); + vmsg(gettext[373]); return FULLUPDATE; } - getdata_str(23,0,I18N[374], genbuf, 3, LCECHO,"n"); + getdata_str(23,0,gettext[374], genbuf, 3, LCECHO,"n"); if(genbuf[0]!='y') return FULLUPDATE; - getdata(23, 0, I18N[375], genbuf, 10, LCECHO); + getdata(23, 0, gettext[375], genbuf, 10, LCECHO); mymax=atoi(genbuf); - getdata(23,0,I18N[376],say,12,DOECHO); + getdata(23,0,gettext[376],say,12,DOECHO); get_record(fpath, &bidinfo, sizeof(bidinfo), 1); @@ -1417,18 +1432,18 @@ do_bid(int ent, fileheader_t * fhdr, boardheader_t *bp, char *direct, struct t if(mymax< next || (bidinfo.payby==0 && cuser.money<mymax )) { - vmsg(I18N[377]); + vmsg(gettext[377]); return FULLUPDATE; } snprintf(genbuf, sizeof(genbuf), - I18N[378], + gettext[378], cuser.userid,say, 31 - strlen(cuser.userid) - strlen(say), " ", money, next, fromhost, ptime->tm_mon + 1, ptime->tm_mday); - do_add_recommend(direct, fhdr, ent, genbuf); + do_add_recommend(direct, fhdr, ent, genbuf, 0); if(next > bidinfo.usermax) { bidinfo.usermax=mymax; @@ -1443,12 +1458,12 @@ do_bid(int ent, fileheader_t * fhdr, boardheader_t *bp, char *direct, struct t strcpy(bidinfo.userid,cuser.userid); snprintf(genbuf, sizeof(genbuf), -I18N[379], +gettext[379], cuser.userid, 20 - strlen(cuser.userid) , " ",money, bidinfo.high, ptime->tm_mon + 1, ptime->tm_mday); - do_add_recommend(direct, fhdr, ent, genbuf); + do_add_recommend(direct, fhdr, ent, genbuf, 0); } else { @@ -1457,15 +1472,15 @@ I18N[379], else bidinfo.high=bidinfo.usermax; /*這邊怪怪的*/ snprintf(genbuf, sizeof(genbuf), -I18N[380], +gettext[380], bidinfo.userid, 20 - strlen(bidinfo.userid) , " ", money, bidinfo.high, ptime->tm_mon + 1, ptime->tm_mday); - do_add_recommend(direct, fhdr, ent, genbuf); + do_add_recommend(direct, fhdr, ent, genbuf, 0); } substitute_record(fpath, &bidinfo, sizeof(bidinfo), 1); - vmsg(I18N[381]); + vmsg(gettext[381]); return FULLUPDATE; } @@ -1473,22 +1488,24 @@ static int recommend(int ent, fileheader_t * fhdr, char *direct) { struct tm *ptime = localtime(&now); - char buf[200], path[200], yn[5]; + char buf[200], path[200], + *ctype[3] = {"37m推","31m噓","31m→"}; + int type; boardheader_t *bp; static time_t lastrecommend = 0; bp = getbcache(currbid); if( bp->brdattr & BRD_NORECOMMEND ){ - vmsg(I18N[382]); + vmsg(gettext[382]); return FULLUPDATE; } if (!CheckPostPerm() || bp->brdattr & BRD_VOTEBOARD || fhdr->filemode & FILE_VOTE) { - vmsg(I18N[383]); + vmsg(gettext[383]); return FULLUPDATE; } #ifdef SAFE_ARTICLE_DELETE if( fhdr->filename[0] == '.' ){ - vmsg(I18N[384]); + vmsg(gettext[384]); return FULLUPDATE; } #endif @@ -1498,35 +1515,41 @@ recommend(int ent, fileheader_t * fhdr, char *direct) } setdirpath(path, direct, fhdr->filename); - if (fhdr->recommend == 0 && strcmp(cuser.userid, fhdr->owner) == 0){ - vmsg(I18N[385]); + type = vmsg_lines(b_lines-2, gettext[3601]) - '1'; + if(type > 2 || type < 0) type = 2; + + if (type < 2) + { + if (fhdr->recommend == 0 && strcmp(cuser.userid, fhdr->owner) == 0){ + vmsg(gettext[385]); return FULLUPDATE; - } + } #ifndef DEBUG if (!(currmode & MODE_BOARD) && getuser(cuser.userid) && now - lastrecommend < 40) { - vmsg(I18N[386]); + vmsg(gettext[386]); return FULLUPDATE; - } + } #endif - - - if (!getdata(b_lines - 2, 0, I18N[387], path, 40, DOECHO) || - path == NULL || - !getdata(b_lines - 1, 0, I18N[388], - yn, 5, LCECHO) - || yn[0] != 'y') + } + + if (!getdata(b_lines - 2, 0, gettext[387], path, 40, DOECHO) || + path == NULL || getans(gettext[388], ctype[type])!='y') return FULLUPDATE; snprintf(buf, sizeof(buf), - I18N[389], - cuser.userid, path, - 51 - strlen(cuser.userid) - strlen(path), " ", fromhost, + gettext[389], + ctype[type], + cuser.userid, + path, + 53 - strlen(cuser.userid) - strlen(path) , + " ", + fromhost, ptime->tm_mon + 1, ptime->tm_mday); - do_add_recommend(direct, fhdr, ent, buf); + do_add_recommend(direct, fhdr, ent, buf, type); #ifdef ASSESS /* 每 10 次推文 加一次 goodpost */ - if ((fhdr->filemode & FILE_MARKED) && fhdr->recommend % 10 == 0) { + if (type ==0 && (fhdr->filemode & FILE_MARKED) && fhdr->recommend % 10 == 0) { int uid = searchuser(fhdr->owner); if (uid > 0) inc_goodpost(uid, 1); @@ -1563,7 +1586,7 @@ mark_post(int ent, fileheader_t * fhdr, char *direct) inc_goodpost(searchuser(fhdr->owner), -1 * (fhdr->recommend / 10)); } #endif - substitute_ref_record(direct, fhdr, ent); + substitute_ref_record(direct, fhdr, ent); return PART_REDRAW; } @@ -1583,32 +1606,32 @@ del_range(int ent, fileheader_t *fhdr, char *direct) /* rocker.011018: 串接模式下還是不允許刪除比較好 */ if (currmode & MODE_SELECT) { - vmsg(I18N[390]); + vmsg(gettext[390]); return FULLUPDATE; } if ((currstat != READING) || (currmode & MODE_BOARD)) { - getdata(1, 0, I18N[391], num1, 6, DOECHO); + getdata(1, 0, gettext[391], num1, 6, DOECHO); inum1 = atoi(num1); if (inum1 <= 0) { - vmsg(I18N[392]); + vmsg(gettext[392]); return FULLUPDATE; } - getdata(1, 28, I18N[393], num2, 6, DOECHO); + getdata(1, 28, gettext[393], num2, 6, DOECHO); inum2 = atoi(num2); if (inum2 < inum1) { - vmsg(I18N[394]); + vmsg(gettext[394]); return FULLUPDATE; } getdata(1, 48, msg_sure_ny, num1, 3, LCECHO); if (*num1 == 'y') { - outmsg(I18N[395]); + outmsg(gettext[395]); refresh(); #ifdef SAFE_ARTICLE_DELETE - if(bp && !(currmode & MODE_DIGEST) && bp->nuser > 20 ) - safe_article_delete_range(direct, inum1, inum2); - else - delete_range(direct, inum1, inum2); + if(bp && !(currmode & MODE_DIGEST) && bp->nuser > 20 ) + safe_article_delete_range(direct, inum1, inum2); + else + delete_range(direct, inum1, inum2); #else delete_range(direct, inum1, inum2); #endif @@ -1644,23 +1667,22 @@ del_post(int ent, fileheader_t * fhdr, char *direct) !strcmp(cuser.userid, STR_GUEST)) return DONOTHING; - if (currmode & MODE_SELECT) { - vmsg("請回到一般模式再刪除文章"); - return DONOTHING; - } - - + if (currmode & MODE_SELECT) { + vmsg(gettext[3602]); + return DONOTHING; + } getdata(1, 0, msg_del_ny, genbuf, 3, LCECHO); if (genbuf[0] == 'y') { if( #ifdef SAFE_ARTICLE_DELETE - (bp->nuser>20 && !(currmode & MODE_DIGEST) && - !safe_article_delete(ent, fhdr, direct)) || + (bp->nuser>20 && !(currmode & MODE_DIGEST) && + !safe_article_delete(ent, fhdr, direct)) || #endif !delete_record(direct, sizeof(fileheader_t), ent) ) { - cancelpost(fhdr, not_owned, newpath); - if(fhdr->filemode & FILE_ANONYMOUS) + + cancelpost(fhdr, not_owned, newpath); + if(fhdr->filemode & FILE_ANONYMOUS) /* When the file is anonymous posted, fhdr->money is author. * see do_general() */ num = fhdr->money; @@ -1670,26 +1692,26 @@ del_post(int ent, fileheader_t * fhdr, char *direct) #define SIZE sizeof(badpost_reason) / sizeof(char *) if (not_owned && num > 0 && !(currmode & MODE_DIGEST)) { - getdata(1, 40, I18N[396], genbuf, 3, LCECHO); + getdata(1, 40, gettext[396], genbuf, 3, LCECHO); if(genbuf[0]=='y') { int i; char reason[64]; move(b_lines - 2, 0); for (i = 0; i < SIZE; i++) prints("%d.%s ", i + 1, badpost_reason[i]); - prints("%d.%s", i + 1, I18N[397]); - getdata(b_lines - 1, 0, I18N[398], reason, sizeof(reason), LCECHO); + prints("%d.%s", i + 1, gettext[397]); + getdata(b_lines - 1, 0, gettext[398], reason, sizeof(reason), LCECHO); i = reason[0] - '0'; if (i <= 0 || i > SIZE) - getdata(b_lines, 0, I18N[399], reason, sizeof(reason), DOECHO); + getdata(b_lines, 0, gettext[399], reason, sizeof(reason), DOECHO); else strcpy(reason, badpost_reason[i - 1]); if (!(inc_badpost(num, 1) % 10)){ - post_violatelaw(xuser.userid, I18N[400], I18N[401], I18N[402]); - mail_violatelaw(xuser.userid, I18N[403], I18N[404], I18N[405]); + post_violatelaw(xuser.userid, gettext[400], gettext[401], gettext[402]); + mail_violatelaw(xuser.userid, gettext[403], gettext[404], gettext[405]); xuser.userlevel |= PERM_VIOLATELAW; } - sprintf(genbuf,I18N[406], reason, fhdr->title); + sprintf(genbuf,gettext[406], reason, fhdr->title); mail_id(xuser.userid, genbuf, newpath, cuser.userid); } } @@ -1707,7 +1729,7 @@ del_post(int ent, fileheader_t * fhdr, char *direct) cuser.numposts--; if (!(currmode & MODE_DIGEST && currmode & MODE_BOARD)){ demoney(-fhdr->money); - vmsg(I18N[407], msg_del_ok, + vmsg(gettext[407], msg_del_ok, cuser.numposts, fhdr->money); } } @@ -1722,25 +1744,24 @@ show_filename(int ent, fileheader_t * fhdr, char *direct) { if(!HAS_PERM(PERM_SYSOP)) return DONOTHING; - vmsg(I18N[408], fhdr->filename); + vmsg(gettext[408], fhdr->filename); return PART_REDRAW; } static int view_postmoney(int ent, fileheader_t * fhdr, char *direct) { - move(b_lines - 1, 0); if(currmode & MODE_SELECT){ - vmsg(I18N[409]); + vmsg(gettext[409]); return FULLUPDATE; } if(fhdr->filemode & FILE_ANONYMOUS) /* When the file is anonymous posted, fhdr->money is author. * see do_general() */ - prints(I18N[410], + prints(gettext[410], fhdr->money + currutmp->pid); else - vmsg(I18N[411], fhdr->money); + vmsg(gettext[411], fhdr->money); return FULLUPDATE; } @@ -1753,37 +1774,37 @@ tar_addqueue(int ent, fileheader_t * fhdr, char *direct) FILE *fp; char bakboard, bakman; clear(); - showtitle(I18N[412], BBSNAME); + showtitle(gettext[412], BBSNAME); move(2, 0); if (!((currmode & MODE_BOARD) || HAS_PERM(PERM_SYSOP))) { move(5, 10); - outs(I18N[413]); + outs(gettext[413]); pressanykey(); return FULLUPDATE; } snprintf(qfn, sizeof(qfn), BBSHOME "/jobspool/tarqueue.%s", currboard); if (access(qfn, 0) == 0) { - outs(I18N[414]); + outs(gettext[414]); pressanykey(); return FULLUPDATE; } - if (!getdata(4, 0, I18N[415], email, sizeof(email), DOECHO)) + if (!getdata(4, 0, gettext[415], email, sizeof(email), DOECHO)) return FULLUPDATE; /* check email -.-"" */ if (strstr(email, "@") == NULL || strstr(email, ".bbs@") != NULL) { move(6, 0); - outs(I18N[416]); + outs(gettext[416]); pressanykey(); return FULLUPDATE; } - getdata(6, 0, I18N[417], ans, sizeof(ans), LCECHO); + getdata(6, 0, gettext[417], ans, sizeof(ans), LCECHO); bakboard = (ans[0] == 'n' || ans[0] == 'N') ? 0 : 1; - getdata(7, 0, I18N[418], ans, sizeof(ans), LCECHO); + getdata(7, 0, gettext[418], ans, sizeof(ans), LCECHO); bakman = (ans[0] == 'y' || ans[0] == 'Y') ? 1 : 0; if (!bakboard && !bakman) { move(8, 0); - outs(I18N[419]); + outs(gettext[419]); pressanykey(); return FULLUPDATE; } @@ -1794,8 +1815,8 @@ tar_addqueue(int ent, fileheader_t * fhdr, char *direct) fclose(fp); move(10, 0); - outs(I18N[420]); - outs(I18N[421]); + outs(gettext[420]); + outs(gettext[421]); pressanykey(); return FULLUPDATE; } @@ -1825,7 +1846,7 @@ sequent_messages(fileheader_t * fptr) if (continue_flag) genbuf[0] = 'y'; else { - prints(I18N[422], + prints(gettext[422], currboard, fptr->owner, fptr->title); getdata(3, 0, "(Y/N/Quit) [Y]: ", genbuf, 3, LCECHO); } @@ -1838,7 +1859,7 @@ sequent_messages(fileheader_t * fptr) brc_addlist(fptr->filename); if (more(genbuf, YEA) == 0) - outmsg(I18N[423]); + outmsg(gettext[423]); continue_flag = 0; switch (igetch()) { @@ -1900,10 +1921,10 @@ b_note_edit_bname(int bid) outs(msg_cancel); pressanykey(); } else { - if (!getdata(2, 0, I18N[424], buf, 3, LCECHO) + if (!getdata(2, 0, gettext[424], buf, 3, LCECHO) || buf[0] != 'n') fh->bupdate = gettime(3, fh->bupdate ? fh->bupdate : now, - I18N[425]); + gettext[425]); else fh->bupdate = 0; substitute_record(fn_board, fh, sizeof(boardheader_t), bid); @@ -1950,7 +1971,7 @@ b_post_note() setbfile(buf, currboard, FN_POST_NOTE); if (more(buf, NA) == -1) more("etc/" FN_POST_NOTE, NA); - getdata(b_lines - 2, 0, I18N[426], yn, sizeof(yn), LCECHO); + getdata(b_lines - 2, 0, gettext[426], yn, sizeof(yn), LCECHO); if (yn[0] == 'y') vedit(buf, NA, NULL); else @@ -1960,7 +1981,7 @@ b_post_note() setbfile(buf, currboard, FN_POST_BID); if (more(buf, NA) == -1) more("etc/" FN_POST_BID, NA); - getdata(b_lines - 2, 0, I18N[427], yn, sizeof(yn), LCECHO); + getdata(b_lines - 2, 0, gettext[427], yn, sizeof(yn), LCECHO); if (yn[0] == 'y') vedit(buf, NA, NULL); else @@ -1993,7 +2014,7 @@ bh_title_edit() bp = getbcache(currbid); move(1, 0); clrtoeol(); - getdata_str(1, 0, I18N[428], genbuf, + getdata_str(1, 0, gettext[428], genbuf, BTLEN - 16, DOECHO, bp->title + 7); if (!genbuf[0]) @@ -2016,7 +2037,7 @@ b_notes() if (more(buf, NA) == -1) { clear(); move(4, 20); - outs(I18N[429]); + outs(gettext[429]); } pressanykey(); return FULLUPDATE; @@ -2054,20 +2075,6 @@ board_digest() return NEWDIRECT; } -int -board_etc() -{ - if (!HAS_PERM(PERM_SYSOP)) - return DONOTHING; - currmode ^= MODE_ETC; - if (currmode & MODE_ETC) - currmode &= ~MODE_POST; - else if (haspostperm(currboard)) - currmode |= MODE_POST; - - setbdir(currdirect, currboard); - return NEWDIRECT; -} static int push_bottom(int ent, fileheader_t * fhdr, char *direct) @@ -2076,22 +2083,23 @@ push_bottom(int ent, fileheader_t * fhdr, char *direct) char buf[256]; if ((currmode & MODE_DIGEST) || !(currmode & MODE_BOARD)) return DONOTHING; - setbottomtotal(currbid); // Ptt : will be remove when stable + setbottomtotal(currbid); // <- Ptt : will be remove when stable num = getbottomtotal(currbid); if(getans(fhdr->filemode & FILE_BOTTOM ? - I18N[430]: - I18N[431])!='y') return READ_REDRAW; + gettext[430]: + gettext[431])!='y') return READ_REDRAW; fhdr->filemode ^= FILE_BOTTOM; - if(fhdr->filemode & FILE_BOTTOM) + if(fhdr->filemode & FILE_BOTTOM ) { sprintf(buf, "%s.bottom", direct); if(num >= 5) { - vmsg(I18N[432]); + vmsg(gettext[432]); return READ_REDRAW; } fhdr->money = ent | FHR_REFERENCE; append_record(buf, fhdr, sizeof(fileheader_t)); + } else { @@ -2112,7 +2120,7 @@ good_post(int ent, fileheader_t * fhdr, char *direct) return DONOTHING; if(getans(fhdr->filemode & FILE_DIGEST ? - I18N[433] : I18N[434]) == 'n') + gettext[433] : gettext[434]) == 'n') return READ_REDRAW; if (fhdr->filemode & FILE_DIGEST) { @@ -2149,7 +2157,7 @@ good_post(int ent, fileheader_t * fhdr, char *direct) #ifdef GLOBAL_DIGEST if(!(getbcache(currbid)->brdattr & BRD_HIDE)) { - getdata(1, 0, I18N[435], genbuf2, 3, LCECHO); + getdata(1, 0, gettext[435], genbuf2, 3, LCECHO); if(genbuf2[0] == 'y') do_crosspost(GLOBAL_DIGEST, &digest, genbuf); } @@ -2200,8 +2208,8 @@ b_changerecommend(int ent, fileheader_t * fhdr, char *direct) bp = getbcache(currbid); bp->brdattr ^= BRD_NORECOMMEND; substitute_record(fn_board, bp, sizeof(boardheader_t), currbid); - vmsg(I18N[457], - (bp->brdattr & BRD_NORECOMMEND) ? I18N[458] : I18N[459]); + vmsg(gettext[457], + (bp->brdattr & BRD_NORECOMMEND) ? gettext[458] : gettext[459]); return FULLUPDATE; } @@ -2219,19 +2227,19 @@ change_hidden(int ent, fileheader_t * fhdr, char *direct) bp = getbcache(currbid); if (((bp->brdattr & BRD_HIDE) && (bp->brdattr & BRD_POSTMASK))) { - if (getans(I18N[460]) != 'y') + if (getans(gettext[460]) != 'y') return FULLUPDATE; bp->brdattr &= ~BRD_HIDE; bp->brdattr &= ~BRD_POSTMASK; - outs(I18N[461]); + outs(gettext[461]); board_hidden_status = 0; hbflreload(currbid); } else { - if (getans(I18N[462]) != 'y') + if (getans(gettext[462]) != 'y') return FULLUPDATE; bp->brdattr |= BRD_HIDE; bp->brdattr |= BRD_POSTMASK; - outs(I18N[463]); + outs(gettext[463]); board_hidden_status = 1; } substitute_record(fn_board, bp, sizeof(boardheader_t), currbid); @@ -2252,15 +2260,15 @@ change_counting(int ent, fileheader_t * fhdr, char *direct) return FULLUPDATE; if (bp->brdattr & BRD_BMCOUNT) { - if (getans(I18N[464]) != 'y') + if (getans(gettext[464]) != 'y') return FULLUPDATE; bp->brdattr &= ~BRD_BMCOUNT; - outs(I18N[465]); + outs(gettext[465]); } else { - if (getans(I18N[466]) != 'y') + if (getans(gettext[466]) != 'y') return FULLUPDATE; bp->brdattr |= BRD_BMCOUNT; - outs(I18N[467]); + outs(gettext[467]); } substitute_record(fn_board, bp, sizeof(boardheader_t), currbid); pressanykey(); @@ -2314,7 +2322,7 @@ onekey_t read_comms[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 'A' 65 bh_title_edit, // 'B' - board_etc, // 'C' + NULL, // 'C' del_range, // 'D' edit_post, // 'E' NULL, // 'F' @@ -2438,8 +2446,9 @@ static void log_board(char *mode, time_t usetime) { if (usetime > 30) { - log_file(FN_USEBOARD, 1, "USE %-20.20s Stay: %5ld (%s) %s\n", - mode, usetime, cuser.userid, ctime(&now)); + log_file(FN_USEBOARD, LOG_CREAT | LOG_VF, + "USE %-20.20s Stay: %5ld (%s) %s\n", + mode, usetime, cuser.userid, ctime(&now)); } } #endif diff --git a/mbbsd/board.c b/mbbsd/board.c index 8272847d..02b40a15 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -38,10 +38,10 @@ void imovefav(int old) char buf[5]; int new; - getdata(b_lines - 1, 0, I18N[468], buf, sizeof(buf), DOECHO); + getdata(b_lines - 1, 0, gettext[468], buf, sizeof(buf), DOECHO); new = atoi(buf) - 1; if (new < 0 || brdnum <= new){ - vmsg(I18N[469]); + vmsg(gettext[469]); return; } move_in_current_folder(old, new); @@ -131,8 +131,7 @@ load_uidofgid(const int gid, const int type) int n, childcount = 0; currbptr = &bcache[gid - 1]; for (n = 0; n < numboards; ++n) { - bptr = SHM->bsorted[type][n]; - if (bptr->brdname[0] == '\0') + if( !(bptr = SHM->bsorted[type][n]) || bptr->brdname[0] == '\0' ) continue; if (bptr->gid == gid) { if (currbptr == &bcache[gid - 1]) @@ -385,129 +384,202 @@ get_fav_type(boardstat_t *ptr) static void brdlist_foot() { - prints(I18N[471], - yank_flag == 0 ? I18N[472] : yank_flag == 1 ? I18N[473] : I18N[474]); + prints(gettext[471], + yank_flag == 0 ? gettext[472] : yank_flag == 1 ? gettext[473] : gettext[474]); } + +static inline char * +make_class_color(char *name) +{ + char *colorset[8] = {"", "\033[32m", + "\033[33m", "\033[36m", "\033[34m", "\033[1m", + "\033[1;32m", "\033[1;33m"}; + + return colorset[(unsigned int) + (name[0] + name[1] + + name[2] + name[3]) & 07]; +} + +#define HILIGHT_COLOR "\033[1;36m" + static void show_brdlist(int head, int clsflag, int newflag) { int myrow = 2; - if (class_bid == 1) { + if (unlikely(class_bid == 1)) { currstat = CLASS; myrow = 6; - showtitle(I18N[475], BBSName); + showtitle(gettext[475], BBSName); movie(0); move(1, 0); outs( - I18N[476]); + gettext[476]); } else if (clsflag) { - showtitle(I18N[477], BBSName); - prints(I18N[478], - newflag ? I18N[479] : I18N[480], - I18N[481]); + showtitle(gettext[477], BBSName); + prints(gettext[478], + newflag ? gettext[479] : gettext[480], + gettext[481]); move(b_lines, 0); brdlist_foot(); } if (brdnum > 0) { boardstat_t *ptr; - char *color[8] = {"", "\033[32m", - "\033[33m", "\033[36m", "\033[34m", "\033[1m", - "\033[1;32m", "\033[1;33m"}; - char *unread[2] = {"\33[37m \033[m", I18N[482]}; + char *unread[2] = {"\33[37m \033[m", gettext[482]}; - if (yank_flag == 0 && get_fav_type(&nbrd[0]) == 0){ + char priv, *mark, *favcolor, *brdname, *color, *class, *icon, *desc, *bm; + short number, nuser; + + if (yank_flag == 0 && get_data_number(get_current_fav()) == 0){ + // brdnum > 0 ??? move(3, 0); - outs(I18N[483]); + outs(gettext[483]); return; } while (++myrow < b_lines) { move(myrow, 0); clrtoeol(); - if (head < brdnum) { - ptr = &nbrd[head++]; - if (ptr->myattr & NBRD_LINE){ - if( !newflag ) - prints("%5d %c %s------------ ------------------------------------------\033[m", - head, - ptr->myattr & NBRD_TAG ? 'D' : ' ', - ptr->myattr & NBRD_FAV ? "" : "\033[1;30m"); - else - prints(" %s------------ ------------------------------------------\033[m", ptr->myattr & NBRD_FAV ? "" : "\033[1;30m"); - continue; + if (unlikely(head >= brdnum)) + continue; + + ptr = &nbrd[head++]; + +/* board_flag_checking */ + + priv = !(B_BH(ptr)->brdattr & BRD_HIDE) ? ' ' : + (B_BH(ptr)->brdattr & BRD_POSTMASK) ? ')' : '-'; + + if (newflag) { + priv = ' '; + mark = unread[ptr->myattr & NBRD_UNREAD ? 1 : 0]; + } else { + mark = (unlikely(ptr->myattr & NBRD_TAG)) ? "D " : + (B_BH(ptr)->brdattr & BRD_GROUPBOARD) ? " " : + unread[ptr->myattr & NBRD_UNREAD ? 1 : 0]; + } + + /* special case */ + if (unlikely(class_bid == 1)) { + prints(" %5d%c%2s%-40.40s ", head, priv, mark, B_BH(ptr)->title + 7); + bm = B_BH(ptr)->BM; + goto show_BM; + } + + +/* start_of_board_decoration */ + + if (yank_flag == 0) + favcolor = !(cuser.uflag2 & FAVNOHILIGHT) ? "\033[1;36m" : ""; + else + favcolor = ""; + + color = make_class_color(B_BH(ptr)->title); + + +/* board_description */ + + if (yank_flag == 0) { + + if (ptr->myattr & NBRD_LINE) { + number = -1; + priv = ptr->myattr & NBRD_TAG ? 'D' : ' ', + favcolor = ""; + brdname = "------------"; + class = " "; + icon = " "; + desc = "------------------------------------------"; } - else if (ptr->myattr & NBRD_FOLDER){ - char *title = get_folder_title(ptr->bid); - if( !newflag ) - prints(I18N[484], - head, - ptr->myattr & NBRD_TAG ? 'D' : ' ', - !(cuser.uflag2 & FAVNOHILIGHT) ? "\033[1;36m" : "", - title); - else - prints(I18N[485], - get_data_number(get_fav_folder(getfolder(ptr->bid))), - !(cuser.uflag2 & FAVNOHILIGHT) ? "\033[1;36m" : "", - title); - continue; + else if (ptr->myattr & NBRD_FOLDER) { + number = get_data_number(get_fav_folder(getfolder(ptr->bid))); + priv = ' '; + brdname = "MyFavFolder"; + class = gettext[484]; + icon = gettext[485]; + desc = get_folder_title(ptr->bid); } - - if (class_bid == 1) - outs(" "); - if (!newflag) { - prints("%5d%c%s", head, - !(B_BH(ptr)->brdattr & BRD_HIDE) ? ' ' : - (B_BH(ptr)->brdattr & BRD_POSTMASK) ? ')' : '-', - (ptr->myattr & NBRD_TAG) ? "D " : - (B_BH(ptr)->brdattr & BRD_GROUPBOARD) ? " " : - unread[ptr->myattr & NBRD_UNREAD ? 1 : 0]); - } else { - if (B_BH(ptr)->brdattr & BRD_GROUPBOARD) - outs(" "); - else - prints("%6d%s", (int)(B_TOTAL(ptr)), - unread[ptr->myattr & NBRD_UNREAD ? 1 : 0]); + else if (!HasPerm(B_BH(ptr))) { + number = -1; + priv = ' '; + brdname = "Unknown??"; + class = gettext[3607]; + icon = gettext[3608]; + desc = gettext[3609]; } - if (class_bid != 1) { - if (!GROUPOP() && !HasPerm(B_BH(ptr))) { - outs(I18N[486]); - } - else { - prints("%s%-13s\033[m%s%5.5s\033[0;37m%2.2s\033[m%-34.34s", - ((!(cuser.uflag2 & FAVNOHILIGHT) && - getboard(ptr->bid) != NULL))? "\033[1;36m" : "", - B_BH(ptr)->brdname, - color[(unsigned int) - (B_BH(ptr)->title[1] + B_BH(ptr)->title[2] + - B_BH(ptr)->title[3] + B_BH(ptr)->title[0]) & 07], - B_BH(ptr)->title, B_BH(ptr)->title + 5, B_BH(ptr)->title + 7); - - if (B_BH(ptr)->brdattr & BRD_BAD) - outs(" X "); - else if (B_BH(ptr)->nuser >= 5000) - outs(I18N[487]); - else if (B_BH(ptr)->nuser >= 2000) - outs(I18N[488]); - else if (B_BH(ptr)->nuser >= 1000) - outs(I18N[489]); - else if (B_BH(ptr)->nuser >= 100) - outs("\033[1mHOT\033[m"); - else if (B_BH(ptr)->nuser > 50) - prints("\033[1;31m%2d\033[m ", B_BH(ptr)->nuser); - else if (B_BH(ptr)->nuser > 10) - prints("\033[1;33m%2d\033[m ", B_BH(ptr)->nuser); - else if (B_BH(ptr)->nuser > 0) - prints("%2d ", B_BH(ptr)->nuser); - else - prints(" %c ", B_BH(ptr)->bvote ? 'V' : ' '); - prints("%.*s\033[K", t_columns - 67, B_BH(ptr)->BM); - } - } else { - prints("%-40.40s %.*s", B_BH(ptr)->title + 7, - t_columns - 67, B_BH(ptr)->BM); + else { + goto ugly_normal_case; } + + mark = ""; + color = ""; + bm = ""; + nuser = 0; + } + else if (unlikely(B_BH(ptr)->brdattr & BRD_GROUPBOARD)) { + number = -1; + priv = ' '; + mark = ""; + brdname = B_BH(ptr)->brdname; + class = B_BH(ptr)->title; + icon = B_BH(ptr)->title + 5; + desc = B_BH(ptr)->title + 7; + bm = B_BH(ptr)->BM; + nuser = 0; } + + else { + /* XXX: non-null terminated string */ +ugly_normal_case: + brdname = B_BH(ptr)->brdname; + class = B_BH(ptr)->title; + icon = B_BH(ptr)->title + 5; + desc = B_BH(ptr)->title + 7; + bm = B_BH(ptr)->BM; + number = newflag ? (short)(B_TOTAL(ptr)) : head; + nuser = B_BH(ptr)->nuser; + } + + + if (!newflag) + prints("%5hd", head); + else { + if (number < 0) + outs(" "); + else + prints("%5hd", number); + } + + prints("%c%2s" "%s%-13s\033[m" "%s%4.4s\033[0;37m " "%2.2s\033[m%-34.34s", priv, mark, favcolor, brdname, color, class, icon, desc); + + if (strcmp(bm, "") == 0 || + (unlikely(B_BH(ptr)->brdattr & BRD_GROUPBOARD))) { + outs(" "); + goto ignore_hot_status; + } + + if (unlikely(B_BH(ptr)->brdattr & BRD_BAD)) + outs(" X "); + else if (unlikely(nuser >= 5000)) + outs("\033[1;34m爆!\033[m"); + else if (unlikely(nuser >= 2000)) + outs("\033[1;31m爆!\033[m"); + else if (unlikely(nuser >= 1000)) + outs("\033[1m爆!\033[m"); + else if (unlikely(nuser >= 100)) + outs("\033[1mHOT\033[m"); + else if (unlikely(nuser > 50)) + prints("\033[1;31m%2d\033[m ", B_BH(ptr)->nuser); + else if (nuser > 10) + prints("\033[1;33m%2d\033[m ", B_BH(ptr)->nuser); + else if (nuser > 0) + prints("%2d ", B_BH(ptr)->nuser); + else + prints(" %c ", B_BH(ptr)->bvote ? 'V' : ' '); + +ignore_hot_status: +show_BM: + prints("%.*s\033[K", t_columns - 67, bm); + clrtoeol(); } } @@ -534,7 +606,7 @@ paste_taged_brds(int gid) int bid, tmp; if (gid == 0 || ! (HAS_PERM(PERM_SYSOP) || GROUPOP()) || - getans("貼上標記的看板?(y/N)")=='n') return 0; + getans(gettext[3610])=='n') return 0; fav = get_current_fav(); for (tmp = 0; tmp < fav->DataTail; tmp++) { bid = fav_getid(&fav->favh[tmp]); @@ -578,7 +650,7 @@ choose_board(int newflag) load_boards(keyword); if (brdnum <= 0 && yank_flag > 0) { if (keyword[0] != 0) { - vmsg(I18N[510]); + vmsg(gettext[510]); keyword[0] = 0; brdnum = -1; continue; @@ -728,15 +800,15 @@ choose_board(int newflag) show_brdlist(head, 1, newflag); break; case '/': - getdata_buf(b_lines - 1, 0, I18N[511], + getdata_buf(b_lines - 1, 0, gettext[511], keyword, sizeof(keyword), DOECHO); brdnum = -1; break; case 'S': if(yank_flag == 0){ move(b_lines - 2, 0); - prints(I18N[512]); - tmp = getans(I18N[513]); + prints(gettext[512]); + tmp = getans(gettext[513]); if( tmp == '1' ) fav_sort_by_name(); else if( tmp == '2' ) @@ -755,7 +827,7 @@ choose_board(int newflag) if (HAS_PERM(PERM_SYSOP)) { ptr = &nbrd[num]; if (ptr->myattr & NBRD_SYMBOLIC) { - if (getans(I18N[514]) == 'y') + if (getans(gettext[514]) == 'y') delete_symbolic_link(getbcache(ptr->bid), ptr->bid); } brdnum = -1; @@ -792,7 +864,7 @@ choose_board(int newflag) } else if (HAS_PERM(PERM_LOGINOK) && yank_flag == 0) { if (fav_add_line() == NULL) { - vmsg(I18N[515]); + vmsg(gettext[515]); break; } /* done move if it's the first item. */ @@ -815,7 +887,7 @@ choose_board(int newflag) ptr = &nbrd[num]; if (yank_flag == 0) { if (ptr->myattr & NBRD_FAV) { - if (getans(I18N[516]) != 'y') + if (getans(gettext[516]) != 'y') break; fav_remove_item(ptr->bid, get_fav_type(ptr)); ptr->myattr &= ~NBRD_FAV; @@ -828,7 +900,7 @@ choose_board(int newflag) } else { if (fav_add_board(ptr->bid) == NULL) - vmsg(I18N[517]); + vmsg(gettext[517]); else ptr->myattr |= NBRD_FAV; } @@ -850,14 +922,14 @@ choose_board(int newflag) if (HAS_PERM(PERM_LOGINOK) && yank_flag == 0) { fav_type_t *ft; if (fav_stack_full()){ - vmsg(I18N[518]); + vmsg(gettext[518]); break; } if ((ft = fav_add_folder()) == NULL) { - vmsg(I18N[519]); + vmsg(gettext[519]); break; } - fav_set_folder_title(ft, I18N[520]); + fav_set_folder_title(ft, gettext[520]); /* don't move if it's the first item */ if (get_fav_type(&nbrd[0]) != 0) move_in_current_folder(brdnum, num); @@ -869,7 +941,7 @@ choose_board(int newflag) if (HAS_PERM(PERM_LOGINOK) && nbrd[num].myattr & NBRD_FOLDER) { fav_type_t *ft = getfolder(nbrd[num].bid); strlcpy(buf, get_item_title(ft), sizeof(buf)); - getdata_buf(b_lines - 1, 0, I18N[521], buf, 65, DOECHO); + getdata_buf(b_lines - 1, 0, gettext[521], buf, 65, DOECHO); fav_set_folder_title(ft, buf); brdnum = -1; } @@ -878,14 +950,14 @@ choose_board(int newflag) if (HAS_PERM(PERM_LOGINOK)) { char c, fname[80]; if (!current_fav_at_root()) { - vmsg(I18N[522]); + vmsg(gettext[522]); break; } - c = getans(I18N[523]); + c = getans(gettext[523]); if(!c) break; - if(getans(I18N[524]) != 'y') + if(getans(gettext[524]) != 'y') break; switch(c){ case '1': @@ -901,7 +973,7 @@ choose_board(int newflag) setuserfile(fname, FAV4); sprintf(buf, "%s.bak", fname); if (!dashf(buf)){ - vmsg(I18N[525]); + vmsg(gettext[525]); break; } Copy(buf, fname); @@ -914,22 +986,22 @@ choose_board(int newflag) break; case 'z': if (HAS_PERM(PERM_LOGINOK)) - vmsg(I18N[526]); + vmsg(gettext[526]); break; case 'Z': if (HAS_PERM(PERM_LOGINOK)) { char genbuf[256]; - sprintf(genbuf, I18N[527], cuser.uflag2 & FAVNEW_FLAG ? I18N[528] : ""); + sprintf(genbuf, gettext[527], cuser.uflag2 & FAVNEW_FLAG ? gettext[528] : ""); if (getans(genbuf) != 'y') break; cuser.uflag2 ^= FAVNEW_FLAG; if (cuser.uflag2 & FAVNEW_FLAG) { subscribe_newfav(); - vmsg(I18N[529]); + vmsg(gettext[529]); } else - vmsg(I18N[530]); + vmsg(gettext[530]); } break; diff --git a/mbbsd/cache.c b/mbbsd/cache.c index 6639a5c5..aabe836e 100644 --- a/mbbsd/cache.c +++ b/mbbsd/cache.c @@ -414,7 +414,7 @@ count_logins(int uid, int show) for (count = 0; (ulist[i + count] && uid == ulist[i + count]->uid); count++) { if (show) - prints(I18N[531], + prints(gettext[531], count + 1, modestring(ulist[i + count], 0), ulist[i + count]->from); } @@ -626,7 +626,7 @@ setbottomtotal(int bid) if(n>5) { #ifdef DEBUG_BOTTOM - log_file("fix_bottom", 1, "%s n:%d\n", genbuf, n); + log_file("fix_bottom", LOG_CREAT | LOG_VF, "%s n:%d\n", genbuf, n); #endif unlink(genbuf); SHM->n_bottom[bid-1]=0; @@ -877,7 +877,7 @@ reload_fcache(void) buf[0] != '\n') { sscanf(buf, "%s", SHM->domain[SHM->top]); // XXX check buffer size po = buf + strlen(SHM->domain[SHM->top]); - while (*po == ' ') + while (*po == ' ' || *po == '\t') po++; strncpy(SHM->replace[SHM->top], po, 49); SHM->replace[SHM->top] diff --git a/mbbsd/cal.c b/mbbsd/cal.c index dfc5ffdd..fbf1ab33 100644 --- a/mbbsd/cal.c +++ b/mbbsd/cal.c @@ -31,12 +31,12 @@ lockutmpmode(int unmode, int state) clear(); move(10, 20); if (errorno == 1) - prints(I18N[532], - I18N[ModeTypeTable[currutmp->lockmode]], - I18N[ModeTypeTable[unmode]]); + prints(gettext[532], + gettext[ModeTypeTable[currutmp->lockmode]], + gettext[ModeTypeTable[unmode]]); else - prints(I18N[533], - I18N[ModeTypeTable[unmode]]); + prints(gettext[533], + gettext[ModeTypeTable[unmode]]); pressanykey(); return errorno; } @@ -64,10 +64,10 @@ vice(int money, char *item) demoney(-money); setuserfile(buf, VICE_NEW); - log_file(buf, 1, "%8.8d\n", viceserial); + log_file(buf, LOG_CREAT | LOG_VF, "%8.8d\n", viceserial); snprintf(buf, sizeof(buf), - I18N[534], item, money, viceserial); - mail_id(cuser.userid, buf, "etc/vice.txt", I18N[535]); + gettext[534], item, money, viceserial); + mail_id(cuser.userid, buf, "etc/vice.txt", gettext[535]); return 0; } @@ -95,50 +95,50 @@ osong(char *defaultid) /* Jaky 一人一天點一首 */ if (!strcmp(buf, Cdatedate(&cuser.lastsong)) && !HAS_PERM(PERM_SYSOP)) { move(22, 0); - vmsg(I18N[536]); + vmsg(gettext[536]); unlockutmpmode(); return 0; } if (cuser.money < 200) { move(22, 0); - vmsg(I18N[537]); + vmsg(gettext[537]); unlockutmpmode(); return 0; } move(12, 0); clrtobot(); - prints(I18N[538], cuser.userid); + prints(gettext[538], cuser.userid); trans_buffer[0] = 0; if (!defaultid) { - getdata(13, 0, I18N[539], + getdata(13, 0, gettext[539], destid, sizeof(destid), DOECHO); while (!destid[0]) { - a_menu(I18N[540], SONGBOOK, 0); + a_menu(gettext[540], SONGBOOK, 0); clear(); - getdata(13, 0, I18N[541], + getdata(13, 0, gettext[541], destid, sizeof(destid), DOECHO); } } else strlcpy(destid, defaultid, sizeof(destid)); /* Heat:點歌者匿名功能 */ - getdata(14, 0, I18N[542], ano, sizeof(ano), DOECHO); + getdata(14, 0, gettext[542], ano, sizeof(ano), DOECHO); if (!destid[0]) { unlockutmpmode(); return 0; } - getdata_str(14, 0, I18N[543], say, - sizeof(say), DOECHO, I18N[544]); + getdata_str(14, 0, gettext[543], say, + sizeof(say), DOECHO, gettext[544]); snprintf(save_title, sizeof(save_title), - "%s:%s", (ano[0] == 'y') ? I18N[545] : cuser.userid, say); - getdata_str(16, 0, I18N[546], + "%s:%s", (ano[0] == 'y') ? gettext[545] : cuser.userid, say); + getdata_str(16, 0, gettext[546], receiver, sizeof(receiver), LCECHO, destid); if (!trans_buffer[0]) { - outs(I18N[547]); + outs(gettext[547]); pressanykey(); - a_menu(I18N[548], SONGBOOK, 0); + a_menu(gettext[548], SONGBOOK, 0); } if (!trans_buffer[0] || strstr(trans_buffer, "home") || strstr(trans_buffer, "boards") || !(fp = fopen(trans_buffer, "r"))) { @@ -156,14 +156,14 @@ osong(char *defaultid) unlockutmpmode(); return 0; } - strlcpy(mail.owner, I18N[549], sizeof(mail.owner)); + strlcpy(mail.owner, gettext[549], sizeof(mail.owner)); snprintf(mail.title, sizeof(mail.title), - I18N[550], - (ano[0] == 'y') ? I18N[551] : cuser.userid, destid); + gettext[550], + (ano[0] == 'y') ? gettext[551] : cuser.userid, destid); while (fgets(buf, sizeof(buf), fp)) { char *po; - if (!strncmp(buf, I18N[552], 6)) { + if (!strncmp(buf, gettext[552], 6)) { clear(); move(10, 10); outs(buf); @@ -177,7 +177,7 @@ osong(char *defaultid) po[0] = 0; snprintf(genbuf, sizeof(genbuf), "%s%s%s", buf, - (ano[0] == 'y') ? I18N[553] : cuser.userid, po + 7); + (ano[0] == 'y') ? gettext[553] : cuser.userid, po + 7); strlcpy(buf, genbuf, sizeof(buf)); } while ((po = strstr(buf, "<~Des~>"))) { @@ -204,10 +204,10 @@ osong(char *defaultid) delete_range(OSONGPATH "/.DIR", 1, nsongs - 500); } /* 把第一首拿掉 */ - vice(200, I18N[554]); + vice(200, gettext[554]); } snprintf(save_title, sizeof(save_title), - "%s:%s", (ano[0] == 'y') ? I18N[555] : cuser.userid, say); + "%s:%s", (ano[0] == 'y') ? gettext[555] : cuser.userid, say); hold_mail(filename, destid); if (receiver[0]) { @@ -219,7 +219,7 @@ osong(char *defaultid) } clear(); outs( - I18N[556]); + gettext[556]); pressanykey(); sortsong(); topsong(); @@ -250,10 +250,10 @@ inmailbox(int m) int p_cloak() { - if (getans(currutmp->invisible ? I18N[557] : I18N[558]) != 'y') + if (getans(currutmp->invisible ? gettext[557] : gettext[558]) != 'y') return 0; if (cuser.money >= 19) { - vice(19, I18N[559]); + vice(19, gettext[559]); currutmp->invisible %= 2; vmsg((currutmp->invisible ^= 1) ? MSG_CLOAKED : MSG_UNCLOAK); } @@ -264,14 +264,14 @@ p_cloak() int p_from() { - if (getans(I18N[560]) != 'y') + if (getans(gettext[560]) != 'y') return 0; reload_money(); if (cuser.money < 49) return 0; - if (getdata_buf(b_lines - 1, 0, I18N[561], + if (getdata_buf(b_lines - 1, 0, gettext[561], currutmp->from, sizeof(currutmp->from), DOECHO)) { - vice(49, I18N[562]); + vice(49, gettext[562]); currutmp->from_alias = 0; } return 0; @@ -284,11 +284,11 @@ p_exmail() int n; if (cuser.exmailbox >= MAX_EXKEEPMAIL) { - vmsg(I18N[563], MAX_EXKEEPMAIL); + vmsg(gettext[563], MAX_EXKEEPMAIL); return 0; } snprintf(buf, sizeof(buf), - I18N[564], cuser.exmailbox); + gettext[564], cuser.exmailbox); getdata_str(b_lines - 2, 0, buf, ans, sizeof(ans), LCECHO, "10"); @@ -302,7 +302,7 @@ p_exmail() reload_money(); if (cuser.money < n * 1000) return 0; - vice(n * 1000, I18N[565]); + vice(n * 1000, gettext[565]); inmailbox(n); return 0; } @@ -317,10 +317,10 @@ mail_redenvelop(char *from, char *to, int money, char mode) stampfile(genbuf, &fhdr); if (!(fp = fopen(genbuf, "w"))) return; - fprintf(fp, I18N[566] + fprintf(fp, gettext[566] ,from, ctime(&now), to, money); fclose(fp); - snprintf(fhdr.title, sizeof(fhdr.title), I18N[567]); + snprintf(fhdr.title, sizeof(fhdr.title), gettext[567]); strlcpy(fhdr.owner, from, sizeof(fhdr.owner)); if (mode == 'y') @@ -351,9 +351,9 @@ p_give() char id[IDLEN + 1], money_buf[20]; move(1, 0); - usercomplete(I18N[568], id); + usercomplete(gettext[568], id); if (!id[0] || !strcmp(cuser.userid, id) || - !getdata(2, 0, I18N[569], money_buf, 7, LCECHO)) + !getdata(2, 0, gettext[569], money_buf, 7, LCECHO)) return 0; money = atoi(money_buf); reload_money(); @@ -363,9 +363,9 @@ p_give() return 0; /* 繳完稅就沒錢給了 */ deumoney(searchuser(id), money - tax); demoney(-money); - log_file(FN_MONEY,1, I18N[570], + log_file(FN_MONEY,LOG_CREAT | LOG_VF, gettext[570], cuser.userid, id, money - tax, ctime(&now)); - mail_redenvelop(cuser.userid, id, money - tax, getans(I18N[571])); + mail_redenvelop(cuser.userid, id, money - tax, getans(gettext[571])); } return 0; } @@ -378,15 +378,15 @@ p_sysinfo(void) extern char *compile_time; load = cpuload(NULL); - cpuloadstr = (load < 5 ? I18N[572] : (load < 20 ? I18N[573] : I18N[574])); + cpuloadstr = (load < 5 ? gettext[572] : (load < 20 ? gettext[573] : gettext[574])); clear(); - showtitle(I18N[575], BBSNAME); + showtitle(gettext[575], BBSNAME); move(2, 0); - prints(I18N[576]); + prints(gettext[576]); prints(TITLE_COLOR BBSNAME); prints("\033[m (" MYIP); - prints(I18N[577], + prints(gettext[577], cpuloadstr, SHM->UTMPnumber, #ifdef DYMAX_ACTIVE GLOBALVAR[9] > 1000 ? GLOBALVAR[9] : MAX_ACTIVE, @@ -397,10 +397,10 @@ p_sysinfo(void) if (HAS_PERM(PERM_SYSOP)) { struct rusage ru; getrusage(RUSAGE_SELF, &ru); - prints(I18N[578], + prints(gettext[578], ((int)sbrk(0) - 0x8048000) / 1024, (int)ru.ru_idrss, (int)ru.ru_isrss); - prints(I18N[579] + prints(gettext[579] #ifdef CRITICAL_MEMORY " CRITICAL_MEMORY" #endif diff --git a/mbbsd/calendar.c b/mbbsd/calendar.c index 85f602ce..e544e767 100644 --- a/mbbsd/calendar.c +++ b/mbbsd/calendar.c @@ -188,15 +188,15 @@ FreeCalBuffer(char **buf) static int GenerateCalendar(char **buf, int y, int m, int today, event_t * e) { - char *week_str[7] = {SHM->i18nstr[cuser.language][2741], SHM->i18nstr[cuser.language][2742], SHM->i18nstr[cuser.language][2743], SHM->i18nstr[cuser.language][2744], SHM->i18nstr[cuser.language][2745], SHM->i18nstr[cuser.language][2746], SHM->i18nstr[cuser.language][2747]}; + char *week_str[7] = {gettext[2741], gettext[2742], gettext[2743], gettext[2744], gettext[2745], gettext[2746], gettext[2747]}; char *month_color[12] = { "\33[1;32m", "\33[1;33m", "\33[1;35m", "\33[1;36m", "\33[1;32m", "\33[1;33m", "\33[1;35m", "\33[1;36m", "\33[1;32m", "\33[1;33m", "\33[1;35m", "\33[1;36m" }; char *month_str[12] = { - SHM->i18nstr[cuser.language][2748], SHM->i18nstr[cuser.language][2749], SHM->i18nstr[cuser.language][2750], SHM->i18nstr[cuser.language][2751], SHM->i18nstr[cuser.language][2752], SHM->i18nstr[cuser.language][2753], - SHM->i18nstr[cuser.language][2754], SHM->i18nstr[cuser.language][2755], SHM->i18nstr[cuser.language][2756], SHM->i18nstr[cuser.language][2757], SHM->i18nstr[cuser.language][2758], SHM->i18nstr[cuser.language][2759] + gettext[2748], gettext[2749], gettext[2750], gettext[2751], gettext[2752], gettext[2753], + gettext[2754], gettext[2755], gettext[2756], gettext[2757], gettext[2758], gettext[2759] }; char *p, attr1[16], *attr2; @@ -292,7 +292,7 @@ calendar() for (i = 0; i < 22; i++) { outs(buf[i]); if (i == 0) { - prints(SHM->i18nstr[cuser.language][2760], + prints(gettext[2760], 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, diff --git a/mbbsd/card.c b/mbbsd/card.c index 97cb170b..a460c417 100644 --- a/mbbsd/card.c +++ b/mbbsd/card.c @@ -31,7 +31,7 @@ static int card_select(int *now) { char *cc[2] = {"\033[44m \033[m", - I18N[580]}; + gettext[580]}; while (1) { move(20, 0); @@ -79,55 +79,55 @@ static void card_display(int cline, int number, int flower, int show) { int color = 31; - char *cn[13] = {I18N[581], I18N[582], I18N[583], I18N[584], I18N[585], I18N[586], - I18N[587], I18N[588], I18N[589], "10", I18N[590], I18N[591], I18N[592]}; + char *cn[13] = {gettext[581], gettext[582], gettext[583], gettext[584], gettext[585], gettext[586], + gettext[587], gettext[588], gettext[589], "10", gettext[590], gettext[591], gettext[592]}; if (flower == 0 || flower == 3) color = 36; if ((show < 0) && (cline > 1 && cline < 8)) - prints(I18N[593]); + prints(gettext[593]); else switch (cline) { case 1: - prints(I18N[594]); + prints(gettext[594]); break; case 2: - prints(I18N[595], color, cn[number - 1]); + prints(gettext[595], color, cn[number - 1]); break; case 3: if (flower == 1) - prints(I18N[596], color); + prints(gettext[596], color); else - prints(I18N[597], color); + prints(gettext[597], color); break; case 4: if (flower == 1) - prints(I18N[598], color); + prints(gettext[598], color); else if (flower == 3) - prints(I18N[599], color); + prints(gettext[599], color); else - prints(I18N[600], color); + prints(gettext[600], color); break; case 5: if (flower == 0) - prints(I18N[601], color); + prints(gettext[601], color); else if (flower == 3) - prints(I18N[602], color); + prints(gettext[602], color); else - prints(I18N[603], color); + prints(gettext[603], color); break; case 6: if (flower == 0) - prints(I18N[604], color); + prints(gettext[604], color); else if (flower == 3) - prints(I18N[605], color); + prints(gettext[605], color); else - prints(I18N[606], color); + prints(gettext[606], color); break; case 7: - prints(I18N[607], color, cn[number - 1]); + prints(gettext[607], color, cn[number - 1]); break; case 8: - prints(I18N[608]); + prints(gettext[608]); break; } } @@ -176,11 +176,11 @@ card_start(char name[]) clear(); stand_title(name); move(1, 0); - prints(I18N[609]); + prints(gettext[609]); move(10, 0); - prints(I18N[610]); + prints(gettext[610]); move(19, 0); - prints(I18N[611]); + prints(gettext[611]); } static int @@ -262,14 +262,14 @@ card_99() int cpu[5], c[5], me[5], m[5]; int cards[52]; int count = 0; - char *ff[4] = {I18N[612], I18N[613], - I18N[614], I18N[615]}; - char *cn[13] = {I18N[616], I18N[617], I18N[618], I18N[619], I18N[620], I18N[621], - I18N[622], I18N[623], I18N[624], "10", I18N[625], I18N[626], I18N[627]}; + char *ff[4] = {gettext[612], gettext[613], + gettext[614], gettext[615]}; + char *cn[13] = {gettext[616], gettext[617], gettext[618], gettext[619], gettext[620], gettext[621], + gettext[622], gettext[623], gettext[624], "10", gettext[625], gettext[626], gettext[627]}; for (i = 0; i < 5; i++) cpu[i] = c[i] = me[i] = m[i] = -1; setutmpmode(CARD_99); - card_start(I18N[628]); + card_start(gettext[628]); card_new(cards); for (i = 0; i < 5; i++) { cpu[i] = card_give(cards); @@ -281,8 +281,8 @@ card_99() turn = 1; move(21, 0); clrtoeol(); - prints(I18N[629], count, 99 - count); - prints(I18N[630]); + prints(gettext[629], count, 99 - count); + prints(gettext[630]); while (1) { i = card_select(&j); if (i == 0) /* 放棄遊戲 */ @@ -290,7 +290,7 @@ card_99() count = card_99_add(card_number(me[j]), i, count); move(21 + (turn / 2) % 2, 0); clrtoeol(); - prints(I18N[631], + prints(gettext[631], turn, ff[card_flower(me[j])], cn[card_number(me[j]) - 1], count, 99 - count); me[j] = card_give(cards); @@ -302,14 +302,14 @@ card_99() if (count > 99) { move(22, 0); clrtoeol(); - prints(I18N[632], + prints(gettext[632], turn, count, 99 - count); pressanykey(); return 0; } i = card_99_cpu(cpu, &count); move(21 + (turn / 2 + 1) % 2, 40); - prints(I18N[633], + prints(gettext[633], turn, ff[card_flower(cpu[i])], cn[card_number(cpu[i]) - 1], count, 99 - count); cpu[i] = card_give(cards); @@ -319,7 +319,7 @@ card_99() if (count > 99) { move(22, 0); clrtoeol(); - prints(I18N[634], + prints(gettext[634], turn, count, 99 - count); pressanykey(); return 0; @@ -372,7 +372,7 @@ card_double_ask() char buf[100], buf2[3]; snprintf(buf, sizeof(buf), - I18N[635], + gettext[635], cuser.userid, cuser.money, JACK); reload_money(); if (cuser.money < JACK) @@ -388,7 +388,7 @@ card_ask() { char buf[100], buf2[3]; - snprintf(buf, sizeof(buf), I18N[636], + snprintf(buf, sizeof(buf), gettext[636], cuser.userid, cuser.money); getdata(20, 0, buf, buf2, sizeof(buf2), LCECHO); if (buf2[0] == 'y' || buf2[0] == 'Y') @@ -432,13 +432,13 @@ card_jack(int *db) if ((*db) < 0) { card_new(cards); - card_start(I18N[637]); + card_start(gettext[637]); for (i = 0; i < 2; i++) { cpu[i] = card_give(cards); me[i] = card_give(cards); } } else { - card_start(I18N[638]); + card_start(gettext[638]); cpu[0] = card_give(cards); cpu[1] = card_give(cards); me[0] = *db; @@ -450,11 +450,11 @@ card_jack(int *db) (card_number(me[1]) == 0 && card_number(me[0]) == 12)) { if (card_flower(me[0]) == 0 && card_flower(me[1]) == 0) { game_log(JACK, JACK * 10); - vmsg(I18N[639], JACK * 10); + vmsg(gettext[639], JACK * 10); return 0; } else { game_log(JACK, JACK * 5); - vmsg(I18N[640], JACK * 5); + vmsg(gettext[640], JACK * 5); return 0; } } @@ -463,7 +463,7 @@ card_jack(int *db) c[0] = 1; card_show(cpu, c, me, m); game_log(JACK, 0); - vmsg(I18N[641]); + vmsg(gettext[641]); return 0; } if ((*db < 0) && (card_number(me[0]) == card_number(me[1])) && @@ -479,20 +479,20 @@ card_jack(int *db) card_show(cpu, c, me, m); if (card_alls_lower(me) > 21) { game_log(JACK, 0); - vmsg(I18N[642]); + vmsg(gettext[642]); return 0; } i++; if ((i == 3) && (card_number(me[0]) == 7) && (card_number(me[1]) == 7) && (card_number(me[2]) == 7)) { game_log(JACK, JACK * 7); - vmsg(I18N[643], JACK * 7); + vmsg(gettext[643], JACK * 7); return 0; } } if (i == 5) { /* 過五關 */ game_log(JACK, JACK * 5); - vmsg(I18N[644], 5 * JACK); + vmsg(gettext[644], 5 * JACK); return 0; } j = 2; @@ -504,14 +504,14 @@ card_jack(int *db) if (card_alls_lower(cpu) > 21) { card_show(cpu, c, me, m); game_log(JACK, JACK * 2); - vmsg(I18N[645], JACK * 2); + vmsg(gettext[645], JACK * 2); return 0; } j++; } card_show(cpu, c, me, m); game_log(JACK, 0); - vmsg(I18N[646]); + vmsg(gettext[646]); return 0; } @@ -525,16 +525,16 @@ g_card_jack() while (1) { reload_money(); if (cuser.money < JACK) { - outs(I18N[647]); + outs(gettext[647]); return 0; } - getdata(b_lines - 1, 0, I18N[648], + getdata(b_lines - 1, 0, gettext[648], buf, 3, LCECHO); if ((*buf != 'y') && (*buf != 'Y')) break; else { db = -1; - vice(PMONEY, I18N[649]); + vice(PMONEY, gettext[649]); card_jack(&db); if (db >= 0) card_jack(&db); @@ -563,7 +563,7 @@ ten_helf() int cpu[5], c[5], me[5], m[5]; int cards[52]; - card_start(I18N[650]); + card_start(gettext[650]); card_new(cards); for (i = 0; i < 5; i++) cpu[i] = c[i] = me[i] = m[i] = -1; @@ -579,14 +579,14 @@ ten_helf() card_show(cpu, c, me, m); if (card_all(me) > 21) { game_log(TEN_HALF, 0); - vmsg(I18N[651]); + vmsg(gettext[651]); return 0; } i++; } if (i == 5) { /* 過五關 */ game_log(TEN_HALF, PMONEY * 5); - vmsg(I18N[652], 5 * PMONEY); + vmsg(gettext[652], 5 * PMONEY); return 0; } j = 1; @@ -598,14 +598,14 @@ ten_helf() if (card_all(cpu) > 21) { card_show(cpu, c, me, m); game_log(TEN_HALF, PMONEY * 2); - vmsg(I18N[653], PMONEY * 2); + vmsg(gettext[653], PMONEY * 2); return 0; } j++; } card_show(cpu, c, me, m); game_log(TEN_HALF, 0); - vmsg(I18N[654]); + vmsg(gettext[654]); return 0; } @@ -618,16 +618,16 @@ g_ten_helf() while (1) { reload_money(); if (cuser.money < TEN_HALF) { - outs(I18N[655]); + outs(gettext[655]); return 0; } getdata(b_lines - 1, 0, - I18N[656], + gettext[656], buf, 3, LCECHO); if (buf[0] != 'y' && buf[0] != 'Y') return 0; else { - vice(PMONEY, I18N[657]); + vice(PMONEY, gettext[657]); ten_helf(); } } diff --git a/mbbsd/chat.c b/mbbsd/chat.c index ee08b9b8..512d9a6f 100644 --- a/mbbsd/chat.c +++ b/mbbsd/chat.c @@ -18,7 +18,7 @@ printchatline(char *str) } outs(str); outc('\n'); - outs(I18N[658]); + outs(gettext[658]); if (flog) fprintf(flog, "%s\n", str); @@ -34,7 +34,7 @@ chat_clear() move(b_lines, 0); clrtoeol(); move(chatline = 2, 0); - outs(I18N[659]); + outs(gettext[659]); } static void @@ -92,7 +92,7 @@ chat_recv(int fd, char chatroom[IDLEN], char *chatid) case 't': move(0, 0); clrtoeol(); - prints(I18N[660], + prints(gettext[660], chatroom, bptr + 2); } } else @@ -131,7 +131,7 @@ printuserent(userinfo_t * uentp) uentp->invisible ? '#' : ' ', modestring(uentp, 1)); if (cnt < 2) - strcat(pline, I18N[661]); + strcat(pline, gettext[661]); strcat(uline, pline); if (++cnt == 3) { printchatline(uline); @@ -154,30 +154,30 @@ static void chat_help(char *arg) { if (strstr(arg, " op")) { - printchatline(I18N[662]); - chathelp("[/f]lag [+-][ls]", I18N[663]); - chathelp("[/i]nvite <id>", I18N[664]); - chathelp("[/k]ick <id>", I18N[665]); - chathelp("[/o]p <id>", I18N[666]); - chathelp("[/t]opic <text>", I18N[667]); - chathelp("[/w]all", I18N[668]); + printchatline(gettext[662]); + chathelp("[/f]lag [+-][ls]", gettext[663]); + chathelp("[/i]nvite <id>", gettext[664]); + chathelp("[/k]ick <id>", gettext[665]); + chathelp("[/o]p <id>", gettext[666]); + chathelp("[/t]opic <text>", gettext[667]); + chathelp("[/w]all", gettext[668]); } else { - chathelp("[//]help", I18N[669]); - chathelp("[/.]help", I18N[670]); - chathelp("[/h]elp op", I18N[671]); - chathelp("[/a]ct <msg>", I18N[672]); - chathelp("[/b]ye [msg]", I18N[673]); - chathelp("[/c]lear", I18N[674]); - chathelp("[/j]oin <room>", I18N[675]); - chathelp("[/l]ist [room]", I18N[676]); - chathelp("[/m]sg <id> <msg>", I18N[677]); - chathelp("[/n]ick <id>", I18N[678]); - chathelp("[/p]ager", I18N[679]); - chathelp("[/q]uery", I18N[680]); - chathelp("[/r]oom", I18N[681]); - chathelp("[/u]sers", I18N[682]); - chathelp("[/w]ho", I18N[683]); - chathelp("[/w]hoin <room>", I18N[684]); + chathelp("[//]help", gettext[669]); + chathelp("[/.]help", gettext[670]); + chathelp("[/h]elp op", gettext[671]); + chathelp("[/a]ct <msg>", gettext[672]); + chathelp("[/b]ye [msg]", gettext[673]); + chathelp("[/c]lear", gettext[674]); + chathelp("[/j]oin <room>", gettext[675]); + chathelp("[/l]ist [room]", gettext[676]); + chathelp("[/m]sg <id> <msg>", gettext[677]); + chathelp("[/n]ick <id>", gettext[678]); + chathelp("[/p]ager", gettext[679]); + chathelp("[/q]uery", gettext[680]); + chathelp("[/r]oom", gettext[681]); + chathelp("[/u]sers", gettext[682]); + chathelp("[/w]ho", gettext[683]); + chathelp("[/w]hoin <room>", gettext[684]); } } @@ -187,7 +187,7 @@ chat_date() char genbuf[200]; snprintf(genbuf, sizeof(genbuf), - I18N[686], BBSNAME, Cdate(&now)); + gettext[686], BBSNAME, Cdate(&now)); printchatline(genbuf); } @@ -196,8 +196,8 @@ chat_pager() { char genbuf[200]; - char *msgs[] = {I18N[687], I18N[688], I18N[689], I18N[690], I18N[691]}; - snprintf(genbuf, sizeof(genbuf), I18N[692], + char *msgs[] = {gettext[687], gettext[688], gettext[689], gettext[690], gettext[691]}; + snprintf(genbuf, sizeof(genbuf), gettext[692], msgs[currutmp->pager = (currutmp->pager + 1) % 5]); printchatline(genbuf); } @@ -214,14 +214,14 @@ chat_query(char *arg) char buf[128], *ptr; FILE *fp; - snprintf(buf, sizeof(buf), I18N[693], + snprintf(buf, sizeof(buf), gettext[693], xuser.userid, xuser.username, xuser.numlogins, xuser.numposts); printchatline(buf); snprintf(buf, sizeof(buf), - I18N[694], Cdate(&xuser.lastlogin), - (xuser.lasthost[0] ? xuser.lasthost : I18N[695])); + gettext[694], Cdate(&xuser.lastlogin), + (xuser.lasthost[0] ? xuser.lasthost : gettext[695])); printchatline(buf); sethomefile(buf, xuser.userid, fn_plans); @@ -242,13 +242,13 @@ static void chat_users() { char buf[256]; - snprintf(buf, sizeof(buf), "%s%s%s", I18N[696], BBSNAME, I18N[697]); + snprintf(buf, sizeof(buf), "%s%s%s", gettext[696], BBSNAME, gettext[697]); printchatline(""); printchatline(buf); printchatline(msg_shortulist); if (apply_ulist(printuserent) == -1) - printchatline(I18N[698]); + printchatline(gettext[698]); printuserent(NULL); } @@ -309,7 +309,7 @@ t_chat() int chatting = YEA; char fpath[80]; - outs(I18N[699]); + outs(gettext[699]); if (!(h = gethostbyname("localhost"))) { perror("gethostbyname"); return -1; @@ -323,7 +323,7 @@ t_chat() sin.sin_port = htons(NEW_CHATPORT); cfd = socket(sin.sin_family, SOCK_STREAM, 0); if (connect(cfd, (struct sockaddr *) & sin, sizeof sin) != 0) { - outs(I18N[700]); + outs(gettext[700]); system("bin/xchatd"); pressanykey(); close(cfd); @@ -331,7 +331,7 @@ t_chat() } while (1) { - getdata(b_lines - 1, 0, I18N[701], chatid, 9, DOECHO); + getdata(b_lines - 1, 0, gettext[701], chatid, 9, DOECHO); if(!chatid[0]) strlcpy(chatid, cuser.userid, sizeof(chatid)); chatid[8] = '\0'; @@ -348,11 +348,11 @@ t_chat() if (!strcmp(inbuf, CHAT_LOGIN_OK)) break; else if (!strcmp(inbuf, CHAT_LOGIN_EXISTS)) - ptr = I18N[702]; + ptr = gettext[702]; else if (!strcmp(inbuf, CHAT_LOGIN_INVALID)) - ptr = I18N[703]; + ptr = gettext[703]; else if (!strcmp(inbuf, CHAT_LOGIN_BOGUS)) - ptr = I18N[704]; + ptr = gettext[704]; move(b_lines - 2, 0); outs(ptr); @@ -376,7 +376,7 @@ t_chat() move(STOP_LINE, 0); outs(msg_seperator); move(STOP_LINE, 60); - outs(I18N[705]); + outs(gettext[705]); move(1, 0); outs(msg_seperator); print_chatid(chatid); @@ -413,7 +413,7 @@ t_chat() if (!newmail && currutmp->mailalert) { newmail = 1; - printchatline(I18N[706]); + printchatline(gettext[706]); } if (ch == I_OTHERDATA) {/* incoming */ if (chat_recv(cfd, chatroom, chatid) == -1) { @@ -514,7 +514,7 @@ t_chat() fclose(flog); more(fpath, NA); - getdata(b_lines - 1, 0, I18N[707], + getdata(b_lines - 1, 0, gettext[707], ans, sizeof(ans), LCECHO); if (*ans == 'm') { fileheader_t mymail; @@ -524,8 +524,8 @@ t_chat() sethomepath(genbuf, cuser.userid); stampfile(genbuf, &mymail); mymail.filemode = FILE_READ ; - strlcpy(mymail.owner, I18N[708], sizeof(mymail.owner)); - strlcpy(mymail.title, I18N[709], sizeof(mymail.title)); + strlcpy(mymail.owner, gettext[708], sizeof(mymail.owner)); + strlcpy(mymail.title, gettext[709], sizeof(mymail.title)); sethomedir(title, cuser.userid); append_record(title, &mymail, sizeof(mymail)); Rename(fpath, genbuf); diff --git a/mbbsd/chc.c b/mbbsd/chc.c index c0a040a9..8d8e54ba 100644 --- a/mbbsd/chc.c +++ b/mbbsd/chc.c @@ -111,7 +111,7 @@ getstep(board_t board, rc_t *from, rc_t *to) fc = (turn == (chc_my ^ 1) ? from->c + 1 : 9 - from->c); tc = (turn == (chc_my ^ 1) ? to->c + 1 : 9 - to->c); if (from->r == to->r) - dir = I18N[758]; + dir = gettext[758]; else { if (from->c == to->c) tc = from->r - to->r; @@ -120,9 +120,9 @@ getstep(board_t board, rc_t *from, rc_t *to) if ((turn == (chc_my ^ 1) && to->r > from->r) || (turn == chc_my && to->r < from->r)) - dir = I18N[759]; + dir = gettext[759]; else - dir = I18N[760]; + dir = gettext[760]; } sprintf(buf, "%s%s%s%s", chess_str[turn][CHE_P(board[from->r][from->c])], @@ -139,7 +139,7 @@ showstep(board_t board) eatten = board[chc_to.r][chc_to.c]; if (eatten) - prints(I18N[761], + prints(gettext[761], CHE_O(eatten) == 0 ? BLACK_COLOR : RED_COLOR, chess_str[CHE_O(eatten)][CHE_P(eatten)]); prints("\033[m"); @@ -153,8 +153,8 @@ chc_drawline(board_t board, chcusr_t *user1, chcusr_t *user2, int line) move(line, 0); clrtoeol(); if (line == 0) { - prints(I18N[762], - user1->userid, user2->userid, chc_mode & CHC_WATCH ? I18N[763] : ""); + prints(gettext[762], + user1->userid, user2->userid, chc_mode & CHC_WATCH ? gettext[763] : ""); } else if (line >= 3 && line <= 21) { outs(" "); for (i = 0; i < 9; i++) { @@ -181,25 +181,25 @@ chc_drawline(board_t board, chcusr_t *user1, chcusr_t *user2, int line) if (line >= 3 && line < 3 + (int)dim(hint_str)) { outs(hint_str[line - 3]); } else if (line == SIDE_ROW) { - prints(I18N[764], + prints(gettext[764], chc_my == 0 ? BLACK_COLOR : RED_COLOR, - I18N[710 + chc_my]); + gettext[710 + chc_my]); } else if (line == TURN_ROW) { prints("%s%s\033[m", TURN_COLOR, - chc_my == chc_turn ? I18N[765] : I18N[766]); + chc_my == chc_turn ? gettext[765] : gettext[766]); } else if (line == STEP_ROW && !chc_firststep) { showstep(board); } else if (line == TIME_ROW) { - prints(I18N[767], chc_lefttime / 60, chc_lefttime % 60); + prints(gettext[767], chc_lefttime / 60, chc_lefttime % 60); } else if (line == WARN_ROW) { outs(chc_warnmsg); } else if (line == MYWIN_ROW) { - prints(I18N[768], + prints(gettext[768], user1->userid, user1->win, user1->lose - 1, user1->tie); } else if (line == HISWIN_ROW) { - prints(I18N[769], + prints(gettext[769], user2->userid, user2->win, user2->lose - 1, user2->tie); } @@ -334,21 +334,21 @@ chc_init_board(board_t board) board[6][6] = board[6][8] = CHE(7, chc_my); /* 兵 */ for (i = 1; i < 10; i++) { - num_str[i] = I18N[711 + i]; + num_str[i] = gettext[711 + i]; } num_str[0] = ""; for (i = 0; i < 2; i++) for (j = 1; j < 8; j++) { - chess_str[i][j] = I18N[720 + i * 7 + j]; + chess_str[i][j] = gettext[720 + i * 7 + j]; } chess_str[0][0] = chess_str[1][0] = " "; for (i = 0; i < BRD_ROW * 2 - 1; i++) - chess_brd[i] = I18N[735 + i]; + chess_brd[i] = gettext[735 + i]; for (i = 0; i < 4; i++) - hint_str[i] = I18N[754 + i]; + hint_str[i] = gettext[754 + i]; } static void @@ -579,7 +579,7 @@ hisplay(int s, chcusr_t *user1, chcusr_t *user2, board_t board, board_t tmpbrd) } else { if (chc_from.r == -1) { chc_hepass = 1; - strlcpy(chc_warnmsg, I18N[770], sizeof(chc_warnmsg)); + strlcpy(chc_warnmsg, gettext[770], sizeof(chc_warnmsg)); chc_drawline(board, user1, user2, WARN_ROW); } else { /* 座標變換 @@ -672,7 +672,7 @@ myplay(int s, chcusr_t *user1, chcusr_t *user2, board_t board, board_t tmpbrd) chc_ipass = 1; chc_from.r = -1; chc_broadcast_send(act_list, board); - strlcpy(chc_warnmsg, I18N[771], sizeof(chc_warnmsg)); + strlcpy(chc_warnmsg, gettext[771], sizeof(chc_warnmsg)); chc_drawline(board, user1, user2, WARN_ROW); bell(); break; @@ -703,7 +703,7 @@ myplay(int s, chcusr_t *user1, chcusr_t *user2, board_t board, board_t tmpbrd) chc_drawline(board, user1, user2, LTR(chc_to.r)); endturn = 1; } else { - strlcpy(chc_warnmsg, I18N[772], sizeof(chc_warnmsg)); + strlcpy(chc_warnmsg, gettext[772], sizeof(chc_warnmsg)); bell(); chc_drawline(board, user1, user2, WARN_ROW); } @@ -733,7 +733,7 @@ mainloop(int s, chcusr_t *user1, chcusr_t *user2, board_t board, play_func_t pla chc_firststep = 0; chc_drawline(board, user1, user2, TURN_ROW); if (chc_ischeck(board, chc_turn)) { - strlcpy(chc_warnmsg, I18N[773], sizeof(chc_warnmsg)); + strlcpy(chc_warnmsg, gettext[773], sizeof(chc_warnmsg)); bell(); } else chc_warnmsg[0] = 0; @@ -743,15 +743,15 @@ mainloop(int s, chcusr_t *user1, chcusr_t *user2, board_t board, play_func_t pla if (chc_mode & CHC_VERSUS) { if (endgame == 1) { - strlcpy(chc_warnmsg, I18N[774], sizeof(chc_warnmsg)); + strlcpy(chc_warnmsg, gettext[774], sizeof(chc_warnmsg)); user1->win++; currutmp->chc_win++; } else if (endgame == 2) { - strlcpy(chc_warnmsg, I18N[775], sizeof(chc_warnmsg)); + strlcpy(chc_warnmsg, gettext[775], sizeof(chc_warnmsg)); user1->lose++; currutmp->chc_lose++; } else { - strlcpy(chc_warnmsg, I18N[776], sizeof(chc_warnmsg)); + strlcpy(chc_warnmsg, gettext[776], sizeof(chc_warnmsg)); user1->tie++; currutmp->chc_tie++; } @@ -760,17 +760,17 @@ mainloop(int s, chcusr_t *user1, chcusr_t *user2, board_t board, play_func_t pla passwd_update(usernum, &cuser); } else if (chc_mode & CHC_WATCH) { - strlcpy(chc_warnmsg, I18N[777], sizeof(chc_warnmsg)); + strlcpy(chc_warnmsg, gettext[777], sizeof(chc_warnmsg)); } else { - strlcpy(chc_warnmsg, I18N[778], sizeof(chc_warnmsg)); + strlcpy(chc_warnmsg, gettext[778], sizeof(chc_warnmsg)); } chc_log("=> "); if (endgame == 3) - chc_log(I18N[779]); + chc_log(gettext[779]); else{ - sprintf(buf, I18N[780], chc_my && endgame == 1 ? I18N[781] : I18N[782]); + sprintf(buf, gettext[780], chc_my && endgame == 1 ? gettext[781] : gettext[782]); chc_log(buf); } @@ -911,7 +911,7 @@ chc(int s, int mode) setuserfile(file, CHC_LOG); if (chc_log_open(&user1, &user2, file) < 0) - vmsg(I18N[783]); + vmsg(gettext[783]); mainloop(s, &user1, &user2, board, play_func); @@ -929,13 +929,13 @@ chc(int s, int mode) currutmp->mode = mode0; - if (getans(I18N[784]) == 'y') { + if (getans(gettext[784]) == 'y') { char title[80]; sprintf(title, "%s V.S. %s", user1.userid, user2.userid); chc_log("\n--\n\n"); chc_log_poem(); chc_log_close(); - mail_id(cuser.userid, title, file, I18N[785]); + mail_id(cuser.userid, title, file, gettext[785]); } else chc_log_close(); @@ -948,7 +948,7 @@ chc_init_utmp(void) char uident[16]; userinfo_t *uin; - stand_title(I18N[786]); + stand_title(gettext[786]); generalnamecomplete(msg_uid, uident, sizeof(uident), SHM->UTMPnumber, completeutmp_compar, @@ -999,11 +999,11 @@ chc_watch(void) if (uin->uid == currutmp->uid || uin->mode != CHC) return -1; - if (getans(I18N[787]) != 'y') + if (getans(gettext[787]) != 'y') return 0; if ((sock = make_connection_to_somebody(uin, 10)) < 0) { - vmsg(I18N[788]); + vmsg(gettext[788]); return -1; } msgsock = accept(sock, (struct sockaddr *) 0, (socklen_t *) 0); diff --git a/mbbsd/chicken.c b/mbbsd/chicken.c index fe075e9c..a0ad7e0f 100644 --- a/mbbsd/chicken.c +++ b/mbbsd/chicken.c @@ -85,8 +85,8 @@ new_chicken() clear(); move(2, 0); - outs(I18N[867]); - i = getans(I18N[868]); + outs(gettext[867]); + i = getans(gettext[868]); i -= 'a'; if (i < 0 || i > NUM_KINDS - 1) @@ -97,15 +97,15 @@ new_chicken() reload_money(); price = egg_price[(int)mychicken->type]; if (cuser.money < price) { - vmsg(I18N[869], price); + vmsg(gettext[869], price); return 0; } - vice(price, I18N[870]); + vice(price, gettext[870]); while (strlen(mychicken->name) < 3) - getdata(8, 0, I18N[871], mychicken->name, + getdata(8, 0, gettext[871], mychicken->name, sizeof(mychicken->name), DOECHO); - log_file(CHICKENLOG, 1, I18N[872], + log_file(CHICKENLOG, 1, gettext[872], cuser.userid, mychicken->name, chicken_type[(int)mychicken->type], ctime(&now)); mychicken->lastvisit = mychicken->birthday = mychicken->cbirth = now; @@ -151,11 +151,11 @@ show_chicken_stat(chicken_t * thechicken) struct tm *ptime; ptime = localtime(&thechicken->birthday); - prints(I18N[873], + prints(gettext[873], thechicken->name, chicken_type[(int)thechicken->type], 15 - strlen(thechicken->name), "", ptime->tm_year % 100, ptime->tm_mon + 1, ptime->tm_mday, - I18N[age > 16 ? 789 : age + 789], + gettext[age > 16 ? 789 : age + 789], age, thechicken->hp, thechicken->hp_max, thechicken->mm, thechicken->mm_max, thechicken->attack, thechicken->run, thechicken->book, @@ -180,7 +180,7 @@ show_chicken_data(chicken_t * thechicken, chicken_t * pkchicken) /* Ptt:debug */ thechicken->type %= NUM_KINDS; clear(); - showtitle(pkchicken ? I18N[874] : I18N[875], BBSName); + showtitle(pkchicken ? gettext[874] : gettext[875], BBSName); move(1, 0); show_chicken_stat(thechicken); @@ -192,48 +192,48 @@ show_chicken_data(chicken_t * thechicken, chicken_t * pkchicken) move(18, 0); if (thechicken->sick) - outs(I18N[876]); + outs(gettext[876]); if (thechicken->sick > thechicken->hp / 5) - outs(I18N[877]); + outs(gettext[877]); if (thechicken->clean > 150) - outs(I18N[878]); + outs(gettext[878]); else if (thechicken->clean > 80) - outs(I18N[879]); + outs(gettext[879]); else if (thechicken->clean < 20) - outs(I18N[880]); + outs(gettext[880]); if (thechicken->weight > thechicken->hp_max * 4) - outs(I18N[881]); + outs(gettext[881]); else if (thechicken->weight > thechicken->hp_max * 3) - outs(I18N[882]); + outs(gettext[882]); else if (thechicken->weight < (thechicken->hp_max / 4)) - outs(I18N[883]); + outs(gettext[883]); else if (thechicken->weight < (thechicken->hp_max / 2)) - outs(I18N[884]); + outs(gettext[884]); if (thechicken->tiredstrong > thechicken->hp * 1.7) - outs(I18N[885]); + outs(gettext[885]); else if (thechicken->tiredstrong > thechicken->hp) - outs(I18N[886]); + outs(gettext[886]); else if (thechicken->tiredstrong < thechicken->hp / 4) - outs(I18N[887]); + outs(gettext[887]); if (thechicken->hp < thechicken->hp_max / 4) - outs(I18N[888]); + outs(gettext[888]); if (thechicken->happy > 500) - outs(I18N[889]); + outs(gettext[889]); else if (thechicken->happy < 100) - outs(I18N[890]); + outs(gettext[890]); if (thechicken->satis > 500) - outs(I18N[891]); + outs(gettext[891]); else if (thechicken->satis < 50) - outs(I18N[892]); + outs(gettext[892]); if (pkchicken) { outs("\n"); show_chicken_stat(pkchicken); - outs(I18N[893]); + outs(gettext[893]); } } @@ -271,7 +271,7 @@ ch_clean() static void ch_guess() { - char *guess[3] = {I18N[894], I18N[895], I18N[896]}, me, ch, win; + char *guess[3] = {gettext[894], gettext[895], gettext[896]}, me, ch, win; chicken_t *mychicken = &cuser.mychicken; mychicken->happy += time_change[(int)mychicken->type][HAPPY] * 1.5; @@ -280,7 +280,7 @@ ch_guess() mychicken->attack += time_change[(int)mychicken->type][ATTACK] / 4; move(20, 0); clrtobot(); - outs(I18N[897]); + outs(gettext[897]); me = igetch(); me -= '1'; if (me > 2 || me < 0) @@ -289,7 +289,7 @@ ch_guess() ch = (me + win + 3) % 3; prints("%s:%s ! %s:%s !.....%s", cuser.userid, guess[(int)me], mychicken->name, guess[(int)ch], - win == 0 ? I18N[898] : win < 0 ? I18N[899] : I18N[900]); + win == 0 ? gettext[898] : win < 0 ? gettext[899] : gettext[900]); pressanykey(); } @@ -343,7 +343,7 @@ ch_buyitem(int money, char *picture, int *item, int haveticket) int num = 0; char buf[5]; - getdata_str(b_lines - 1, 0, I18N[901], + getdata_str(b_lines - 1, 0, gettext[901], buf, sizeof(buf), DOECHO, "1"); num = atoi(buf); if (num < 1) @@ -352,13 +352,13 @@ ch_buyitem(int money, char *picture, int *item, int haveticket) if (cuser.money > money * num) { *item += num; if( haveticket ) - vice(money * num, I18N[902]); + vice(money * num, gettext[902]); else demoney(-money * num); show_file(picture, 5, 14, NO_RELOAD); pressanykey(); } else { - vmsg(I18N[903]); + vmsg(gettext[903]); } } @@ -399,13 +399,13 @@ ch_kill() chicken_t *mychicken = &cuser.mychicken; int ans; - ans = getans(I18N[904]); + ans = getans(gettext[904]); if (ans == 'y') { - vice(100, I18N[905]); + vice(100, gettext[905]); more(CHICKEN_PIC "/deadth", YEA); - log_file(CHICKENLOG, 1, - I18N[906], cuser.userid, mychicken->name, + log_file(CHICKENLOG, LOG_CREAT | LOG_VF, + gettext[906], cuser.userid, mychicken->name, chicken_type[(int)mychicken->type], ctime(&now)); mychicken->name[0] = 0; } @@ -443,24 +443,24 @@ ch_sell() money = MAX_CHICKEN_MONEY; //防止怪雞 if (mychicken->type == 1 || mychicken->type == 7) { - outs(I18N[907]); + outs(gettext[907]); pressanykey(); return 0; } if (age < 5) { - outs(I18N[908]); + outs(gettext[908]); pressanykey(); return 0; } if (age > 30) { - outs(I18N[909]); + outs(gettext[909]); pressanykey(); return 0; } - ans = getans(I18N[910], age, + ans = getans(gettext[910], age, chicken_type[(int)mychicken->type], money); if (ans == 'y') { - log_file(CHICKENLOG, 1, I18N[911], + log_file(CHICKENLOG, LOG_CREAT | LOG_VF, gettext[911], cuser.userid, mychicken->name, chicken_type[(int)mychicken->type], money, ctime(&now)); mychicken->lastvisit = mychicken->name[0] = 0; @@ -615,8 +615,8 @@ deadtype(chicken_t * thechicken) return 0; if (thechicken == mychicken) { - log_file(CHICKENLOG, 1, - I18N[912], + log_file(CHICKENLOG, LOG_CREAT | LOG_VF, + gettext[912], cuser.userid, thechicken->name, chicken_type[(int)thechicken->type], ctime(&now)); mychicken->name[0] = 0; @@ -667,12 +667,12 @@ ch_changename() chicken_t *mychicken = &cuser.mychicken; char newname[20] = ""; - getdata_str(b_lines - 1, 0, I18N[913], newname, 18, DOECHO, + getdata_str(b_lines - 1, 0, gettext[913], newname, 18, DOECHO, mychicken->name); if (strlen(newname) >= 3 && strcmp(newname, mychicken->name)) { strlcpy(mychicken->name, newname, sizeof(mychicken->name)); - log_file(CHICKENLOG, 1, I18N[914], + log_file(CHICKENLOG, LOG_CREAT | LOG_VF, gettext[914], cuser.userid, mychicken->name, chicken_type[(int)mychicken->type], newname, ctime(&now)); } @@ -686,7 +686,7 @@ select_menu() reload_money(); move(19, 0); - prints(I18N[915], + prints(gettext[915], cuser.money, /* * chicken_food[(int)mychicken->type], @@ -766,38 +766,38 @@ recover_chicken(chicken_t * thechicken) if (now - thechicken->lastvisit > (60 * 60 * 24 * 7)) return 0; - outmsg(I18N[916]); + outmsg(gettext[916]); bell(); igetch(); - outmsg(I18N[917]); + outmsg(gettext[917]); bell(); igetch(); - snprintf(buf, sizeof(buf), I18N[918], + snprintf(buf, sizeof(buf), gettext[918], chicken_type[(int)thechicken->type], price * 2); outmsg(buf); bell(); - getdata_str(21, 0, I18N[919], buf, 3, LCECHO, "N"); + getdata_str(21, 0, gettext[919], buf, 3, LCECHO, "N"); if (buf[0] == 'y' || buf[0] == 'Y') { reload_money(); if (cuser.money < price * 2) { - outmsg(I18N[920]); + outmsg(gettext[920]); bell(); igetch(); return 0; } - strlcpy(thechicken->name, I18N[921], sizeof(thechicken->name)); + strlcpy(thechicken->name, gettext[921], sizeof(thechicken->name)); thechicken->hp = thechicken->hp_max; thechicken->sick = 0; thechicken->satis = 2; - vice(money, I18N[922]); + vice(money, gettext[922]); snprintf(buf, sizeof(buf), - I18N[923], money); + gettext[923], money); outmsg(buf); bell(); igetch(); return 1; } - outmsg(I18N[924]); + outmsg(gettext[924]); bell(); igetch(); thechicken->lastvisit = 0; @@ -807,21 +807,21 @@ recover_chicken(chicken_t * thechicken) #define lockreturn0(unmode, state) if(lockutmpmode(unmode, state)) return 0 -void copy_i18nstring() { +void copy_gettextstring() { int i; for (i = 0; i < NUM_KINDS; i++) { - chicken_type[i] = I18N[806 + i]; - chicken_food[i] = I18N[821 + i]; - attack_type[i] = I18N[836 + i]; + chicken_type[i] = gettext[806 + i]; + chicken_food[i] = gettext[821 + i]; + attack_type[i] = gettext[836 + i]; } for (i = 0; i < 16; i++) - damage_degree[i] = I18N[851 + i]; + damage_degree[i] = gettext[851 + i]; } int chicken_main() { chicken_t *mychicken = &cuser.mychicken; - copy_i18nstring(); + copy_gettextstring(); lockreturn0(CHICKEN, LOCK_MULTI); reload_chicken(); age = ((now - mychicken->cbirth) / (60 * 60 * 24)); @@ -864,7 +864,7 @@ chickenpk(int fd) reload_chicken(); if (!ochicken->name[0] || !mychicken->name[0]) { bell(); - vmsg(I18N[925]); /* Ptt:妨止page時把寵物賣掉 */ + vmsg(gettext[925]); /* Ptt:妨止page時把寵物賣掉 */ add_io(0, 0); close(fd); unlockutmpmode(); @@ -895,11 +895,11 @@ chickenpk(int fd) case 'c': catched = 1; move(16, 0); - outs(I18N[926]); + outs(gettext[926]); break; case 'd': move(16, 0); - outs(I18N[927]); + outs(gettext[927]); break; } if (data[0] == 'd' || data[0] == 'q' || data[0] == 'l') @@ -914,7 +914,7 @@ chickenpk(int fd) case 'y': if (catched == 1) { snprintf(data, sizeof(data), - I18N[928], ochicken->name); + gettext[928], ochicken->name); } break; case 'n': @@ -924,14 +924,14 @@ chickenpk(int fd) r = r % (attmax + 2); if (r) { snprintf(data, sizeof(data), - I18N[929], mychicken->name, + gettext[929], mychicken->name, damage_degree[r / 3 > 15 ? 15 : r / 3], attack_type[(int)mychicken->type], ochicken->name, r); ochicken->hp -= r; } else snprintf(data, sizeof(data), - I18N[930], mychicken->name); + gettext[930], mychicken->name); break; case 'o': if (mychicken->oo > 0) { @@ -940,27 +940,27 @@ chickenpk(int fd) if (mychicken->hp > mychicken->hp_max) mychicken->hp = mychicken->hp_max; mychicken->tiredstrong = 0; - snprintf(data, sizeof(data), I18N[931], + snprintf(data, sizeof(data), gettext[931], mychicken->name); } else snprintf(data, sizeof(data), - I18N[932], + gettext[932], mychicken->name); break; case 'q': if (r % (mychicken->run + 1) > r % (ochicken->run + 1)) - snprintf(data, sizeof(data), I18N[933], + snprintf(data, sizeof(data), gettext[933], mychicken->name); else snprintf(data, sizeof(data), - I18N[934], + gettext[934], mychicken->name, ochicken->name); break; } if (deadtype(ochicken)) { strtok(data, "\n"); strlcpy(buf, data, sizeof(buf)); - snprintf(data, sizeof(data), I18N[935], + snprintf(data, sizeof(data), gettext[935], buf + 1, ochicken->name, mychicken->name); } move(17, 0); diff --git a/mbbsd/dark.c b/mbbsd/dark.c index 45528bfc..50b08fe2 100644 --- a/mbbsd/dark.c +++ b/mbbsd/dark.c @@ -121,7 +121,7 @@ brd_prints() { clear(); move(1, 0); - outs(I18N[950]); + outs(gettext[950]); } static void @@ -135,18 +135,18 @@ draw_line(sint y, sint f) strlcpy(buf, "\033[43;30m", sizeof(buf)); for (i = 0; i < 8; i++) { if (brd[y][i].die == 1) - snprintf(tmp, sizeof(tmp), I18N[951]); + snprintf(tmp, sizeof(tmp), gettext[951]); else if (brd[y][i].out == 0) - snprintf(tmp, sizeof(tmp), I18N[952]); + snprintf(tmp, sizeof(tmp), gettext[952]); else { - snprintf(tmp, sizeof(tmp), I18N[953], + snprintf(tmp, sizeof(tmp), gettext[953], (f == i) ? "1;47;" : "", (brd[y][i].color) ? 31 : 34, - (brd[y][i].color) ? I18N[936 + brd[y][i].value] : - I18N[943 + brd[y][i].value]); + (brd[y][i].color) ? gettext[936 + brd[y][i].value] : + gettext[943 + brd[y][i].value]); } strcat(buf, tmp); } - strcat(buf, I18N[954]); + strcat(buf, gettext[954]); move(cury[y], 3); clrtoeol(); @@ -272,7 +272,7 @@ playing(sint fd, sint color, sint ch, sint * b, userinfo_t * uin) case 'u': move(0, 0); clrtoeol(); - prints(I18N[955], (brd[my][mx].color == RED) ? I18N[956] : I18N[957], I18N[936 + brd[my][mx].value], cont); + prints(gettext[955], (brd[my][mx].color == RED) ? gettext[956] : gettext[957], gettext[936 + brd[my][mx].value], cont); *b = -1; break; case '\r': /* 吃 or 移動 ly跟lx必須大於0 */ @@ -294,7 +294,7 @@ playing(sint fd, sint color, sint ch, sint * b, userinfo_t * uin) else rcount--; move(cur_eaty, cur_eatx); - prints("%s", (color) ? I18N[943 + brd[my][mx].value] : I18N[brd[my][mx].value]); + prints("%s", (color) ? gettext[943 + brd[my][mx].value] : gettext[brd[my][mx].value]); if (cur_eatx >= 26) { cur_eatx = 5; cur_eaty++; @@ -349,15 +349,15 @@ main_dark(int fd, userinfo_t * uin) if (currutmp->turn) { brd_rand(); send(fd, &brd, sizeof(brd), 0); - mouts(21, 0, I18N[958]); - mouts(22, 0, I18N[959]); + mouts(21, 0, gettext[958]); + mouts(22, 0, gettext[959]); } else { recv(fd, &brd, sizeof(brd), 0); - mouts(21, 0, I18N[960]); + mouts(21, 0, gettext[960]); } move(12, 3); - prints(I18N[961], currutmp->userid, currutmp->mateid); - outs(I18N[962]); + prints(gettext[961], currutmp->userid, currutmp->mateid); + outs(gettext[962]); if (currutmp->turn) move(cury[0], curx[0]); @@ -384,11 +384,11 @@ main_dark(int fd, userinfo_t * uin) break; } if (curr.end == -3) - mouts(23, 30, I18N[963]); + mouts(23, 30, gettext[963]); else if (curr.end == -4) - mouts(23, 30, I18N[964]); + mouts(23, 30, gettext[964]); else if (curr.end == -5) - mouts(23, 30, I18N[965]); + mouts(23, 30, gettext[965]); else mouts(23, 30, ""); @@ -397,7 +397,7 @@ main_dark(int fd, userinfo_t * uin) mx = curr.x; redraw(); if (curr.end) - mouts(22, 0, I18N[966]); + mouts(22, 0, gettext[966]); move(cury[my], curx[mx]); } else { if (currutmp->turn == 'p') { @@ -414,7 +414,7 @@ main_dark(int fd, userinfo_t * uin) if (ch == 'y') { currutmp->color = (currutmp->color == '1') ? '0' : '1'; uin->color = (uin->color == '1') ? '0' : '1'; - mouts(21, 0, (currutmp->color == '1') ? I18N[967] : I18N[968]); + mouts(21, 0, (currutmp->color == '1') ? gettext[967] : gettext[968]); } else { mouts(23, 30, ""); currutmp->turn = (uin->turn) ? 0 : 1; @@ -422,7 +422,7 @@ main_dark(int fd, userinfo_t * uin) } else if (currutmp->turn == 'g') { if (ch == 'y') { cont = 1; - mouts(21, 0, I18N[969]); + mouts(21, 0, gettext[969]); } else { mouts(23, 30, ""); currutmp->turn = (uin->turn) ? 0 : 1; @@ -432,7 +432,7 @@ main_dark(int fd, userinfo_t * uin) if (uin->turn == 'g') { cont = 1; uin->turn = (currutmp->turn) ? 0 : 1; - mouts(21, 10, I18N[970]); + mouts(21, 10, gettext[970]); } end = playing(fd, currutmp->color - '0', ch, &go_on, uin); @@ -465,12 +465,12 @@ main_dark(int fd, userinfo_t * uin) continue; } if (!i && currutmp->color == '1') { - mouts(21, 0, I18N[971]); + mouts(21, 0, gettext[971]); i++; move(cury[my], curx[mx]); } if (!i && currutmp->color == '0') { - mouts(21, 0, I18N[972]); + mouts(21, 0, gettext[972]); i++; move(cury[my], curx[mx]); } @@ -483,7 +483,7 @@ main_dark(int fd, userinfo_t * uin) move(22, 0); clrtoeol(); - prints(I18N[973], currutmp->mateid); + prints(gettext[973], currutmp->mateid); currutmp->turn = 0; uin->turn = 1; } else { @@ -493,7 +493,7 @@ main_dark(int fd, userinfo_t * uin) } move(22, 0); clrtoeol(); - prints(I18N[974], currutmp->mateid); + prints(gettext[974], currutmp->mateid); } } } @@ -504,15 +504,15 @@ main_dark(int fd, userinfo_t * uin) if (currutmp->turn == 'w') { move(22, 0); clrtoeol(); - prints(I18N[975]); + prints(gettext[975]); } else { move(22, 0); clrtoeol(); - prints(I18N[976]); + prints(gettext[976]); } break; case -3: - mouts(22, 0, I18N[977]); + mouts(22, 0, gettext[977]); break; default: add_io(0, 0); diff --git a/mbbsd/dice.c b/mbbsd/dice.c index 164d686e..a8abd8b5 100644 --- a/mbbsd/dice.c +++ b/mbbsd/dice.c @@ -95,18 +95,18 @@ static void show_data(void) { move(0, 0); - prints(I18N[3441]); - prints(I18N[3442]); - prints(I18N[3443]); - prints(I18N[3444]); - prints(I18N[3445]); - prints(I18N[3446]); - prints(I18N[3447]); - prints(I18N[3448]); - prints(I18N[3449]); - prints(I18N[3450]); - prints(I18N[3451]); - prints(I18N[3452]); + prints(gettext[3441]); + prints(gettext[3442]); + prints(gettext[3443]); + prints(gettext[3444]); + prints(gettext[3445]); + prints(gettext[3446]); + prints(gettext[3447]); + prints(gettext[3448]); + prints(gettext[3449]); + prints(gettext[3450]); + prints(gettext[3451]); + prints(gettext[3452]); } static void @@ -175,7 +175,7 @@ del(int value[100],int total, dicedata_t * table) do { move(22, 0); clrtoeol(); - getdata(21, 0, I18N[3453], data, 3, LCECHO); + getdata(21, 0, gettext[3453], data, 3, LCECHO); if (data[0] == 'q' || data[0] == 'Q') return 0; } while (!IsNum(data, strlen(data))); @@ -184,20 +184,20 @@ del(int value[100],int total, dicedata_t * table) for (i = 0; i < total; i++) { if (table[i].mybet == index) { do { - getdata(21, 0, I18N[3454], data, 10, LCECHO); + getdata(21, 0, gettext[3454], data, 10, LCECHO); } while (!IsNum(data, strlen(data))); money = atoi(data); if (money > table[i].mymoney) { move(22, 0); clrtoeol(); - prints(I18N[3455]); + prints(gettext[3455]); i--; continue; } demoney(money); move(19, 0); clrtoeol(); - prints(I18N[3456], cuser.money); + prints(gettext[3456], cuser.money); table[i].mymoney -= money; show_count(value, index, -money); break; @@ -229,81 +229,81 @@ show_output(int bet[]) prints(" "); } move(12, 0); - prints(I18N[3457]); - prints(I18N[3458]); + prints(gettext[3457]); + prints(gettext[3458]); for (i = 0; i < 3; i++, j += 25) { switch (bet[i]) { case 1: move(13, j); - prints(I18N[3459]); + prints(gettext[3459]); move(14, j); - prints(I18N[3460]); + prints(gettext[3460]); move(15, j); - prints(I18N[3461]); + prints(gettext[3461]); move(16, j); - prints(I18N[3462]); + prints(gettext[3462]); move(17, j); - prints(I18N[3463]); + prints(gettext[3463]); break; case 2: move(13, j); - prints(I18N[3464]); + prints(gettext[3464]); move(14, j); - prints(I18N[3465]); + prints(gettext[3465]); move(15, j); - prints(I18N[3466]); + prints(gettext[3466]); move(16, j); - prints(I18N[3467]); + prints(gettext[3467]); move(17, j); - prints(I18N[3468]); + prints(gettext[3468]); break; case 3: move(13, j); - prints(I18N[3469]); + prints(gettext[3469]); move(14, j); - prints(I18N[3470]); + prints(gettext[3470]); move(15, j); - prints(I18N[3471]); + prints(gettext[3471]); move(16, j); - prints(I18N[3472]); + prints(gettext[3472]); move(17, j); - prints(I18N[3473]); + prints(gettext[3473]); break; case 4: move(13, j); - prints(I18N[3474]); + prints(gettext[3474]); move(14, j); - prints(I18N[3475]); + prints(gettext[3475]); move(15, j); - prints(I18N[3476]); + prints(gettext[3476]); move(16, j); - prints(I18N[3477]); + prints(gettext[3477]); move(17, j); - prints(I18N[3478]); + prints(gettext[3478]); break; case 5: move(13, j); - prints(I18N[3479]); + prints(gettext[3479]); move(14, j); - prints(I18N[3480]); + prints(gettext[3480]); move(15, j); - prints(I18N[3481]); + prints(gettext[3481]); move(16, j); - prints(I18N[3482]); + prints(gettext[3482]); move(17, j); - prints(I18N[3483]); + prints(gettext[3483]); break; case 6: move(13, j); - prints(I18N[3484]); + prints(gettext[3484]); move(14, j); - prints(I18N[3485]); + prints(gettext[3485]); move(15, j); - prints(I18N[3486]); + prints(gettext[3486]); move(16, j); - prints(I18N[3487]); + prints(gettext[3487]); move(17, j); - prints(I18N[3488]); + prints(gettext[3488]); break; } } @@ -324,7 +324,7 @@ dice_main(void) reload_money(); if (cuser.money < 10) { move(19, 0); - prints(I18N[3489]); + prints(gettext[3489]); pressanykey(); return 0; } @@ -347,15 +347,15 @@ dice_main(void) while (1) { move(19, 0); - prints(I18N[3490], + prints(gettext[3490], cuser.money); - getdata(20, 0, I18N[3491], + getdata(20, 0, gettext[3491], input, 5, LCECHO); reload_money(); if (input[0] != 's' && input[0] != 'd' && cuser.money < 10) { move(21, 0); clrtoeol(); - prints(I18N[3492]); + prints(gettext[3492]); continue; } if (input[0] == 'd' || input[0] == 'D') { @@ -375,7 +375,7 @@ dice_main(void) while (1) { if (cuser.money < 10) break; - getdata(21, 0, I18N[3493], input, sizeof(input), LCECHO); + getdata(21, 0, gettext[3493], input, sizeof(input), LCECHO); if (!(money = IsLegal(input)) || input[0] == '0') continue; reload_money(); @@ -389,7 +389,7 @@ dice_main(void) sig = 1; break; } else { - vice(money, I18N[3494]); + vice(money, gettext[3494]); table[j].mymoney += money; j = -1; break; @@ -403,13 +403,13 @@ dice_main(void) bzero((char *)&table[i], sizeof(dicedata_t)); table[i].mybet = index; table[i++].mymoney = money; - vice(money, I18N[3495]); + vice(money, gettext[3495]); } break; } reload_money(); move(19, 0); - prints(I18N[3496], + prints(gettext[3496], cuser.money); if (sig != 2) show_count(value,index, money); @@ -434,7 +434,7 @@ dice_main(void) total += table[j].mymoney * ya; if (table[j].mymoney * ya > 500) { /* 超過500塊錢才做log 減少io */ snprintf(data, sizeof(data), - I18N[3497], + gettext[3497], cuser.userid, table[j].mybet, table[j].mymoney, ya, table[j].mymoney * ya); fputs(data, winfp); @@ -444,19 +444,19 @@ dice_main(void) if (total > 0) { move(21, 0); - prints(I18N[3498], total); + prints(gettext[3498], total); } else { move(21, 0); clrtoeol(); - prints(I18N[3499]); + prints(gettext[3499]); } move(19, 0); clrtoeol(); - prints(I18N[3500], + prints(gettext[3500], cuser.money); - getdata(23, 0, I18N[3501], + getdata(23, 0, gettext[3501], input, 2, LCECHO); } while (input[0] != 'n' && input[0] != 'N'); fclose(winfp); diff --git a/mbbsd/edit.c b/mbbsd/edit.c index 71458288..ac0d7a92 100644 --- a/mbbsd/edit.c +++ b/mbbsd/edit.c @@ -63,7 +63,7 @@ static char fp_bak[] = "bak"; static void indigestion(int i) { - fprintf(stderr, I18N[978], i); + fprintf(stderr, gettext[978], i); } /* Thor: ansi 座標轉換 for color 編輯模式 */ @@ -121,7 +121,7 @@ n2ansi(int nx, textline_t * line) static void edit_msg() { - char *edit_mode[2] = {I18N[979], I18N[980]}; + char *edit_mode[2] = {gettext[979], gettext[980]}; register int n = currpnt; if (my_ansimode) /* Thor: 作 ansi 編輯 */ @@ -129,7 +129,7 @@ edit_msg() n++; move(b_lines, 0); clrtoeol(); - prints(I18N[981], + prints(gettext[981], "37;44", edit_mode[insert_character], my_ansimode ? 'A' : 'a', indent_mode ? 'I' : 'i', @@ -527,7 +527,7 @@ ask_tmpbuf(int y) static char fp_buf[10] = "buf.0"; char msg[36]; - strlcpy(msg, I18N[982], sizeof(msg)); + strlcpy(msg, gettext[982], sizeof(msg)); msg[19] = fp_buf[4]; do { if (!getdata(y, 0, msg, fp_buf + 4, 4, DOECHO)) @@ -555,7 +555,7 @@ read_tmpbuf(int n) setuserfile(fp_tmpbuf, tmpf); if (n != 0 && n != 5 && more(fp_tmpbuf, NA) != -1) - getdata(b_lines - 1, 0, I18N[983], ans, sizeof(ans), LCECHO); + getdata(b_lines - 1, 0, gettext[983], ans, sizeof(ans), LCECHO); if (*ans != 'n' && (fp = fopen(fp_tmpbuf, "r"))) { load_file(fp); while (curr_window_line >= b_lines) { @@ -575,7 +575,7 @@ write_tmpbuf() setuserfile(fp_tmpbuf, ask_tmpbuf(3)); if (dashf(fp_tmpbuf)) { more(fp_tmpbuf, NA); - getdata(b_lines - 1, 0, I18N[984], + getdata(b_lines - 1, 0, gettext[984], ans, sizeof(ans), LCECHO); if (ans[0] == 'q') @@ -598,7 +598,7 @@ erase_tmpbuf() setuserfile(fp_tmpbuf, ask_tmpbuf(3)); if (more(fp_tmpbuf, NA) != -1) - getdata(b_lines - 1, 0, I18N[985], + getdata(b_lines - 1, 0, gettext[985], ans, sizeof(ans), LCECHO); if (*ans == 'y') unlink(fp_tmpbuf); @@ -634,8 +634,8 @@ restore_backup() setuserfile(bakfile, fp_bak); if (dashf(bakfile)) { - stand_title(I18N[986]); - getdata(1, 0, I18N[987], + stand_title(gettext[986]); + getdata(1, 0, gettext[987], buf, 4, LCECHO); if (buf[0] != 'q') { setuserfile(buf, ask_tmpbuf(3)); @@ -660,8 +660,8 @@ garbage_line(char *str) while (*str == ' ' || *str == '\t') str++; if (qlevel >= 1) { - if (!strncmp(str, I18N[988], 3) || !strncmp(str, "==>", 3) || - strstr(str, I18N[989])) + if (!strncmp(str, gettext[988], 3) || !strncmp(str, "==>", 3) || + strstr(str, gettext[989])) return 1; } return (*str == '\n'); @@ -673,7 +673,7 @@ do_quote() int op; char buf[256]; - getdata(b_lines - 1, 0, I18N[990], + getdata(b_lines - 1, 0, gettext[990], buf, 3, LCECHO); op = buf[0]; @@ -706,9 +706,9 @@ do_quote() ptr = quote_user; indent_mode = 0; - insert_string(I18N[991]); + insert_string(gettext[991]); insert_string(ptr); - insert_string(I18N[992]); + insert_string(gettext[992]); if (op != 'a') /* 去掉 header */ while (fgets(buf, 256, inf) && buf[0] != '\n'); @@ -724,7 +724,7 @@ do_quote() insert_string(Ptt_prints(buf, NO_RELOAD)); else { if (curredit & EDIT_LIST) /* 去掉 mail list 之 header */ - while (fgets(buf, 256, inf) && (!strncmp(buf, I18N[993], 3))); + while (fgets(buf, 256, inf) && (!strncmp(buf, gettext[993], 3))); while (fgets(buf, 256, inf)) { if (!strcmp(buf, "--\n")) break; @@ -767,11 +767,11 @@ check_quote() if ((included_line >> 2) > post_line) { move(4, 0); - outs(I18N[994]); + outs(gettext[994]); { char ans[4]; - getdata(12, 12, I18N[995], + getdata(12, 12, gettext[995], ans, sizeof(ans), LCECHO); if (ans[0] == 'w') return 0; @@ -823,9 +823,9 @@ write_header(FILE * fp) if (currbrdattr & BRD_ANONYMOUS) { int defanony = (currbrdattr & BRD_DEFAULTANONYMOUS); if (defanony) - getdata(3, 0, I18N[996], real_name, sizeof(real_name), DOECHO); + getdata(3, 0, gettext[996], real_name, sizeof(real_name), DOECHO); else - getdata(3, 0, I18N[997], + getdata(3, 0, gettext[997], real_name, sizeof(real_name), DOECHO); if (!real_name[0] && defanony) { strlcpy(real_name, "Anonymous", sizeof(real_name)); @@ -858,7 +858,7 @@ write_header(FILE * fp) fprintf(fp, "%s %s (%s) %s %s\n", str_author1, postlog.author, (((!strcmp(real_name, "r") && defanony) || (!real_name[0] && (!defanony))) ? cuser.username : - I18N[998]), + gettext[998]), local_article ? str_post2 : str_post1, currboard); } else { fprintf(fp, "%s %s (%s) %s %s\n", str_author1, cuser.userid, @@ -873,7 +873,7 @@ write_header(FILE * fp) } save_title[72] = '\0'; - fprintf(fp, I18N[999], save_title, ctime(&now)); + fprintf(fp, gettext[999], save_title, ctime(&now)); } void @@ -887,10 +887,10 @@ addsignature(FILE * fp, int ifuseanony) static char msg[64]; char ch; - strlcpy(msg, I18N[1000], sizeof(msg)); + strlcpy(msg, gettext[1000], sizeof(msg)); if (!strcmp(cuser.userid, STR_GUEST)) { - fprintf(fp, "%s" BBSNAME "(" MYHOSTNAME "%s%s\n", I18N[1001], - I18N[1002], fromhost); + fprintf(fp, "%s" BBSNAME "(" MYHOSTNAME "%s%s\n", gettext[1001], + gettext[1002], fromhost); return; } if (!ifuseanony) { @@ -923,20 +923,20 @@ addsignature(FILE * fp, int ifuseanony) #ifdef HAVE_ORIGIN #ifdef HAVE_ANONYMOUS if (ifuseanony) - fprintf(fp, "%s"BBSNAME"("MYHOSTNAME"%s%s\n", I18N[1003], - I18N[1004], I18N[1005]); + fprintf(fp, "%s"BBSNAME"("MYHOSTNAME"%s%s\n", gettext[1003], + gettext[1004], gettext[1005]); else { char temp[33]; strncpy(temp, fromhost, 31); temp[32] = '\0'; - fprintf(fp, "%s"BBSNAME"("MYHOSTNAME"%s%s\n", I18N[1006], - I18N[1007], temp); + fprintf(fp, "%s"BBSNAME"("MYHOSTNAME"%s%s\n", gettext[1006], + gettext[1007], temp); } #else strncpy(temp, fromhost, 15); - fprintf(fp, "%s"BBSNAME"("MYHOSTNAME"%s%s\n", I18N[1008], - I18N[1009], temp); + fprintf(fp, "%s"BBSNAME"("MYHOSTNAME"%s%s\n", gettext[1008], + gettext[1009], temp); #endif #endif } @@ -950,18 +950,18 @@ write_file(char *fpath, int saveheader, int *islocal) char ans[TTLEN], *msg; int aborted = 0, line = 0, checksum[3], sum = 0, po = 1; - stand_title(I18N[1010]); + stand_title(gettext[1010]); if (currstat == SMAIL) - msg = I18N[1011]; + msg = gettext[1011]; else if (local_article) - msg = I18N[1012]; + msg = gettext[1012]; else - msg = I18N[1013]; + msg = gettext[1013]; getdata(1, 0, msg, ans, 2, LCECHO); switch (ans[0]) { case 'a': - outs(I18N[1014]); + outs(gettext[1014]); aborted = -1; break; case 'r': @@ -976,16 +976,16 @@ write_file(char *fpath, int saveheader, int *islocal) return KEEP_EDITING; case 't': move(3, 0); - prints(I18N[1015], save_title); + prints(gettext[1015], save_title); strlcpy(ans, save_title, sizeof(ans)); - if (getdata_buf(4, 0, I18N[1016], ans, sizeof(ans), DOECHO)) + if (getdata_buf(4, 0, gettext[1016], ans, sizeof(ans), DOECHO)) strlcpy(save_title, ans, sizeof(save_title)); return KEEP_EDITING; case 's': if (!HAS_PERM(PERM_LOGINOK)) { local_article = 1; move(2, 0); - prints(I18N[1017]); + prints(gettext[1017]); pressanykey(); } else local_article = 0; @@ -1046,7 +1046,7 @@ write_file(char *fpath, int saveheader, int *islocal) } currline = NULL; - if (postrecord.times > MAX_CROSSNUM - 1) + if (postrecord.times > MAX_CROSSNUM-1 && hbflcheck(currbid, currutmp->uid)) anticrosspost(); if (po && sum == 3) { @@ -1065,7 +1065,7 @@ write_file(char *fpath, int saveheader, int *islocal) ) { ptime = localtime(&now); fprintf(fp, - I18N[1018], + gettext[1018], cuser.userid, fromhost, ptime->tm_mon + 1, ptime->tm_mday, ptime->tm_hour, ptime->tm_min); } @@ -1151,7 +1151,7 @@ goto_line(int lino) char buf[10]; if (lino > 0 || - (getdata(b_lines - 1, 0, I18N[1019], buf, sizeof(buf), DOECHO) && + (getdata(b_lines - 1, 0, gettext[1019], buf, sizeof(buf), DOECHO) && sscanf(buf, "%d", &lino) && lino > 0)) { textline_t *p; @@ -1210,10 +1210,10 @@ search_str(int mode) char ans[4] = "n"; if (!mode) { - if (getdata_buf(b_lines - 1, 0, I18N[1020], + if (getdata_buf(b_lines - 1, 0, gettext[1020], str, sizeof(str), DOECHO)) if (*str) { - if (getdata(b_lines - 1, 0, I18N[1021], + if (getdata(b_lines - 1, 0, gettext[1021], ans, sizeof(ans), LCECHO) && *ans == 'y') fptr = strstr; else @@ -1401,7 +1401,7 @@ block_del(int hide) clrtoeol(); if (hide == 1) tmpfname[4] = 'q'; - else if (!hide && !getdata(b_lines - 1, 0, I18N[1022], + else if (!hide && !getdata(b_lines - 1, 0, gettext[1022], tmpfname + 4, 4, LCECHO)) tmpfname[4] = '0'; if (tmpfname[4] < '0' || tmpfname[4] > '9') @@ -1410,14 +1410,14 @@ block_del(int hide) setuserfile(fp_tmpbuf, tmpfname); if (tmpfname[4] != '5' && dashf(fp_tmpbuf)) { more(fp_tmpbuf, NA); - getdata(b_lines - 1, 0, I18N[1023], ans, 2, LCECHO); + getdata(b_lines - 1, 0, gettext[1023], ans, 2, LCECHO); if (*ans == 'q') tmpfname[4] = 'q'; else if (*ans != 'a') *ans = 'w'; } if (tmpfname[4] != '5') { - getdata(b_lines - 1, 0, I18N[1024], + getdata(b_lines - 1, 0, gettext[1024], ans + 2, 4, LCECHO); if (ans[2] != 'y') ans[2] = 'n'; @@ -1775,7 +1775,7 @@ vedit(char *fpath, int saveheader, int *islocal) line_dirty = 1; break; case Ctrl('Q'): /* Quit without saving */ - ch = ask(I18N[1025]); + ch = ask(gettext[1025]); if (ch == 'y' || ch == 'Y') { currutmp->mode = mode0; currutmp->destuid = destuid0; @@ -1808,7 +1808,7 @@ vedit(char *fpath, int saveheader, int *islocal) move(b_lines - 2, 55); outs("\033[1;33;40mB\033[41mR\033[42mG\033[43mY\033[44mL\033[45mP\033[46mC\033[47mW\033[m"); if (getdata(b_lines - 1, 0, - I18N[1026], + gettext[1026], ans, sizeof(ans), LCECHO)) { char t[] = "BRGYLPCW"; char color[15]; @@ -1817,7 +1817,7 @@ vedit(char *fpath, int saveheader, int *islocal) strcpy(color, "\033["); if (isdigit(*apos)) { - sprintf(color,"%s%c", color, *(apos++)); + sprintf(color,"%s%c", color, *(apos++)); if (*apos) strcat(color, ";"); } @@ -2013,7 +2013,7 @@ vedit(char *fpath, int saveheader, int *islocal) { unsigned int currstat0 = currstat; setutmpmode(EDITEXP); - a_menu(I18N[1027], "etc/editexp", + a_menu(gettext[1027], "etc/editexp", (HAS_PERM(PERM_SYSOP) ? SYSOP : NOBODY)); currstat = currstat0; } @@ -2023,9 +2023,9 @@ vedit(char *fpath, int saveheader, int *islocal) indent_mode = 0; while (fgets(line, WRAPMARGIN + 2, fp1)) { - if (!strncmp(line, I18N[1028], 5) || - !strncmp(line, I18N[1029], 5) || - !strncmp(line, I18N[1030], 5)) + if (!strncmp(line, gettext[1028], 5) || + !strncmp(line, gettext[1029], 5) || + !strncmp(line, gettext[1030], 5)) continue; insert_string(line); } @@ -2169,7 +2169,7 @@ vedit(char *fpath, int saveheader, int *islocal) char ans[4]; getdata(b_lines - 1, 0, - I18N[1031], + gettext[1031], ans, sizeof(ans), LCECHO); insert_c = (*ans) ? *ans : ' '; } diff --git a/mbbsd/fav.c b/mbbsd/fav.c index 362deceb..81f314a3 100644 --- a/mbbsd/fav.c +++ b/mbbsd/fav.c @@ -143,7 +143,7 @@ static char *get_item_class(fav_type_t *ft) case FAVT_BOARD: return bcache[cast_board(ft)->bid - 1].title; case FAVT_FOLDER: - return I18N[1032]; + return gettext[1032]; case FAVT_LINE: return "----"; } @@ -457,7 +457,8 @@ int fav_save(void) close(fd); if (dashs(buf) == 4) { time_t now = time(NULL); - log_file(BBSHOME"/dirty.hack", 1, "%s %s", cuser.userid, ctime(&now)); + log_file(BBSHOME "/dirty.hack", LOG_CREAT | LOG_VF, + "%s %s", cuser.userid, ctime(&now)); return -1; } Rename(buf, buf2); diff --git a/mbbsd/friend.c b/mbbsd/friend.c index 64bfdc82..fd112bda 100644 --- a/mbbsd/friend.c +++ b/mbbsd/friend.c @@ -78,9 +78,9 @@ friend_add(char *uident, int type, char* des) if (type != FRIEND_ALOHA && type != FRIEND_POST){ if(!des) - getdata(2, 0, I18N[friend_desc[type]], buf, sizeof(buf), DOECHO); + getdata(2, 0, gettext[friend_desc[type]], buf, sizeof(buf), DOECHO); else - getdata_str(2, 0, I18N[friend_desc[type]], buf, sizeof(buf), DOECHO, des); + getdata_str(2, 0, gettext[friend_desc[type]], buf, sizeof(buf), DOECHO, des); } if ((fp = fopen(fpath, "a"))) { @@ -115,7 +115,7 @@ friend_special(void) clrtoeol(); outs(genbuf); } - getdata(22, 0, I18N[1047], genbuf, 3, LCECHO); + getdata(22, 0, gettext[1047], genbuf, 3, LCECHO); if (genbuf[0] >= '0' && genbuf[0] <= '9') { special_list[5] = genbuf[0]; special_des[5] = genbuf[0]; @@ -136,21 +136,21 @@ friend_append(int type, int count) do { move(2, 0); clrtobot(); - outs(I18N[1048]); + outs(gettext[1048]); for (j = i = 0; i <= 4; i++) if (i != type) { ++j; - prints(" (%d) %-s\n", j, I18N[1039 + (int)i]); + prints(" (%d) %-s\n", j, gettext[1039 + (int)i]); } if (HAVE_PERM(PERM_SYSOP) || currmode & MODE_BOARD) for (; i < 8; ++i) if (i != type) { ++j; - prints(I18N[1049], j, currboard, - I18N[1039 + (int)i]); + prints(gettext[1049], j, currboard, + gettext[1039 + (int)i]); } - outs(I18N[1050]); - getdata(11, 0, I18N[1051], buf, 3, LCECHO); + outs(gettext[1050]); + getdata(11, 0, gettext[1051], buf, 3, LCECHO); if (!buf[0]) return; if (buf[0] == 's') @@ -224,7 +224,7 @@ friend_editdesc(char *uident, int type) fputs(genbuf, nfp); else if (!strncmp(genbuf, uident, length)) { char buf[50] = ""; - getdata(2, 0, I18N[1052], buf, 40, DOECHO); + getdata(2, 0, gettext[1052], buf, 40, DOECHO); fprintf(nfp, "%-13s%s\n", uident, buf); } } @@ -326,9 +326,9 @@ friend_edit(int type) } dirty = 0; while (1) { - stand_title(I18N[1039 + type]); + stand_title(gettext[1039 + type]); move(0, 40); - prints(I18N[1053], friend_max[type]); + prints(gettext[1053], friend_max[type]); count = 0; CreateNameList(); @@ -350,8 +350,8 @@ friend_edit(int type) fclose(fp); } getdata(1, 0, (count ? - I18N[1054] : - I18N[1055]), + gettext[1054] : + gettext[1055]), uident, 3, LCECHO); if (*uident == 'a') { move(1, 0); @@ -379,16 +379,16 @@ friend_edit(int type) } else if (*uident == 'l' && count) more(fpath, YEA); else if (*uident == 'k' && count) { - getdata(2, 0, I18N[1056], uident, 3, + getdata(2, 0, gettext[1056], uident, 3, LCECHO); if (*uident == 'a') unlink(fpath); dirty = 1; } else if (*uident == 'w' && count) { char wall[60]; - if (!getdata(0, 0, I18N[1057], wall, sizeof(wall), DOECHO)) + if (!getdata(0, 0, gettext[1057], wall, sizeof(wall), DOECHO)) continue; - if (getdata(0, 0, I18N[1058], line, 4, LCECHO) && + if (getdata(0, 0, gettext[1058], line, 4, LCECHO) && *line == 'n') continue; friend_water(wall, type); @@ -397,7 +397,7 @@ friend_edit(int type) } if (dirty) { move(2, 0); - outs(I18N[1059]); + outs(gettext[1059]); refresh(); if (type == FRIEND_ALOHA || type == FRIEND_POST) { snprintf(genbuf, sizeof(genbuf), "%s.old", fpath); @@ -427,7 +427,7 @@ friend_edit(int type) fgets(genbuf, 30, fp); fclose(fp); } - getdata_buf(2, 0, I18N[1060], genbuf, 30, + getdata_buf(2, 0, gettext[1060], genbuf, 30, DOECHO); if ((fp = fopen(line, "w"))) { fprintf(fp, "%s", genbuf); diff --git a/mbbsd/gamble.c b/mbbsd/gamble.c index 3e4ae622..a0786efd 100644 --- a/mbbsd/gamble.c +++ b/mbbsd/gamble.c @@ -32,20 +32,20 @@ show_ticket_data(char betname[MAX_ITEM][MAX_ITEM_LEN],char *direct, int *price, clear(); if (bh) { - snprintf(genbuf, sizeof(genbuf), I18N[1061], bh->brdname); + snprintf(genbuf, sizeof(genbuf), gettext[1061], bh->brdname); if (bh->endgamble && now < bh->endgamble && bh->endgamble - now < 3600) { snprintf(t, sizeof(t), - I18N[1062], (int)(bh->endgamble - now)); + gettext[1062], (int)(bh->endgamble - now)); showtitle(genbuf, t); } else showtitle(genbuf, BBSNAME); } else - showtitle(I18N[1063], BBSNAME); + showtitle(gettext[1063], BBSNAME); move(2, 0); snprintf(genbuf, sizeof(genbuf), "%s/" FN_TICKET_ITEMS, direct); if (!(fp = fopen(genbuf, "r"))) { - prints(I18N[1064]); + prints(gettext[1064]); snprintf(genbuf, sizeof(genbuf), "%s/" FN_TICKET_OUTCOME, direct); more(genbuf, NA); return 0; @@ -56,11 +56,11 @@ show_ticket_data(char betname[MAX_ITEM][MAX_ITEM_LEN],char *direct, int *price, strtok(betname[count], "\r\n"); fclose(fp); - prints(I18N[1065], *price, - bh ? I18N[1066] : - I18N[1067], - bh ? I18N[1068] : "", - bh ? I18N[1069] : I18N[1070]); + prints(gettext[1065], *price, + bh ? gettext[1066] : + gettext[1067], + bh ? gettext[1068] : "", + bh ? gettext[1069] : gettext[1070]); snprintf(genbuf, sizeof(genbuf), "%s/" FN_TICKET, direct); @@ -70,7 +70,7 @@ show_ticket_data(char betname[MAX_ITEM][MAX_ITEM_LEN],char *direct, int *price, } show_file(genbuf, 8, -1, NO_RELOAD); move(15, 0); - prints(I18N[1071]); + prints(gettext[1071]); total = load_ticket_record(direct, ticket); @@ -80,9 +80,9 @@ show_ticket_data(char betname[MAX_ITEM][MAX_ITEM_LEN],char *direct, int *price, if (i == 3) prints("\n"); } - prints(I18N[1072], total * (*price)); + prints(gettext[1072], total * (*price)); if (end) { - prints(I18N[1073]); + prints(gettext[1073]); return -count; } return count; @@ -136,7 +136,7 @@ ticket(int bid) } move(20, 0); reload_money(); - prints(I18N[1074], cuser.money, count); + prints(gettext[1074], cuser.money, count); ch = igetch(); /*-- Tim011127 @@ -154,7 +154,7 @@ ticket(int bid) ch_buyitem(price, "etc/buyticket", &n, 0); if (bid && !dashf(fn_ticket)) { - vmsg(I18N[1075]); + vmsg(gettext[1075]); break; } @@ -186,7 +186,7 @@ openticket(int bid) do { do { getdata(20, 0, - I18N[1076], buf, 3, LCECHO); + gettext[1076], buf, 3, LCECHO); bet = atoi(buf); move(0, 0); clrtoeol(); @@ -195,13 +195,13 @@ openticket(int bid) unlockutmpmode(); return 0; } - getdata(21, 0, I18N[1077], buf, 3, LCECHO); + getdata(21, 0, gettext[1077], buf, 3, LCECHO); } while (bet != atoi(buf)); if (fork()) { /* Ptt: 用 fork() 防止不正常斷線洗錢 */ move(22, 0); - prints(I18N[1078]); + prints(gettext[1078]); pressanykey(); unlockutmpmode(); return 0; @@ -230,20 +230,20 @@ openticket(int bid) if (bet != 98) { money = total * price; demoney(money * 0.02); - mail_redenvelop(I18N[1079], cuser.userid, money * 0.02, 'n'); + mail_redenvelop(gettext[1079], cuser.userid, money * 0.02, 'n'); money = ticket[bet] ? money * 0.95 / ticket[bet] : 9999999; } else { - vice(price * 10, I18N[1080]); + vice(price * 10, gettext[1080]); money = price; } setbfile(outcome, bh->brdname, FN_TICKET_OUTCOME); if ((fp = fopen(outcome, "w"))) { - fprintf(fp, I18N[1081]); + fprintf(fp, gettext[1081]); while (fgets(buf, sizeof(buf), fp1)) { buf[sizeof(buf)-1] = 0; fprintf(fp, "%s", buf); } - fprintf(fp, I18N[1082]); + fprintf(fp, gettext[1082]); fprintf(fp, "\033[33m"); for (i = 0; i < count; i++) { @@ -254,15 +254,15 @@ openticket(int bid) fprintf(fp, "\033[m\n"); if (bet != 98) { - fprintf(fp, I18N[1083], + fprintf(fp, gettext[1083], Cdatelite(&now), betname[bet], total * price, ticket[bet], total, (float)ticket[bet] / total, money); - fprintf(fp, I18N[1084], + fprintf(fp, gettext[1084], Cdatelite(&now), betname[bet], total * price, money, total ? (float)ticket[bet] / total : 0); } else - fprintf(fp, I18N[1085], Cdatelite(&now)); + fprintf(fp, gettext[1085], Cdatelite(&now)); } // XXX somebody may use fp even fp==NULL fclose(fp1); @@ -281,37 +281,37 @@ openticket(int bid) while (fscanf(fp1, "%s %d %d\n", userid, &mybet, &i) != EOF) { if (bet == 98 && mybet >= 0 && mybet < count) { if (fp) - fprintf(fp, I18N[1086] + fprintf(fp, gettext[1086] ,userid, i, betname[mybet], money * i); snprintf(buf, sizeof(buf), - I18N[1087], bh->brdname, money * i); + gettext[1087], bh->brdname, money * i); } else if (mybet == bet) { if (fp) - fprintf(fp, I18N[1088] + fprintf(fp, gettext[1088] ,userid, i, betname[mybet], money * i); - snprintf(buf, sizeof(buf), I18N[1089], bh->brdname, money * i); + snprintf(buf, sizeof(buf), gettext[1089], bh->brdname, money * i); } else continue; if ((uid = searchuser(userid)) == 0) continue; deumoney(uid, money * i); - mail_id(userid, buf, "etc/ticket.win", I18N[1090]); + mail_id(userid, buf, "etc/ticket.win", gettext[1090]); } fclose(fp1); } if (fp) { - fprintf(fp, "%s"BBSNAME"("MYHOSTNAME"%s%s\n", I18N[1091], - I18N[1092], fromhost); + fprintf(fp, "%s"BBSNAME"("MYHOSTNAME"%s%s\n", gettext[1091], + gettext[1092], fromhost); fclose(fp); } if (bet != 98) - snprintf(buf, sizeof(buf), I18N[1093], bh->brdname); + snprintf(buf, sizeof(buf), gettext[1093], bh->brdname); else - snprintf(buf, sizeof(buf), I18N[1094], bh->brdname); - post_file(bh->brdname, buf, outcome, I18N[1095]); - post_file("Record", buf + 7, outcome, I18N[1096]); + snprintf(buf, sizeof(buf), gettext[1094], bh->brdname); + post_file(bh->brdname, buf, outcome, gettext[1095]); + post_file("Record", buf + 7, outcome, gettext[1096]); setbfile(buf, bh->brdname, FN_TICKET_RECORD); unlink(buf); diff --git a/mbbsd/gomo.c b/mbbsd/gomo.c index 7df76b53..38259bcf 100644 --- a/mbbsd/gomo.c +++ b/mbbsd/gomo.c @@ -164,7 +164,7 @@ HO_add(Horder_t * mv) static void HO_undo(Horder_t * mv) { - char *str = I18N[1099]; + char *str = gettext[1099]; int n1, n2, loc; *mv = *(--v); @@ -197,7 +197,7 @@ HO_log(Horder_t *pool, char *user) i = 0; do { - fprintf(log, "[%2d]%s ==> %c%d%c", i + 1, I18N[1097 + i % 2], + fprintf(log, "[%2d]%s ==> %c%d%c", i + 1, gettext[1097 + i % 2], 'A' + ptr->x, ptr->y + 1, (i % 2) ? '\n' : '\t'); i++; } while (++ptr < v); @@ -207,9 +207,9 @@ HO_log(Horder_t *pool, char *user) stampfile(buf1, &mymail); mymail.filemode = FILE_READ ; - strlcpy(mymail.owner, I18N[1100], sizeof(mymail.owner)); + strlcpy(mymail.owner, gettext[1100], sizeof(mymail.owner)); snprintf(mymail.title, sizeof(mymail.title), - I18N[1101], cuser.userid, user); + gettext[1101], cuser.userid, user); sethomedir(title, cuser.userid); Rename(buf, buf1); append_record(title, &mymail, sizeof(mymail)); @@ -226,12 +226,12 @@ countgomo(Horder_t *pool) static int chkmv(Horder_t * mv, int color, int limit) { - char *xtype[] = {I18N[1102], I18N[1103], - I18N[1104], I18N[1105], - I18N[1106], I18N[1107], - I18N[1108], I18N[1109], - I18N[1110], I18N[1111], - I18N[1112]}; + char *xtype[] = {gettext[1102], gettext[1103], + gettext[1104], gettext[1105], + gettext[1106], gettext[1107], + gettext[1108], gettext[1109], + gettext[1110], gettext[1111], + gettext[1112]}; int rule = getstyle(mv->x, mv->y, color, limit); if (rule > 1 && rule < 13) { move(15, 40); @@ -250,7 +250,7 @@ gomo_key(int fd, int ch, Horder_t * mv) pbuf[0] = ch; if (fd) add_io(0, 0); - oldgetdata(17, 0, I18N[1113], pbuf, sizeof(pbuf), DOECHO); + oldgetdata(17, 0, gettext[1113], pbuf, sizeof(pbuf), DOECHO); if (fd) add_io(fd, 0); vx = pbuf[0] - 'a'; @@ -305,22 +305,22 @@ gomoku(int fd) setutmpmode(M_FIVE); clear(); - prints(I18N[1114], + prints(gettext[1114], cuser.userid, my->mateid); show_file("etc/@five", 1, -1, ONLY_COLOR); move(11, 40); - prints(I18N[1115], me == BBLACK ? I18N[1116] : I18N[1117]); + prints(gettext[1115], me == BBLACK ? gettext[1116] : gettext[1117]); move(16, 40); prints("\033[1;33m%s", cuser.userid); move(17, 40); prints("\033[1;33m%s", my->mateid); move(16, 60); - prints(I18N[1118], cuser.five_win, cuser.five_lose, cuser.five_tie); + prints(gettext[1118], cuser.five_win, cuser.five_lose, cuser.five_tie); getuser(my->mateid); move(17, 60); - prints(I18N[1119], xuser.five_win, xuser.five_lose, xuser.five_tie); + prints(gettext[1119], xuser.five_win, xuser.five_lose, xuser.five_tie); cuser.five_lose++; /* 一進來先加一場敗場, 贏了後再扣回去, 避免快輸了惡意斷線 */ @@ -331,26 +331,26 @@ gomoku(int fd) hewantpass = iwantpass = 0; mv.x = mv.y = 7; move(18, 40); - prints(I18N[1120], my->turn ? I18N[1121] : I18N[1122], + prints(gettext[1120], my->turn ? gettext[1121] : gettext[1122], MAX_TIME / 60, MAX_TIME % 60); for (;;) { move(13, 40); - outs(my->turn ? I18N[1123] : I18N[1124]); + outs(my->turn ? gettext[1123] : gettext[1124]); if (lastcount != tick - now) { lastcount = tick - now; move(18, 40); - prints(I18N[1125], my->turn ? I18N[1126] : I18N[1127], + prints(gettext[1125], my->turn ? gettext[1126] : gettext[1127], lastcount / 60, lastcount % 60); if (lastcount <= 0 && my->turn) { move(19, 40); - outs(I18N[1128]); + outs(gettext[1128]); my->five_lose++; send(fd, '\0', 1, 0); break; } if (lastcount <= -5 && !my->turn) { move(19, 40); - outs(I18N[1129]); + outs(gettext[1129]); cuser.five_lose--; cuser.five_win++; my->five_win++; @@ -363,7 +363,7 @@ gomoku(int fd) } move(14, 40); if (hewantpass) { - outs(I18N[1130]); + outs(gettext[1130]); bell(); } else clrtoeol(); @@ -420,10 +420,10 @@ gomoku(int fd) my->five_win++; } passwd_update(usernum, &cuser); - outmsg(I18N[1131]); + outmsg(gettext[1131]); break; } else { - outmsg(I18N[1132]); + outmsg(gettext[1132]); my->five_lose++; break; } @@ -441,7 +441,7 @@ gomoku(int fd) } } if (my->turn && mv.x == -1 && mv.y == -1) { - outmsg(I18N[1133]); + outmsg(gettext[1133]); tick = hislasttick; HO_undo(&mv); my->turn = 0; @@ -456,10 +456,10 @@ gomoku(int fd) ku[(int)mv.x][(int)mv.y] = he; bell(); BGOTO(mv.x, mv.y); - outs(I18N[1097 + he - 1]); + outs(gettext[1097 + he - 1]); if (win) { - outmsg(win == 1 ? I18N[1134] : I18N[1135]); + outmsg(win == 1 ? gettext[1134] : gettext[1135]); if (win != 1) { cuser.five_lose--; cuser.five_win++; @@ -483,7 +483,7 @@ gomoku(int fd) int win; HO_add(&mv); BGOTO(mv.x, mv.y); - outs(I18N[1097 + me - 1]); + outs(gettext[1097 + me - 1]); win = chkmv(&mv, me, me == BBLACK); ku[(int)mv.x][(int)mv.y] = me; mylasttick = tick; @@ -492,7 +492,7 @@ gomoku(int fd) if (send(fd, &mv, sizeof(Horder_t), 0) != sizeof(Horder_t)) break; if (win) { - outmsg(win == 1 ? I18N[1136] : I18N[1137]); + outmsg(win == 1 ? gettext[1136] : gettext[1137]); if (win == 1) { cuser.five_lose--; cuser.five_win++; @@ -514,7 +514,7 @@ gomoku(int fd) if (v > pool) { char ans[4]; - getdata(19, 0, I18N[1138], ans, sizeof(ans), LCECHO); + getdata(19, 0, gettext[1138], ans, sizeof(ans), LCECHO); if (*ans == 'y') HO_log(pool, my->mateid); } diff --git a/mbbsd/guess.c b/mbbsd/guess.c index 1f989807..b830cf07 100644 --- a/mbbsd/guess.c +++ b/mbbsd/guess.c @@ -8,16 +8,16 @@ show_table(char TABLE[], char ifcomputer) int i; move(0, 35); - prints(I18N[1139]); + prints(gettext[1139]); move(8, 1); - prints(I18N[1140]); + prints(gettext[1140]); prints("\033[1;33m=================\033[m\n"); if (ifcomputer) { - prints(I18N[1141]); - prints(I18N[1142]); + prints(gettext[1141]); + prints(gettext[1142]); } else { for (i = 1; i <= 6; i++) - prints(I18N[1143], i, TABLE[i]); + prints(gettext[1143], i, TABLE[i]); } prints("\033[33m=================\033[m"); } @@ -29,9 +29,9 @@ get_money(void) char data[20]; move(1, 0); - prints(I18N[1144], cuser.money); + prints(gettext[1144], cuser.money); do { - getdata(2, 0, I18N[1145], data, 9, LCECHO); + getdata(2, 0, gettext[1145], data, 9, LCECHO); money = 0; if (data[0] == 'q' || data[0] == 'Q') { unlockutmpmode(); @@ -53,7 +53,7 @@ get_money(void) move(1, 0); clrtoeol(); reload_money(); - prints(I18N[1146], cuser.money - money); + prints(gettext[1146], cuser.money - money); return money; } @@ -78,7 +78,7 @@ static char * get_data(char data[5], int count) { while (1) { - getdata(6, 0, I18N[1147], data, 5, LCECHO); + getdata(6, 0, gettext[1147], data, 5, LCECHO); if (check_data(data) == 1) break; } @@ -173,7 +173,7 @@ computer(int correct, int total, char flag[], int n[]) if (k == 40) { move(total + 8, 25); snprintf(data, sizeof(data), "%04d", guess); - prints(I18N[1148], data); + prints(gettext[1148], data); return 1; } else { move(total + 8, 25); @@ -227,28 +227,28 @@ guess_main() FILE *file; clear(); - showtitle(I18N[1149], BBSName); + showtitle(gettext[1149], BBSName); lockreturn0(GUESSNUM, LOCK_MULTI); reload_money(); if (cuser.money < 5) { clear(); move(12, 35); - prints(I18N[1150]); + prints(gettext[1150]); unlockutmpmode(); pressanykey(); return 1; } if ((money = get_money()) == 0) return 1; - vice(money, I18N[1151]); + vice(money, gettext[1151]); Diff_Random(answer); move(2, 0); clrtoeol(); - prints(I18N[1152], money); + prints(gettext[1152], money); - getdata_str(4, 0, I18N[1153], + getdata_str(4, 0, gettext[1153], ifcomputer, sizeof(ifcomputer), LCECHO, "y"); if (ifcomputer[0] == 'y') { ifcomputer[0] = 1; @@ -259,17 +259,17 @@ guess_main() } if (ifcomputer[0]) { do { - getdata(5, 0, I18N[1154], + getdata(5, 0, gettext[1154], yournum, sizeof(yournum), LCECHO); } while (!legal(atoi(yournum))); move(8, 25); - prints(I18N[1155]); + prints(gettext[1155]); flag = malloc(sizeof(char) * 10000); n = malloc(sizeof(int) * 1500); initcomputer(flag); } move(8, 55); - prints(I18N[1156]); + prints(gettext[1156]); while (((!computerwin || !youwin) && count < 10 && (ifcomputer[0])) || (!ifcomputer[0] && count < 10 && !youwin)) { if (!computerwin && ifcomputer[0]) { @@ -278,7 +278,7 @@ guess_main() computerwin = 1; } move(20, 55); - prints(I18N[1157], count + 1); + prints(gettext[1157], count + 1); if (!youwin) { ++count; if (guess_play(get_data(data, count), answer, count)) @@ -290,33 +290,33 @@ guess_main() free(n); if (ifcomputer[0]) { if (count > c_count) { - prints(I18N[1158]); + prints(gettext[1158]); move(18, 35); - prints(I18N[1159], money); + prints(gettext[1159], money); if ((file = fopen(LOGPASS, "a"))) { - fprintf(file, I18N[1160], c_count); + fprintf(file, gettext[1160], c_count); if (youwin) - fprintf(file, I18N[1161], cuser.userid, count); + fprintf(file, gettext[1161], cuser.userid, count); else - fprintf(file, I18N[1162], cuser.userid); - fprintf(file, I18N[1163], cuser.userid, money); + fprintf(file, gettext[1162], cuser.userid); + fprintf(file, gettext[1163], cuser.userid, money); fclose(file); } } else if (count < c_count) { - prints(I18N[1164]); + prints(gettext[1164]); move(18, 35); - prints(I18N[1165], money * 2); + prints(gettext[1165], money * 2); demoney(money * 2); if ((file = fopen(LOGPASS, "a"))) { - fprintf(file, I18N[1166], cuser.userid, count, + fprintf(file, gettext[1166], cuser.userid, count, c_count, money * 2); fclose(file); } } else { - prints(I18N[1167], money); + prints(gettext[1167], money); demoney(money); if ((file = fopen(LOGPASS, "a"))) { - fprintf(file, I18N[1168], cuser.userid); + fprintf(file, gettext[1168], cuser.userid); fclose(file); } } @@ -327,26 +327,26 @@ guess_main() if (youwin) { demoney(TABLE[count] * money); if (count < 5) { - prints(I18N[1169]); + prints(gettext[1169]); if ((file = fopen(LOGPASS, "a"))) { - fprintf(file, I18N[1170], + fprintf(file, gettext[1170], cuser.userid, count, TABLE[count] * money); fclose(file); } } else if (count > 5) { - prints(I18N[1171]); + prints(gettext[1171]); if ((file = fopen(LOGPASS, "a"))) { - fprintf(file, I18N[1172], + fprintf(file, gettext[1172], cuser.userid, count, money); fclose(file); } } else { - prints(I18N[1173]); + prints(gettext[1173]); move(18, 35); clrtoeol(); - prints(I18N[1174], money); + prints(gettext[1174], money); if ((file = fopen(LOGPASS, "a"))) { - fprintf(file, I18N[1175], + fprintf(file, gettext[1175], cuser.userid, count, money); fclose(file); } @@ -356,11 +356,11 @@ guess_main() return 1; } move(17, 35); - prints(I18N[1176], answer); + prints(gettext[1176], answer); move(18, 35); - prints(I18N[1177]); + prints(gettext[1177]); if ((file = fopen(BBSHOME "/etc/loseguess.log", "a"))) { - fprintf(file, I18N[1178], cuser.userid, money); + fprintf(file, gettext[1178], cuser.userid, money); fclose(file); } unlockutmpmode(); diff --git a/mbbsd/indict.c b/mbbsd/indict.c index 7c2566f4..f7e7917f 100644 --- a/mbbsd/indict.c +++ b/mbbsd/indict.c @@ -18,12 +18,12 @@ addword(char *database,char word[]) if (HAVE_PERM(PERM_LOGINOK)) { clear(); move(4, 0); - outs(I18N[1179]); - prints(I18N[1180], buf); - outs(I18N[1181]); + outs(gettext[1179]); + prints(gettext[1180], buf); + outs(gettext[1181]); getdata(10, 0, ":", buf, 65, DOECHO); if (buf[0]) { - getdata(13, 0, I18N[1182], a, sizeof(a), LCECHO); + getdata(13, 0, gettext[1182], a, sizeof(a), LCECHO); if (a[0] != 'n') fprintf(fp, "%-65s[%s]\n", buf, cuser.userid); } @@ -42,15 +42,15 @@ choose_dict(char *dict,int dictlen,char *database,int databaselen) move(12, 0); clrtobot(); - outs(I18N[1183]); + outs(gettext[1183]); if ((fp = fopen(REFER, "r"))) { for(n=0; n<MAX_DICT && fscanf(fp,"%s %s",buf[n],data[n])==2; n++) { // XXX check buffer size - prints(I18N[1184], n + 1, buf[n]); + prints(gettext[1184], n + 1, buf[n]); } fclose(fp); - getdata(22, 14, I18N[1185], cho, 3, LCECHO); + getdata(22, 14, gettext[1185], cho, 3, LCECHO); c=atoi(cho); if (c >= 1 && c <= n) { @@ -71,7 +71,7 @@ use_dict(char *dict,char *database) char j, f, buf[120], sys[100]; int i = 0; - strlcpy(sys, I18N[1186], sizeof(sys)); + strlcpy(sys, gettext[1186], sizeof(sys)); setutmpmode(DICT); if (!HAS_PERM(PERM_SYSOP)) sys[0] = 0; @@ -79,14 +79,14 @@ use_dict(char *dict,char *database) clear(); snprintf(buf, sizeof(buf), - I18N[1187], dict); + gettext[1187], dict); strlcpy(&buf[100], "\033[m\n", sizeof(buf) - 100); for (;;) { move(0, 0); - prints(I18N[1188], dict); - prints(I18N[1189], sys); + prints(gettext[1188], dict); + prints(gettext[1189], sys); getdata(2, 0, ":", word, 18, DOECHO); - outs(I18N[1190]); + outs(gettext[1190]); str_lower(word, word); if (word[0] == 0) return 0; @@ -111,7 +111,7 @@ use_dict(char *dict,char *database) clear(); continue; } else { - outs(I18N[1191]); + outs(gettext[1191]); continue; } } @@ -130,7 +130,7 @@ use_dict(char *dict,char *database) i++; if (!((i + 1) % 17)) { move(23, 0); - outs(I18N[1192]); + outs(gettext[1192]); j = igetch(); if (j == 'q') break; @@ -145,7 +145,7 @@ use_dict(char *dict,char *database) fclose(fp); } if (i == 0) { - getdata(5, 0, I18N[1193], lang, 3, LCECHO); + getdata(5, 0, gettext[1193], lang, 3, LCECHO); if (lang[0] == 'y') { clear(); move(4, 0); diff --git a/mbbsd/lovepaper.c b/mbbsd/lovepaper.c index 681ddeee..c60d1be0 100644 --- a/mbbsd/lovepaper.c +++ b/mbbsd/lovepaper.c @@ -20,16 +20,16 @@ x_love() move(1, 0); clrtobot(); - outs(I18N[1195]); - outs(I18N[1196]); + outs(gettext[1195]); + outs(gettext[1196]); - if (!getdata(7, 0, I18N[1197], receiver, sizeof(receiver), DOECHO)) + if (!getdata(7, 0, gettext[1197], receiver, sizeof(receiver), DOECHO)) return 0; if (receiver[0] && !(searchuser(receiver) && - getdata(8, 0, I18N[1198], save_title, + getdata(8, 0, gettext[1198], save_title, sizeof(save_title), DOECHO))) { move(10, 0); - outs(I18N[1199]); + outs(gettext[1199]); pressanykey(); return 0; } @@ -88,7 +88,7 @@ x_love() if (vedit(path, YEA, NULL) == -1) { unlink(path); clear(); - outs(I18N[1200]); + outs(gettext[1200]); pressanykey(); return -2; } diff --git a/mbbsd/mail.c b/mbbsd/mail.c index 2b9fca71..5e480337 100644 --- a/mbbsd/mail.c +++ b/mbbsd/mail.c @@ -17,20 +17,20 @@ setforward() fscanf(fp, "%s", ip); // XXX check buffer size fclose(fp); } - getdata_buf(b_lines - 1, 0, I18N[1202], + getdata_buf(b_lines - 1, 0, gettext[1202], ip, sizeof(ip), DOECHO); if (ip[0] && ip[0] != ' ') { - getdata(b_lines, 0, I18N[1203], yn, sizeof(yn), + getdata(b_lines, 0, gettext[1203], yn, sizeof(yn), LCECHO); if (yn[0] != 'n' && (fp = fopen(buf, "w"))) { fprintf(fp, "%s", ip); fclose(fp); - vmsg(I18N[1204]); + vmsg(gettext[1204]); return 0; } } unlink(buf); - vmsg(I18N[1205]); + vmsg(gettext[1205]); return 0; } @@ -40,9 +40,9 @@ built_mail_index() char genbuf[128]; move(b_lines - 4, 0); - outs(I18N[1206]); + outs(gettext[1206]); getdata(b_lines - 1, 0, - I18N[1207], genbuf, 3, + gettext[1207], genbuf, 3, LCECHO); if (genbuf[0] != 'y') return 0; @@ -51,7 +51,7 @@ built_mail_index() BBSHOME "/bin/buildir " BBSHOME "/home/%c/%s", cuser.userid[0], cuser.userid); move(22, 0); - prints(I18N[1208]); + prints(gettext[1208]); pressanykey(); system(genbuf); return 0; @@ -116,13 +116,13 @@ m_internet() { char receiver[60]; - getdata(20, 0, I18N[1209], receiver, sizeof(receiver), DOECHO); + getdata(20, 0, gettext[1209], receiver, sizeof(receiver), DOECHO); if (strchr(receiver, '@') && !invalidaddr(receiver) && - getdata(21, 0, I18N[1210], save_title, STRLEN, DOECHO)) + getdata(21, 0, gettext[1210], save_title, STRLEN, DOECHO)) do_send(receiver, save_title); else { move(22, 0); - outs(I18N[1211]); + outs(gettext[1211]); pressanykey(); } return 0; @@ -154,12 +154,12 @@ chkmailbox() mailmaxkeep = max_keepmail + cuser.exmailbox; m_init(); if ((mailkeep = get_num_records(currmaildir, sizeof(fileheader_t))) > - mailmaxkeep || - (mailsum = get_sum_records(currmaildir, sizeof(fileheader_t))) > - mailsumlimit) { + mailmaxkeep || + (mailsum = get_sum_records(currmaildir, sizeof(fileheader_t))) > + mailsumlimit) { bell(); bell(); - vmsg(I18N[1212], mailkeep, mailmaxkeep); + vmsg(gettext[1212], mailkeep, mailmaxkeep); return mailkeep; } } @@ -177,7 +177,7 @@ do_hold_mail(char *fpath, char *receiver, char *holder) stampfile(buf, &mymail); mymail.filemode = FILE_READ ; - strlcpy(mymail.owner, I18N[1214], sizeof(mymail.owner)); + strlcpy(mymail.owner, gettext[1214], sizeof(mymail.owner)); if (receiver) { snprintf(title, sizeof(title), "(%s) %s", receiver, save_title); strncpy(mymail.title, title, TTLEN); @@ -196,7 +196,7 @@ hold_mail(char *fpath, char *receiver) { char buf[4]; - getdata(b_lines - 1, 0, I18N[1215], + getdata(b_lines - 1, 0, gettext[1215], buf, sizeof(buf), LCECHO); if (buf[0] == 'y') @@ -222,7 +222,7 @@ do_send(char *userid, char *title) return -3; if (!title) - getdata(2, 0, I18N[1216], save_title, STRLEN - 20, DOECHO); + getdata(2, 0, gettext[1216], save_title, STRLEN - 20, DOECHO); curredit |= EDIT_MAIL; curredit &= ~EDIT_ITEM; } @@ -240,17 +240,17 @@ do_send(char *userid, char *title) return -2; } clear(); - prints(I18N[1217], + prints(gettext[1217], userid, title); ch = igetch(); switch (ch) { case 'N': case 'n': - outs(I18N[1218]); + outs(gettext[1218]); res = -2; break; default: - outs(I18N[1219]); + outs(gettext[1219]); res = #ifndef USE_BSMTP bbs_sendmail(fpath, title, userid); @@ -299,7 +299,7 @@ my_send(char *uident) outs(msg_cancel); break; case -3: - prints(I18N[1220], uident); + prints(gettext[1220], uident); break; } pressanykey(); @@ -310,7 +310,7 @@ m_send() { char uident[40]; - stand_title(I18N[1221]); + stand_title(gettext[1221]); usercomplete(msg_uid, uident); showplans(uident); if (uident[0]) @@ -326,18 +326,18 @@ multi_list(int *reciper) char genbuf[200]; while (1) { - stand_title(I18N[1222]); - ShowNameList(3, 0, I18N[1201]); + stand_title(gettext[1222]); + ShowNameList(3, 0, gettext[1201]); move(1, 0); - prints(I18N[1223]); + prints(gettext[1223]); getdata(2, 0, - I18N[1224], + gettext[1224], genbuf, 4, LCECHO); switch (genbuf[0]) { case 'a': while (1) { move(1, 0); - usercomplete(I18N[1225], uid); + usercomplete(gettext[1225], uid); if (uid[0] == '\0') break; @@ -350,18 +350,18 @@ multi_list(int *reciper) AddNameList(uid); (*reciper)++; } - ShowNameList(3, 0, I18N[1201]); + ShowNameList(3, 0, gettext[1201]); } break; case 'd': while (*reciper) { move(1, 0); - namecomplete(I18N[1226], uid); + namecomplete(gettext[1226], uid); if (uid[0] == '\0') break; if (RemoveNameList(uid)) (*reciper)--; - ShowNameList(3, 0, I18N[1201]); + ShowNameList(3, 0, gettext[1201]); } break; case '0': @@ -378,15 +378,15 @@ multi_list(int *reciper) genbuf[0] = '1'; case 'i': setuserfile(genbuf, genbuf[0] == '1' ? listfile : fn_overrides); - ToggleNameList(reciper, genbuf, I18N[1201]); + ToggleNameList(reciper, genbuf, gettext[1201]); break; case 'o': setuserfile(genbuf, "alohaed"); - ToggleNameList(reciper, genbuf, I18N[1201]); + ToggleNameList(reciper, genbuf, gettext[1201]); break; case 'n': setuserfile(genbuf, "postlist"); - ToggleNameList(reciper, genbuf, I18N[1201]); + ToggleNameList(reciper, genbuf, gettext[1201]); break; case 'q': *reciper = 0; @@ -415,7 +415,7 @@ multi_send(char *title) fp = fopen(quote_file, "r"); assert(fp); while (fgets(genbuf, 256, fp)) { - if (strncmp(genbuf, I18N[1227], 3)) { + if (strncmp(genbuf, gettext[1227], 3)) { if (listing) break; } else { @@ -428,12 +428,12 @@ multi_send(char *title) reciper++; } } while ((ptr = (char *)strtok(NULL, " \n\r"))); - } else if (!strncmp(genbuf + 3, I18N[1228], 6)) + } else if (!strncmp(genbuf + 3, gettext[1228], 6)) listing = 1; } } fclose(fp); - ShowNameList(3, 0, I18N[1201]); + ShowNameList(3, 0, gettext[1201]); } multi_list(&reciper); move(1, 0); @@ -444,21 +444,21 @@ multi_send(char *title) if (title) do_reply_title(2, title); else { - getdata(2, 0, I18N[1229], fpath, sizeof(fpath), DOECHO); - snprintf(save_title, sizeof(save_title), I18N[1230], fpath); + getdata(2, 0, gettext[1229], fpath, sizeof(fpath), DOECHO); + snprintf(save_title, sizeof(save_title), gettext[1230], fpath); } setuserfile(fpath, fn_notes); if ((fp = fopen(fpath, "w"))) { - fprintf(fp, I18N[1231], reciper); + fprintf(fp, gettext[1231], reciper); listing = 80; for (p = toplev; p; p = p->next) { reciper = strlen(p->word) + 1; if (listing + reciper > 75) { listing = reciper; - fprintf(fp, I18N[1232]); + fprintf(fp, gettext[1232]); } else listing += reciper; @@ -518,7 +518,7 @@ multi_reply(int ent, fileheader_t * fhdr, char *direct) if (!(fhdr->filemode & FILE_MULTI)) return mail_reply(ent, fhdr, direct); - stand_title(I18N[1234]); + stand_title(gettext[1234]); strlcpy(quote_user, fhdr->owner, sizeof(quote_user)); setuserfile(quote_file, fhdr->filename); multi_send(fhdr->title); @@ -528,7 +528,7 @@ multi_reply(int ent, fileheader_t * fhdr, char *direct) int mail_list() { - stand_title(I18N[1235]); + stand_title(gettext[1235]); multi_send(NULL); return 0; } @@ -543,16 +543,16 @@ mail_all() int i, unum; char *userid; - stand_title(I18N[1236]); + stand_title(gettext[1236]); setutmpmode(SMAIL); - getdata(2, 0, I18N[1237], fpath, sizeof(fpath), DOECHO); + getdata(2, 0, gettext[1237], fpath, sizeof(fpath), DOECHO); snprintf(save_title, sizeof(save_title), - I18N[1238], fpath); + gettext[1238], fpath); setuserfile(fpath, fn_notes); if ((fp = fopen(fpath, "w"))) { - fprintf(fp, I18N[1239]); + fprintf(fp, gettext[1239]); fprintf(fp, "---------------------------------------------------------------------------\n"); fclose(fp); } @@ -570,7 +570,7 @@ mail_all() curredit = 0; setutmpmode(MAILALL); - stand_title(I18N[1240]); + stand_title(gettext[1240]); sethomepath(genbuf, cuser.userid); stampfile(genbuf, &mymail); @@ -619,7 +619,7 @@ mail_mbox() fileheader_t fhdr; snprintf(cmd, sizeof(cmd), "/tmp/%s.uu", cuser.userid); - snprintf(fhdr.title, sizeof(fhdr.title), I18N[1241], cuser.userid); + snprintf(fhdr.title, sizeof(fhdr.title), gettext[1241], cuser.userid); doforward(cmd, &fhdr, 'Z'); return 0; } @@ -629,7 +629,7 @@ m_forward(int ent, fileheader_t * fhdr, char *direct) { char uid[STRLEN]; - stand_title(I18N[1242]); + stand_title(gettext[1242]); usercomplete(msg_uid, uid); if (uid[0] == '\0') return FULLUPDATE; @@ -639,7 +639,7 @@ m_forward(int ent, fileheader_t * fhdr, char *direct) snprintf(save_title, sizeof(save_title), "%.64s (fwd)", fhdr->title); move(1, 0); clrtobot(); - prints(I18N[1243], uid, save_title); + prints(gettext[1243], uid, save_title); switch (do_send(uid, save_title)) { case -1: @@ -649,7 +649,7 @@ m_forward(int ent, fileheader_t * fhdr, char *direct) outs(msg_cancel); break; case -3: - prints(I18N[1244], uid); + prints(gettext[1244], uid); break; } pressanykey(); @@ -678,8 +678,8 @@ read_new_mail(fileheader_t * fptr) return 0; clear(); move(10, 0); - prints(I18N[1245], fptr->owner, fptr->title); - getdata(11, 0, I18N[1246], genbuf, 3, DOECHO); + prints(gettext[1245], fptr->owner, fptr->title); + getdata(11, 0, gettext[1246], genbuf, 3, DOECHO); if (genbuf[0] == 'q') return QUIT; if (genbuf[0] == 'n') @@ -695,17 +695,18 @@ read_new_mail(fileheader_t * fptr) while (!done) { int more_result = more(fname, YEA); - switch (more_result) { - case 999: - mail_reply(idc, fptr, currmaildir); - return FULLUPDATE; - case -1: - return READ_SKIP; - case 0: - break; - default: - return more_result; - } + switch (more_result) { + case 999: + mail_reply(idc, fptr, currmaildir); + return FULLUPDATE; + case -1: + return READ_SKIP; + case 0: + break; + default: + return more_result; + } + outmsg(msg_mailer); switch (igetch()) { @@ -728,7 +729,7 @@ read_new_mail(fileheader_t * fptr) } if (delete_it) { clear(); - prints(I18N[1247], fptr->title); + prints(gettext[1247], fptr->title); getdata(1, 0, msg_sure_ny, genbuf, 2, LCECHO); if (genbuf[0] == 'y') { unlink(fname); @@ -750,7 +751,7 @@ m_new() curredit |= EDIT_MAIL; curredit &= ~EDIT_ITEM; if (apply_record(currmaildir, read_new_mail, sizeof(fileheader_t)) == -1) { - outs(I18N[1248]); + outs(gettext[1248]); pressanykey(); return -1; } @@ -759,7 +760,7 @@ m_new() while (delcnt--) delete_record(currmaildir, sizeof(fileheader_t), delmsgs[delcnt]); } - outs(mrd ? I18N[1249] : I18N[1250]); + outs(mrd ? gettext[1249] : gettext[1250]); pressanykey(); return -1; } @@ -769,13 +770,13 @@ mailtitle() { char buf[256]; - showtitle(I18N[1251], BBSName); - prints(I18N[1252], - HAS_PERM(PERM_NOOUTMAIL) ? I18N[1253] : I18N[1254]); + showtitle(gettext[1251], BBSName); + prints(gettext[1252], + HAS_PERM(PERM_NOOUTMAIL) ? gettext[1253] : gettext[1254]); buf[0] = 0; if (mailsumlimit) { snprintf(buf, sizeof(buf), - I18N[1255], mailsum, mailsumlimit, + gettext[1255], mailsum, mailsumlimit, mailkeep, mailmaxkeep); } prints("%-29s\033[m", buf); @@ -792,7 +793,7 @@ maildoent(int num, fileheader_t * ent) title = subject(mark = ent->title); if (title == mark) { color = '1'; - mark = I18N[1256]; + mark = gettext[1256]; } else { color = '3'; mark = "R:"; @@ -816,11 +817,11 @@ mail_del(int ent, fileheader_t * fhdr, char *direct) return DONOTHING; if (currmode & MODE_SELECT) { - vmsg("請先回到正常模式後再進行刪除..."); - return READ_REDRAW; - } - - if (getans(msg_del_ny) == 'y') { + vmsg(gettext[3611]); + return READ_REDRAW; + } + + if (getans(msg_del_ny) == 'y') { if (!delete_record(direct, sizeof(*fhdr), ent)) { setdirpath(genbuf, direct, fhdr->filename); unlink(genbuf); @@ -845,18 +846,18 @@ mail_read(int ent, fileheader_t * fhdr, char *direct) if (more_result != -1) { fhdr->filemode |= FILE_READ; - substitute_ref_record(direct, fhdr, ent); + substitute_ref_record(direct, fhdr, ent); } switch (more_result) { case 999: - mail_reply(ent, fhdr, direct); - return FULLUPDATE; - case -1: - return READ_SKIP; + mail_reply(ent, fhdr, direct); + return FULLUPDATE; + case -1: + return READ_SKIP; case 0: - break; + break; default: - return more_result; + return more_result; } outmsg(msg_mailer); @@ -881,8 +882,8 @@ mail_read(int ent, fileheader_t * fhdr, char *direct) if (delete_it) mail_del(ent, fhdr, direct); else { - fhdr->filemode |= FILE_READ; - substitute_ref_record(direct, fhdr, ent); + fhdr->filemode |= FILE_READ; + substitute_ref_record(direct, fhdr, ent); } return FULLUPDATE; } @@ -896,7 +897,7 @@ mail_reply(int ent, fileheader_t * fhdr, char *direct) FILE *fp; char genbuf[512]; - stand_title(I18N[1257]); + stand_title(gettext[1257]); /* 判斷是 boards 或 mail */ if (curredit & EDIT_MAIL) @@ -916,7 +917,7 @@ mail_reply(int ent, fileheader_t * fhdr, char *direct) if (!strcmp(t, str_author1) || !strcmp(t, str_author2)) strlcpy(uid, strtok(NULL, str_space), sizeof(uid)); else { - outs(I18N[1258]); + outs(gettext[1258]); pressanykey(); return FULLUPDATE; } @@ -925,7 +926,7 @@ mail_reply(int ent, fileheader_t * fhdr, char *direct) /* make the title */ do_reply_title(3, fhdr->title); - prints(I18N[1259], uid, save_title); + prints(gettext[1259], uid, save_title); /* edit, then send the mail */ ent = curredit; @@ -937,7 +938,7 @@ mail_reply(int ent, fileheader_t * fhdr, char *direct) outs(msg_cancel); break; case -3: - prints(I18N[1260], uid); + prints(gettext[1260], uid); break; } curredit = ent; @@ -952,7 +953,7 @@ mail_edit(int ent, fileheader_t * fhdr, char *direct) if (!HAS_PERM(PERM_SYSOP) && strcmp(cuser.userid, fhdr->owner) && - strcmp(I18N[1261], fhdr->owner)) + strcmp(gettext[1261], fhdr->owner)) return DONOTHING; setdirpath(genbuf, direct, fhdr->filename); @@ -973,8 +974,8 @@ static int mail_mark(int ent, fileheader_t * fhdr, char *direct) { fhdr->filemode ^= FILE_MARKED; - - substitute_ref_record(direct, fhdr, ent); + + substitute_ref_record(direct, fhdr, ent); return PART_REDRAW; } @@ -1003,7 +1004,7 @@ mail_cross_post(int ent, fileheader_t * fhdr, char *direct) move(2, 0); clrtoeol(); move(1, 0); - generalnamecomplete(I18N[1283], xboard, sizeof(xboard), + generalnamecomplete(gettext[1283], xboard, sizeof(xboard), SHM->Bnumber, completeboard_compar, completeboard_permission, @@ -1013,27 +1014,27 @@ mail_cross_post(int ent, fileheader_t * fhdr, char *direct) ent = 1; if (HAS_PERM(PERM_SYSOP) || !strcmp(fhdr->owner, cuser.userid)) { - getdata(2, 0, I18N[1284], + getdata(2, 0, gettext[1284], genbuf, 3, DOECHO); if (genbuf[0] != '2') { ent = 0; - getdata(2, 0, I18N[1285], inputbuf, 3, DOECHO); + getdata(2, 0, gettext[1285], inputbuf, 3, DOECHO); if (inputbuf[0] != 'n' && inputbuf[0] != 'N') author = 1; } } if (ent) - snprintf(xtitle, sizeof(xtitle), I18N[1286], fhdr->title); + snprintf(xtitle, sizeof(xtitle), gettext[1286], fhdr->title); else strlcpy(xtitle, fhdr->title, sizeof(xtitle)); - snprintf(genbuf, sizeof(genbuf), I18N[1287], xtitle); + snprintf(genbuf, sizeof(genbuf), gettext[1287], xtitle); getdata(2, 0, genbuf, genbuf2, sizeof(genbuf2), LCECHO); if (*genbuf2 == 'n') - if (getdata(2, 0, I18N[1288], genbuf, TTLEN, DOECHO)) + if (getdata(2, 0, gettext[1288], genbuf, TTLEN, DOECHO)) strlcpy(xtitle, genbuf, sizeof(xtitle)); - getdata(2, 0, I18N[1289], genbuf, 3, LCECHO); + getdata(2, 0, gettext[1289], genbuf, 3, LCECHO); if (genbuf[0] == 'l' || genbuf[0] == 's') { int currmode0 = currmode; @@ -1060,7 +1061,7 @@ mail_cross_post(int ent, fileheader_t * fhdr, char *direct) write_header(xptr); currboard = save_currboard; - fprintf(xptr, I18N[1290], cuser.userid); + fprintf(xptr, gettext[1290], cuser.userid); b_suckinfile(xptr, fname); addsignature(xptr, 0); @@ -1076,7 +1077,7 @@ mail_cross_post(int ent, fileheader_t * fhdr, char *direct) if (!xfile.filemode) outgo_post(&xfile, xboard); cuser.numposts++; - outmsg(I18N[1291]); + outmsg(gettext[1291]); pressanykey(); currmode = currmode0; } @@ -1092,7 +1093,7 @@ mail_man() int stat0 = currstat; sethomeman(buf, cuser.userid); - snprintf(buf1, sizeof(buf1), I18N[1292], cuser.userid); + snprintf(buf1, sizeof(buf1), gettext[1292], cuser.userid); a_menu(buf1, buf, 1); currutmp->mode = mode0; currstat = stat0; @@ -1111,7 +1112,7 @@ mail_cite(int ent, fileheader_t * fhdr, char *direct) int bid; setuserfile(fpath, fhdr->filename); - strlcpy(title, I18N[1293], sizeof(title)); + strlcpy(title, gettext[1293], sizeof(title)); strncpy(title + 3, fhdr->title, TTLEN - 3); title[TTLEN] = '\0'; a_copyitem(fpath, title, 0, 1); @@ -1123,7 +1124,7 @@ mail_cite(int ent, fileheader_t * fhdr, char *direct) clrtoeol(); move(1, 0); - generalnamecomplete(I18N[1294], + generalnamecomplete(gettext[1294], buf, sizeof(buf), SHM->Bnumber, completeboard_compar, @@ -1154,7 +1155,7 @@ mail_save(int ent, fileheader_t * fhdr, char *direct) if (HAS_PERM(PERM_MAILLIMIT)) { setuserfile(fpath, fhdr->filename); - strlcpy(title, I18N[1295], sizeof(title)); + strlcpy(title, gettext[1295], sizeof(title)); strncpy(title + 3, fhdr->title, TTLEN - 3); title[TTLEN] = '\0'; a_copyitem(fpath, title, fhdr->owner, 1); @@ -1173,30 +1174,30 @@ mail_waterball(int ent, fileheader_t * fhdr, char *direct) char fname[500], genbuf[200]; FILE *fp; - if (!(strstr(fhdr->title, I18N[1296]) && strstr(fhdr->title, I18N[1297]))) { - vmsg(I18N[1298]); + if (!(strstr(fhdr->title, gettext[1296]) && strstr(fhdr->title, gettext[1297]))) { + vmsg(gettext[1298]); return 1; } if (!address[0]) strlcpy(address, cuser.email, sizeof(address)); move(b_lines - 8, 0); - outs(I18N[1299]); + outs(gettext[1299]); if (address[0]) { - snprintf(genbuf, sizeof(genbuf), I18N[1300], address); + snprintf(genbuf, sizeof(genbuf), gettext[1300], address); getdata(b_lines - 5, 0, genbuf, fname, 3, LCECHO); if (fname[0] == 'q') { - outmsg(I18N[1301]); + outmsg(gettext[1301]); return 1; } if (fname[0] == 'n') address[0] = '\0'; } if (!address[0]) { - getdata(b_lines - 5, 0, I18N[1302], fname, 60, DOECHO); + getdata(b_lines - 5, 0, gettext[1302], fname, 60, DOECHO); if (fname[0] && strchr(fname, '.')) { strlcpy(address, fname, sizeof(address)); } else { - vmsg(I18N[1303]); + vmsg(gettext[1303]); return 1; } } @@ -1204,17 +1205,17 @@ mail_waterball(int ent, fileheader_t * fhdr, char *direct) return -2; if( strstr(address, ".bbs") && HAS_PERM(PERM_NOOUTMAIL) ){ move(b_lines - 4, 0); - outs(I18N[1304]); - vmsg(I18N[1305]); + outs(gettext[1304]); + vmsg(gettext[1305]); return FULLUPDATE; } //snprintf(fname, sizeof(fname), "%d\n", cmode); move(b_lines - 4, 0); - outs(I18N[1306]); - getdata(b_lines - 1, 0, I18N[1307], fname, 3, LCECHO); + outs(gettext[1306]); + getdata(b_lines - 1, 0, gettext[1307], fname, 3, LCECHO); if (fname[0] == 'Q' || fname[0] == 'q') { - outmsg(I18N[1308]); + outmsg(gettext[1308]); return 1; } cmode = (fname[0] != '0' && fname[0] != '1') ? 1 : fname[0] - '0'; @@ -1231,7 +1232,7 @@ mail_waterball(int ent, fileheader_t * fhdr, char *direct) assert(fp); fprintf(fp, "%s\n%s\n%d\n", cuser.userid, address, cmode); fclose(fp); - vmsg(I18N[1309]); + vmsg(gettext[1309]); return FULLUPDATE; } #endif @@ -1340,7 +1341,7 @@ m_read() currutmp->mailalert = load_mailalert(cuser.userid); return 0; } else { - outs(I18N[1310]); + outs(gettext[1310]); return XEASY; } } @@ -1416,7 +1417,7 @@ bbs_sendmail(char *fpath, char *title, char *receiver) cuser.userid, str_mail_address, cuser.username, cuser.userid, str_mail_address); - fprintf(fout,"To: %s\nSubject: %s\nMime-Version: 1.0\r\nContent-Type: text/plain; charset=\"big5\"\r\nContent-Transfer-Encoding: 8bit\r\nX-Disclaimer: " BBSNAME I18N[1311], + fprintf(fout,"To: %s\nSubject: %s\nMime-Version: 1.0\r\nContent-Type: text/plain; charset=\"big5\"\r\nContent-Transfer-Encoding: 8bit\r\nX-Disclaimer: " BBSNAME gettext[1311], receiver, title); while (fgets(genbuf, sizeof(genbuf), fin)) { @@ -1493,16 +1494,16 @@ doforward(char *direct, fileheader_t * fh, int mode) strlcpy(address, cuser.email, sizeof(address)); if( mode == 'U' ){ - vmsg(I18N[1312]); + vmsg(gettext[1312]); } if (address[0]) { snprintf(genbuf, sizeof(genbuf), - I18N[1313], address); + gettext[1313], address); getdata(b_lines, 0, genbuf, fname, 3, LCECHO); if (fname[0] == 'q') { - outmsg(I18N[1314]); + outmsg(gettext[1314]); return 1; } if (fname[0] == 'n') @@ -1510,7 +1511,7 @@ doforward(char *direct, fileheader_t * fh, int mode) } if (!address[0]) { do { - getdata(b_lines - 1, 0, I18N[1315], fname, 60, DOECHO); + getdata(b_lines - 1, 0, gettext[1315], fname, 60, DOECHO); if (fname[0]) { if (strchr(fname, '.')) strlcpy(address, fname, sizeof(address)); @@ -1518,7 +1519,7 @@ doforward(char *direct, fileheader_t * fh, int mode) snprintf(address, sizeof(address), "%s.bbs@%s", fname, MYHOSTNAME); } else { - vmsg(I18N[1316]); + vmsg(gettext[1316]); return 1; } } while (mode == 'Z' && strstr(address, MYHOSTNAME)); @@ -1530,9 +1531,8 @@ doforward(char *direct, fileheader_t * fh, int mode) refresh(); /* 追蹤使用者 */ - if (HAS_PERM(PERM_LOGUSER)) { - log_user("mailforward to %s ",address); - } + if (HAS_PERM(PERM_LOGUSER)) + log_user("mailforward to %s ",address); if (mode == 'Z') { snprintf(fname, sizeof(fname), TAR_PATH " cfz /tmp/home.%s.tgz home/%c/%s; " @@ -1621,7 +1621,7 @@ mail_justify(userec_t muser) stampfile(buf1, &mhdr); unlink(buf1); strlcpy(mhdr.owner, cuser.userid, sizeof(mhdr.owner)); - strncpy(mhdr.title, I18N[1318], TTLEN); + strncpy(mhdr.title, gettext[1318], TTLEN); mhdr.filemode = 0; if (valid_ident(muser.email) && !invalidaddr(muser.email)) { diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 720f876e..84531331 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -102,12 +102,12 @@ log_usies(char *mode, char *mesg) { if (!mesg) - log_file(FN_USIES, 1, + log_file(FN_USIES, LOG_CREAT | LOG_VF, "%s %s %-12s Stay:%d (%s)\n", Cdate(&now), mode, cuser.userid , (int)(now - login_start_time) / 60, cuser.username); else - log_file(FN_USIES, 1, + log_file(FN_USIES, LOG_CREAT | LOG_VF, "%s %s %-12s %s\n", Cdate(&now), mode, cuser.userid, mesg); @@ -156,7 +156,7 @@ u_exit(char *mode) setutmpbid(0); if (!(HAS_PERM(PERM_SYSOP) && HAS_PERM(PERM_SYSOPHIDE)) && !currutmp->invisible) - do_aloha(I18N[1319]); + do_aloha(gettext[1319]); purge_utmp(currutmp); if ((cuser.uflag != enter_uflag) || (currmode & MODE_DIRTY) || diff) { @@ -215,10 +215,10 @@ talk_request(int sig) move(0, 0); clrtoeol(); - prints(I18N[1321], + prints(gettext[1321], SHM->uinfo[currutmp->destuip].userid, my_ctime(&now,timebuf,sizeof(timebuf)), - (currutmp->sig == 2) ? I18N[1322] - : I18N[1323]); + (currutmp->sig == 2) ? gettext[1322] + : gettext[1323]); refresh(); } else { unsigned char mode0 = currutmp->mode; @@ -241,7 +241,7 @@ void show_call_in(int save, int which) { char buf[200]; - snprintf(buf, sizeof(buf), I18N[1324], + snprintf(buf, sizeof(buf), gettext[1324], currutmp->msgs[which].userid, currutmp->msgs[which].last_call_in); move(b_lines, 0); clrtoeol(); @@ -438,7 +438,7 @@ multi_user_check() if (!pid /* || (kill(pid, 0) == -1) */ ) return; /* stale entry in utmp file */ - getdata(b_lines - 1, 0, I18N[1325], + getdata(b_lines - 1, 0, gettext[1325], genbuf, 3, LCECHO); if (genbuf[0] != 'n') { @@ -452,7 +452,7 @@ multi_user_check() } else { /* allow multiple guest user */ if (search_ulistn(usernum, 100) != NULL) { - vmsg(I18N[1326]); + vmsg(gettext[1326]); exit(1); } } @@ -507,6 +507,7 @@ login_query() char uid[IDLEN + 1], passbuf[PASSLEN]; int attempts; #endif + gettext = SHM->i18nstr[0]; resolve_garbage(); now = time(0); @@ -530,7 +531,7 @@ login_query() move(19, 0); prints("current pid: %d ", getpid()); #endif - getdata(20, 0, I18N[1327], + getdata(20, 0, SHM->i18nstr[0][1327], uid, sizeof(uid), DOECHO); #ifdef CONVERT /* switch to gb mode if uid end with '.' */ @@ -553,7 +554,7 @@ login_query() mkuserdir(cuser.userid); break; #else - outs(I18N[1328]); + outs(SHM->gettextstr[0][1328]); continue; #endif } else if (uid[0] == '\0'){ @@ -568,6 +569,7 @@ login_query() logattempt(cuser.userid , '-'); outs(ERR_PASSWD); } else { + gettext = SHM->i18nstr[cuser.language]; logattempt(cuser.userid, ' '); if (strcasecmp("SYSOP", cuser.userid) == 0){ #ifdef NO_SYSOP_ACCOUNT @@ -777,7 +779,7 @@ setup_utmp(int mode) } inline static void welcome_msg(void) { - prints(I18N[1329], + prints(gettext[1329], ++cuser.numlogins, cuser.lasthost, Cdate(&(cuser.lastlogin))); pressanykey(); } @@ -787,8 +789,8 @@ inline static void check_bad_login(void) { setuserfile(genbuf, str_badlogin); if (more(genbuf, NA) != -1) { move(b_lines - 3, 0); - prints(I18N[1330]); - if (getans(I18N[1331]) != 'n') + prints(gettext[1330]); + if (getans(gettext[1331]) != 'n') unlink(genbuf); } } @@ -816,23 +818,23 @@ static void init_guest_info(void) { int i; char *nick[13] = { - I18N[1332], I18N[1333], I18N[1334], I18N[1335], I18N[1336], - I18N[1337], I18N[1338], I18N[1339], I18N[1340], I18N[1341], - I18N[1342], I18N[1343], I18N[1344] + gettext[1332], gettext[1333], gettext[1334], gettext[1335], gettext[1336], + gettext[1337], gettext[1338], gettext[1339], gettext[1340], gettext[1341], + gettext[1342], gettext[1343], gettext[1344] }; char *name[13] = { - I18N[1345], I18N[1346], I18N[1347], I18N[1348], I18N[1349], - I18N[1350], I18N[1351], "AIR Jordon", I18N[1352], I18N[1353], - I18N[1354], I18N[1355], I18N[1356] + gettext[1345], gettext[1346], gettext[1347], gettext[1348], gettext[1349], + gettext[1350], gettext[1351], "AIR Jordon", gettext[1352], gettext[1353], + gettext[1354], gettext[1355], gettext[1356] }; char *addr[13] = { - I18N[1357], I18N[1358], I18N[1359], I18N[1360], I18N[1361], - I18N[1362], I18N[1363], "NIKE", I18N[1364], I18N[1365], - I18N[1366], I18N[1367], I18N[1368] + gettext[1357], gettext[1358], gettext[1359], gettext[1360], gettext[1361], + gettext[1362], gettext[1363], "NIKE", gettext[1364], gettext[1365], + gettext[1366], gettext[1367], gettext[1368] }; i = login_start_time % 13; snprintf(cuser.username, sizeof(cuser.username), - I18N[1369], nick[(int)i]); + gettext[1369], nick[(int)i]); strlcpy(currutmp->username, cuser.username, sizeof(currutmp->username)); strlcpy(cuser.realname, name[(int)i], sizeof(cuser.realname)); @@ -845,11 +847,11 @@ static void init_guest_info(void) inline static void foreign_warning(void){ if ((cuser.uflag2 & FOREIGN) && !(cuser.uflag2 & LIVERIGHT)){ if (login_start_time - cuser.firstlogin > (FOREIGN_REG_DAY - 5) * 24 * 3600){ - mail_muser(cuser, I18N[1370], "etc/foreign_expired_warn"); + mail_muser(cuser, gettext[1370], "etc/foreign_expired_warn"); } else if (login_start_time - cuser.firstlogin > FOREIGN_REG_DAY * 24 * 3600){ cuser.userlevel &= ~(PERM_LOGINOK | PERM_POST); - vmsg(I18N[1371]); + vmsg(gettext[1371]); } } } @@ -894,7 +896,7 @@ user_login() resolve_fcache(); resolve_boards(); memset(&water[0], 0, sizeof(water_t) * 6); - strlcpy(water[0].userid, I18N[1372], sizeof(water[0].userid)); + strlcpy(water[0].userid, gettext[1372], sizeof(water[0].userid)); if(getenv("SSH_CLIENT") != NULL){ char frombuf[50]; @@ -919,7 +921,7 @@ user_login() if (!(HAS_PERM(PERM_SYSOP) && HAS_PERM(PERM_SYSOPHIDE)) && !currutmp->invisible) - do_aloha(I18N[1373]); + do_aloha(gettext[1373]); if(SHM->loginmsg.pid) { @@ -1048,7 +1050,7 @@ start_client() showansi = 0; signal(SIGALRM, SIG_IGN); - domenu(MMENU, I18N[1374], (currutmp->mailalert ? 'M' : 'C'), cmdlist); + domenu(MMENU, gettext[1374], (currutmp->mailalert ? 'M' : 'C'), cmdlist); } /* FSA (finite state automata) for telnet protocol */ @@ -1438,7 +1440,7 @@ check_ban_and_load(int fd) write(fd, INSCREEN, sizeof(INSCREEN)); #else #define BANNER \ -I18N[1375] BBSNAME I18N[1376] MYHOSTNAME I18N[1377] MYIP ") \r\n" +gettext[1375] BBSNAME gettext[1376] MYHOSTNAME gettext[1377] MYIP ") \r\n" write(fd, BANNER, sizeof(BANNER)); #endif @@ -1463,9 +1465,9 @@ I18N[1375] BBSNAME I18N[1376] MYHOSTNAME I18N[1377] MYIP ") \r\n" } if(overload == 1) - write(fd, I18N[1378], 22); + write(fd, gettext[1378], 22); else if(overload == 2) - write(fd, I18N[1379], 28); + write(fd, gettext[1379], 28); else if (banned && (fp = fopen(BBSHOME "/" BAN_FILE, "r"))) { char buf[256]; while (fgets(buf, sizeof(buf), fp)) diff --git a/mbbsd/menu.c b/mbbsd/menu.c index 23c14428..a8eaf0c5 100644 --- a/mbbsd/menu.c +++ b/mbbsd/menu.c @@ -31,12 +31,12 @@ showtitle(char *title, char *mid) } #else else if (currutmp->mailalert) { - snprintf(buf1, sizeof(buf1), "%s"TITLE_COLOR, I18N[1380]); + snprintf(buf1, sizeof(buf1), "%s"TITLE_COLOR, gettext[1380]); mid = buf1; spc = 22; } else if (HAS_PERM(PERM_SYSOP) && (nreg = dashs(fn_register) / 163) > 10) { snprintf(numreg, sizeof(numreg), - I18N[1381], + gettext[1381], nreg, (int)dashs("register.new.tmp") / 163, TITLE_COLOR); mid = numreg; spc = 22; @@ -50,10 +50,10 @@ showtitle(char *title, char *mid) buf[spc] = '\0'; clear(); - prints(I18N[1382], TITLE_COLOR, + prints(gettext[1382], TITLE_COLOR, title, buf, mid, buf, " " + pad, - currmode & MODE_SELECT ? I18N[1383] : currmode & MODE_ETC ? I18N[1384] : - currmode & MODE_DIGEST ? I18N[1385] : I18N[1386]); + currmode & MODE_SELECT ? gettext[1383] : + currmode & MODE_DIGEST ? gettext[1385] : gettext[1386]); if (strcmp(currboard, lastboard)) { /* change board */ if (currboard[0] != 0 && @@ -68,8 +68,8 @@ showtitle(char *title, char *mid) prints("\033[32m%s", currboard); else prints("%s", currboard); - prints(I18N[1387], currmode & MODE_SELECT ? 6 : - currmode & MODE_ETC ? 5 : currmode & MODE_DIGEST ? 2 : 7); + prints(gettext[1387], currmode & MODE_SELECT ? 6 : + currmode & MODE_DIGEST ? 2 : 7); } /* 動畫處理 */ @@ -83,15 +83,15 @@ show_status(void) int i; struct tm *ptime = localtime(&now); char mystatus[160]; - char *myweek = I18N[1388]; - const char *msgs[] = {I18N[1389], I18N[1390], I18N[1391], I18N[1392], I18N[1393]}; + char *myweek = gettext[1388]; + const char *msgs[] = {gettext[1389], gettext[1390], gettext[1391], gettext[1392], gettext[1393]}; i = ptime->tm_wday << 1; snprintf(mystatus, sizeof(mystatus), - I18N[1394], + gettext[1394], ptime->tm_mon + 1, ptime->tm_mday, myweek[i], myweek[i + 1], ptime->tm_hour, ptime->tm_min, currutmp->birth ? - I18N[1395] : SHM->today_is, + gettext[1395] : SHM->today_is, SHM->UTMPnumber, cuser.userid, msgs[currutmp->pager]); outmsg(mystatus); } @@ -155,8 +155,8 @@ show_menu(commands_t * p) move(menu_row, 0); while (p[n].desc > 0 && p[n].desc < MAX_STRING) { if (HAS_PERM(p[n].level)) { - s = I18N[p[n].desc]; - snprintf(buf, sizeof(buf), s + 2, I18N[1396 + cuser.proverb % 4]); + s = gettext[p[n].desc]; + snprintf(buf, sizeof(buf), s + 2, gettext[1396 + cuser.proverb % 4]); prints("%*s (\033[1;36m%c\033[0m)%s\n", menu_column, "", s[1], buf); } @@ -261,15 +261,15 @@ domenu(int cmdmode, char *cmdtitle, int cmd, commands_t cmdtable[]) refscreen = YEA; if (err != -1) - cmd = I18N[cmdtable[lastcmdptr].desc][0]; + cmd = gettext[cmdtable[lastcmdptr].desc][0]; else - cmd = I18N[cmdtable[lastcmdptr].desc][1]; - cmd0[cmdmode] = I18N[cmdtable[lastcmdptr].desc][0]; + cmd = gettext[cmdtable[lastcmdptr].desc][1]; + cmd0[cmdmode] = gettext[cmdtable[lastcmdptr].desc][0]; } if (cmd >= 'a' && cmd <= 'z') cmd &= ~0x20; while (++i <= total) - if (I18N[cmdtable[i].desc][1] == cmd) + if (gettext[cmdtable[i].desc][1] == cmd) break; } @@ -343,6 +343,11 @@ static commands_t talklist[] = { {t_talk, PERM_PAGE, 1426}, {t_chat, PERM_CHAT, 1427}, {t_display, 0, 1428}, +#if HAVE_FREECLOAK + {u_cloak, PERM_LOGINOK, 1443}, +#else + {u_cloak, PERM_CLOAK, 1444}, +#endif {NULL, 0, -1} }; @@ -375,17 +380,14 @@ static commands_t userlist[] = { {u_editcalendar, PERM_LOGINOK, 1436}, {u_loginview, PERM_LOGINOK, 1437}, {u_ansi, 0, 1438}, + {u_language, PERM_LOGINOK, 3612}, {u_movie, 0, 1439}, #ifdef HAVE_SUICIDE {u_kill, PERM_BASIC, 1440}, #endif {u_editplan, PERM_LOGINOK, 1441}, {u_editsig, PERM_LOGINOK, 1442}, -#if HAVE_FREECLOAK - {u_cloak, PERM_LOGINOK, 1443}, -#else - {u_cloak, PERM_CLOAK, 1444}, -#endif + {u_register, PERM_BASIC, 1445}, {u_list, PERM_SYSOP, 1446}, {NULL, 0, -1} @@ -428,7 +430,7 @@ static commands_t moneylist[] = { }; static int p_money() { - domenu(PSALE, I18N[1467], '0', moneylist); + domenu(PSALE, gettext[1467], '0', moneylist); return 0; }; @@ -443,7 +445,7 @@ static commands_t jceelist[] = { }; static int m_jcee() { - domenu(JCEE, I18N[1473], '0', jceelist); + domenu(JCEE, gettext[1473], '0', jceelist); return 0; } #endif @@ -480,7 +482,7 @@ static commands_t chesslist[] = { }; static int chessroom() { - domenu(CHC, I18N[1486], '1', chesslist); + domenu(CHC, gettext[1486], '1', chesslist); return 0; } @@ -501,7 +503,7 @@ static commands_t plist[] = { }; static int playground() { - domenu(AMUSE, I18N[1495],'1',plist); + domenu(AMUSE, gettext[1495],'1',plist); return 0; } @@ -513,7 +515,7 @@ static commands_t slist[] = { }; static int forsearch() { - domenu(SREG, I18N[1499], '1', slist); + domenu(SREG, gettext[1499], '1', slist); return 0; } @@ -521,43 +523,43 @@ static int forsearch() { int admin() { - domenu(ADMIN, I18N[1500], 'X', adminlist); + domenu(ADMIN, gettext[1500], 'X', adminlist); return 0; } int Mail() { - domenu(MAIL, I18N[1501], 'R', maillist); + domenu(MAIL, gettext[1501], 'R', maillist); return 0; } int Talk() { - domenu(TMENU, I18N[1502], 'U', talklist); + domenu(TMENU, gettext[1502], 'U', talklist); return 0; } int User() { - domenu(UMENU, I18N[1503], 'A', userlist); + domenu(UMENU, gettext[1503], 'A', userlist); return 0; } int Xyz() { - domenu(XMENU, I18N[1504], 'M', xyzlist); + domenu(XMENU, gettext[1504], 'M', xyzlist); return 0; } int Play_Play() { - domenu(PMENU, I18N[1505], 'A', playlist); + domenu(PMENU, gettext[1505], 'A', playlist); return 0; } int Name_Menu() { - domenu(NMENU, I18N[1506], 'O', namelist); + domenu(NMENU, gettext[1506], 'O', namelist); return 0; } diff --git a/mbbsd/more.c b/mbbsd/more.c index cba16af7..8d9d9f88 100644 --- a/mbbsd/more.c +++ b/mbbsd/more.c @@ -12,7 +12,6 @@ static int more_help[] = {1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, -1}; - int beep = 0; static void @@ -114,7 +113,7 @@ more_readln(int fd, unsigned char *buf) int more(char *fpath, int promptend) { - char *head[4] = {I18N[1528], I18N[1529], I18N[1530], I18N[1531]}; + char *head[4] = {gettext[1528], gettext[1529], gettext[1530], gettext[1531]}; char *ptr, *word = NULL, buf[ANSILINELEN + 1]; struct stat st; @@ -207,7 +206,7 @@ more(char *fpath, int promptend) /* ※處理引用者 & 引言 */ if ((buf[1] == ' ') && (buf[0] == ':' || buf[0] == '>')) word = "\033[36m"; - else if (!strncmp(buf, I18N[1532], 2) || !strncmp(buf, "==>", 3)) + else if (!strncmp(buf, gettext[1532], 2) || !strncmp(buf, "==>", 3)) word = "\033[32m"; if (word) @@ -298,13 +297,13 @@ more(char *fpath, int promptend) } else color = 2; - prints(I18N[1533], + prints(gettext[1533], printcolor[(int)color], pageno, (int)((viewed * 100) / fsize), "\033[31;47m", - I18N[1534], - I18N[1535]); + gettext[1534], + gettext[1535]); while (line == b_lines || (line > 0 && viewed == fsize)) { @@ -328,11 +327,11 @@ more(char *fpath, int promptend) char ans[4] = "n"; *search_str = search_char0; - getdata_buf(b_lines - 1, 0, I18N[1536], search_str, + getdata_buf(b_lines - 1, 0, gettext[1536], search_str, 40, DOECHO); if (*search_str) { searching = 1; - if (getdata(b_lines - 1, 0, I18N[1537], + if (getdata(b_lines - 1, 0, gettext[1537], ans, sizeof(ans), LCECHO) && *ans == 'y') fptr = strstr; else @@ -361,7 +360,7 @@ more(char *fpath, int promptend) lino = line = 0; } break; - case 'r': + case 'r': // Ptt: put all reply/recommend function here case 'R': case 'Y': case 'y': @@ -460,11 +459,11 @@ more(char *fpath, int promptend) break; case Ctrl('T'): - getdata(b_lines - 2, 0, I18N[1538], + getdata(b_lines - 2, 0, gettext[1538], buf, 4, LCECHO); if (buf[0] == 'y') { - setuserfile(buf, ask_tmpbuf(b_lines - 1)); - Copy(fpath, buf); + setuserfile(buf, ask_tmpbuf(b_lines - 1)); + Copy(fpath, buf); } if (pageno) pageno--; diff --git a/mbbsd/name.c b/mbbsd/name.c index d8f804fa..7fd545b1 100644 --- a/mbbsd/name.c +++ b/mbbsd/name.c @@ -264,7 +264,6 @@ namecomplete(char *prompt, char *data) prints("%*s", IDLEN + 1, ""); standend(); move(y, x); - refresh(); while ((ch = igetch()) != EOF) { if (ch == '\n' || ch == '\r') { @@ -294,7 +293,7 @@ namecomplete(char *prompt, char *data) len = MaxLen(morelist, p_lines); move(2, 0); clrtobot(); - printdash(I18N[1539]); + printdash(gettext[1539]); while (len + col < 80) { int i; @@ -418,7 +417,7 @@ usercomplete(char *prompt, char *data) len = UserMaxLen((arrptr) cwlist, cwnum, morenum, p_lines); move(2, 0); clrtobot(); - printdash(I18N[1540]); + printdash(gettext[1540]); while (len + col < 79) { int i; @@ -591,7 +590,7 @@ generalnamecomplete(char *prompt, char *data, int len, size_t nmemb, clearbot = YEA; move(2, 0); clrtobot(); - printdash(I18N[1541]); + printdash(gettext[1541]); col = 0; while (len + col < 79) { diff --git a/mbbsd/othello.c b/mbbsd/othello.c index 80f63787..19b7f76f 100644 --- a/mbbsd/othello.c +++ b/mbbsd/othello.c @@ -10,9 +10,9 @@ #define STARTX 3 #define STARTY 20 #define NONE_CHESS " " -#define WHITE_CHESS I18N[1542] -#define BLACK_CHESS I18N[1543] -#define HINT_CHESS I18N[1544] +#define WHITE_CHESS gettext[1542] +#define BLACK_CHESS gettext[1543] +#define HINT_CHESS gettext[1544] #define NONE 0 #define HINT 1 #define BLACK 2 @@ -79,43 +79,43 @@ printboard() int i; move(STARTX, STARTY); - prints(I18N[1545]); + prints(gettext[1545]); for (i = 0; i < 7; i++) { move(STARTX + 1 + i * 2, STARTY); - prints(I18N[1546]); + prints(gettext[1546]); move(STARTX + 2 + i * 2, STARTY); - prints(I18N[1547]); + prints(gettext[1547]); } move(STARTX + 1 + i * 2, STARTY); - prints(I18N[1548]); + prints(gettext[1548]); move(STARTX + 2 + i * 2, STARTY); - prints(I18N[1549]); + prints(gettext[1549]); print_chess(4, 4, WHITE); print_chess(5, 5, WHITE); print_chess(4, 5, BLACK); print_chess(5, 4, BLACK); move(3, 56); - prints(I18N[1550], cuser.userid); + prints(gettext[1550], cuser.userid); move(3, 72); prints(": 02"); move(4, 56); - prints(I18N[1551]); + prints(gettext[1551]); move(6, 56); - prints(I18N[1552]); + prints(gettext[1552]); move(7, 56); - prints(I18N[1553]); + prints(gettext[1553]); move(8, 56); - prints(I18N[1554]); + prints(gettext[1554]); move(9, 56); - prints(I18N[1555]); + prints(gettext[1555]); move(10, 56); - prints(I18N[1556]); + prints(gettext[1556]); move(11, 56); - prints(I18N[1557]); + prints(gettext[1557]); move(12, 56); - prints(I18N[1558]); + prints(gettext[1558]); move(13, 56); - prints(I18N[1559]); + prints(gettext[1559]); } static int @@ -219,7 +219,7 @@ static void end_of_game(int quit) { FILE *fp, *fp1; - char *opponent[] = {"", "CD-65", "", I18N[1560], I18N[1561], "", I18N[1562], I18N[1563]}; + char *opponent[] = {"", "CD-65", "", gettext[1560], gettext[1561], "", gettext[1562], gettext[1563]}; move(STARTX - 1, 30); prints(" "); @@ -239,36 +239,36 @@ end_of_game(int quit) fclose(fp); return; } - fprintf(fp, I18N[1564], opponent[think], cuser.userid); + fprintf(fp, gettext[1564], opponent[think], cuser.userid); if (fp) fclose(fp); return; } if (number[0] > number[1]) { - prints(I18N[1565], number[0] - number[1]); + prints(gettext[1565], number[0] - number[1]); if (think == 6 && number[0] - number[1] >= 50) demoney(200); if (think == 7 && number[0] - number[1] >= 40) demoney(200); if (fp) - fprintf(fp, I18N[1566], + fprintf(fp, gettext[1566], opponent[think], cuser.userid, number[0], number[1], number[0] - number[1]); } else if (number[1] > number[0]) { - prints(I18N[1567], number[1] - number[0]); + prints(gettext[1567], number[1] - number[0]); if (fp) { - fprintf(fp, I18N[1568], opponent[think]); + fprintf(fp, gettext[1568], opponent[think]); if (number[1] - number[0] > 20) - fprintf(fp, I18N[1569], number[1], + fprintf(fp, gettext[1569], number[1], number[0], cuser.userid, number[1] - number[0]); else - fprintf(fp, I18N[1570], number[1], + fprintf(fp, gettext[1570], number[1], number[0], cuser.userid, number[1] - number[0]); } } else { - prints(I18N[1571]); + prints(gettext[1571]); if (fp) - fprintf(fp, I18N[1572], + fprintf(fp, gettext[1572], opponent[think], cuser.userid, number[1], number[0]); } if (fp) @@ -347,7 +347,7 @@ player(char color) pass++; if (pass == 1) { move(23, 34); - prints(I18N[1573]); + prints(gettext[1573]); igetch(); move(28, 23); prints(" "); @@ -365,9 +365,9 @@ init() int i, j, i1, j1; CHESS_TYPE[0] = " "; - CHESS_TYPE[1] = I18N[1544]; - CHESS_TYPE[2] = I18N[1543]; - CHESS_TYPE[3] = I18N[1542]; + CHESS_TYPE[1] = gettext[1544]; + CHESS_TYPE[2] = gettext[1543]; + CHESS_TYPE[3] = gettext[1542]; nowx = 4; nowy = 4; @@ -403,7 +403,7 @@ report() move(3, 72); prints(": %02d", number[0]); move(4, 60); - prints(I18N[1574], number[1]); + prints(gettext[1574], number[1]); } static int @@ -482,7 +482,7 @@ Computer(int thinkstep, int table) nowy = maxj; } else { move(23, 30); - prints(I18N[1575]); + prints(gettext[1575]); pass++; if (pass == 2) { move(23, 24); @@ -503,13 +503,13 @@ choose() char thinkstep[2]; move(2, 0); - prints(I18N[1576]); + prints(gettext[1576]); move(5, 0); prints("(1) CD-65\n"); /* 想 1 步 */ - prints(I18N[1577]); /* 想 3 步 */ - prints(I18N[1578]); /* 想 4 步 */ + prints(gettext[1577]); /* 想 3 步 */ + prints(gettext[1578]); /* 想 4 步 */ do { - getdata(4, 0, I18N[1579], + getdata(4, 0, gettext[1579], thinkstep, sizeof(thinkstep), LCECHO); } while (thinkstep[0] < '1' || thinkstep[0] > '3'); clear(); @@ -536,12 +536,12 @@ othello_main() clear(); init(); think = choose(); - showtitle(I18N[1580], BBSName); + showtitle(gettext[1580], BBSName); printboard(); which_table = rand() % NR_TABLE; while (true) { move(STARTX - 1, 30); - prints(I18N[1581]); + prints(gettext[1581]); if (!player(BLACK)) break; report(); @@ -551,7 +551,7 @@ othello_main() break; } move(STARTX - 1, 30); - prints(I18N[1582]); + prints(gettext[1582]); refresh(); if (!Computer(think, which_table)) break; diff --git a/mbbsd/read.c b/mbbsd/read.c index c2c33111..33f6c29c 100644 --- a/mbbsd/read.c +++ b/mbbsd/read.c @@ -342,18 +342,19 @@ select_read(keeploc_t * locmem, int sr_mode) if(sr_mode & RS_AUTHOR) { if(!getdata(b_lines, 0, - currmode & MODE_SELECT ? "增加條件 作者:":"搜尋作者:", + currmode & MODE_SELECT ? gettext[3603]:gettext[3604], keyword, IDLEN+1, LCECHO)) return READ_REDRAW; } else if(sr_mode & RS_KEYWORD) { if(!getdata(b_lines, 0, - currmode & MODE_SELECT ? "增加條件 標題:":"搜尋標題:", + currmode & MODE_SELECT ? gettext[3605]:gettext[3606], keyword, TTLEN, DOECHO)) return READ_REDRAW; #ifdef KEYWORD_LOG - log_file("keyword_search_log", 1, "%s:%s\n", currboard, keyword); + log_file("keyword_search_log", LOG_CREAT | LOG_VF, + "%s:%s\n", currboard, keyword); #endif } else @@ -471,7 +472,7 @@ i_read_key(onekey_t * rcmdlist, keeploc_t * locmem, mode = NEWDIRECT; } else - mode = (currmode & MODE_ETC) ? board_etc() : + mode = (currmode & MODE_DIGEST) ? board_digest() : DOQUIT; break; case Ctrl('L'): @@ -643,7 +644,7 @@ i_read_key(onekey_t * rcmdlist, keeploc_t * locmem, case KEY_RIGHT: ch = 'r'; default: - if( ch == 'h' && currmode & (MODE_ETC | MODE_DIGEST) ) + if( ch == 'h' && currmode & (MODE_DIGEST) ) break; if (ch > 0 && ch <= onekey_size) { int (*func)() = rcmdlist[ch - 1]; diff --git a/mbbsd/record.c b/mbbsd/record.c index 383569c0..ea6d3e7d 100644 --- a/mbbsd/record.c +++ b/mbbsd/record.c @@ -379,7 +379,7 @@ safe_article_delete(int ent, fileheader_t *fhdr, char *direct) { fileheader_t newfhdr; memcpy(&newfhdr, fhdr, sizeof(fileheader_t)); - sprintf(newfhdr.title, I18N[1854]); + sprintf(newfhdr.title, gettext[1854]); strcpy(newfhdr.filename, ".deleted"); strcpy(newfhdr.owner, "-"); substitute_record(direct, &newfhdr, sizeof(newfhdr), ent); @@ -408,7 +408,7 @@ safe_article_delete_range(char *direct, int from, int to) strlcpy(ptr, newfhdr.filename, sizeof(newfhdr.filename)); unlink(fn); - sprintf(newfhdr.title, I18N[1855]); + sprintf(newfhdr.title, gettext[1855]); strcpy(newfhdr.filename, ".deleted"); strcpy(newfhdr.owner, "-"); // because off_t is unsigned, we could NOT seek backward. diff --git a/mbbsd/register.c b/mbbsd/register.c index 8a3c62cb..d39028b2 100644 --- a/mbbsd/register.c +++ b/mbbsd/register.c @@ -159,7 +159,7 @@ getnewuserid() close(fd); log_usies("CLEAN", "dated users"); - fprintf(stdout, I18N[1856]); + fprintf(stdout, gettext[1856]); if ((fd = open(fn_passwd, O_RDWR | O_CREAT, 0600)) == -1) return -1; @@ -175,8 +175,7 @@ getnewuserid() i = searchnewuser(1); if ((i <= 0) || (i > MAX_USERS)) { passwd_unlock(); - vmsg(I18N[1857]); - safe_sleep(2); + vmsg(gettext[1857]); exit(1); } snprintf(genbuf, sizeof(genbuf), "uid %d", i); @@ -197,15 +196,15 @@ new_register() #ifdef HAVE_USERAGREEMENT more(HAVE_USERAGREEMENT, YEA); while( 1 ){ - getdata(b_lines - 1, 0, I18N[1858], + getdata(b_lines - 1, 0, gettext[1858], passbuf, 4, LCECHO); if( passbuf[0] == 'y' ) break; if( passbuf[0] == 'n' ){ - vmsg(I18N[1859]); + vmsg(gettext[1859]); exit(1); } - vmsg(I18N[1860]); + vmsg(gettext[1860]); } #endif memset(&newuser, 0, sizeof(newuser)); @@ -213,20 +212,20 @@ new_register() try = 0; while (1) { if (++try >= 6) { - vmsg(I18N[1861]); + vmsg(gettext[1861]); exit(1); } getdata(17, 0, msg_uid, newuser.userid, sizeof(newuser.userid), DOECHO); if (bad_user_id(newuser.userid)) - outs(I18N[1862]); + outs(gettext[1862]); else if ((id = getuser(newuser.userid)) && (id = check_and_expire_account(id, &xuser)) >= 0) { if (id == 999999) - outs(I18N[1863]); + outs(gettext[1863]); else { - prints(I18N[1864], id / (60 * 24)); + prints(gettext[1864], id / (60 * 24)); } } else break; @@ -235,19 +234,19 @@ new_register() try = 0; while (1) { if (++try >= 6) { - vmsg(I18N[1865]); + vmsg(gettext[1865]); exit(1); } - if ((getdata(19, 0, I18N[1866], passbuf, + if ((getdata(19, 0, gettext[1866], passbuf, sizeof(passbuf), NOECHO) < 3) || !strcmp(passbuf, newuser.userid)) { - outs(I18N[1867]); + outs(gettext[1867]); continue; } strncpy(newuser.passwd, passbuf, PASSLEN); - getdata(20, 0, I18N[1868], passbuf, sizeof(passbuf), NOECHO); + getdata(20, 0, gettext[1868], passbuf, sizeof(passbuf), NOECHO); if (strncmp(passbuf, newuser.passwd, PASSLEN)) { - outs(I18N[1869]); + outs(gettext[1869]); continue; } passbuf[8] = '\0'; @@ -262,18 +261,18 @@ new_register() newuser.pager = 1; allocid = getnewuserid(); if (allocid > MAX_USERS || allocid <= 0) { - fprintf(stderr, I18N[1870]); + fprintf(stderr, gettext[1870]); exit(1); } if (passwd_update(allocid, &newuser) == -1) { - fprintf(stderr, I18N[1871]); + fprintf(stderr, gettext[1871]); exit(1); } setuserid(allocid, newuser.userid); if( (uid = initcuser(newuser.userid)) ) setumoney(uid, 0); else{ - fprintf(stderr, I18N[1872]); + fprintf(stderr, gettext[1872]); exit(1); } } @@ -294,10 +293,10 @@ check_register() if (currutmp->mailalert) m_read(); - stand_title(I18N[1873]); + stand_title(gettext[1873]); while (strlen(cuser.username) < 2) - getdata(2, 0, I18N[1874], cuser.username, + getdata(2, 0, gettext[1874], cuser.username, sizeof(cuser.username), DOECHO); for (ptr = cuser.username; *ptr; ptr++) { @@ -305,11 +304,11 @@ check_register() *ptr = ' '; } while (strlen(cuser.realname) < 4) - getdata(4, 0, I18N[1875], cuser.realname, + getdata(4, 0, gettext[1875], cuser.realname, sizeof(cuser.realname), DOECHO); while (strlen(cuser.address) < 8) - getdata(6, 0, I18N[1876], cuser.address, + getdata(6, 0, gettext[1876], cuser.address, sizeof(cuser.address), DOECHO); @@ -329,7 +328,7 @@ check_register() /* 回覆過身份認證信函,或曾經 E-mail post 過 */ clear(); move(9, 3); - prints(I18N[1877]); + prints(gettext[1877]); u_register(); #ifdef NEWUSER_LIMIT diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c index 98b8fa8b..820fe131 100644 --- a/mbbsd/stuff.c +++ b/mbbsd/stuff.c @@ -64,7 +64,6 @@ void setbdir(char *buf, char *boardname) { sprintf(buf, str_board_file, boardname[0], boardname, - currmode & MODE_ETC ? ".ETC" : (currmode & MODE_DIGEST ? fn_mandex : str_dotdir)); } @@ -331,19 +330,19 @@ gettime(int line, time_t dt, char*head) move(line, 0); prints("%s",head); i=strlen(head); do { - getdata_buf(line, i, I18N[1878], yn, 5, LCECHO); + getdata_buf(line, i, gettext[1878], yn, 5, LCECHO); } while ((endtime.tm_year = atoi(yn) - 1900) < 0 || endtime.tm_year > 200); snprintf(yn, sizeof(yn), "%d", ptime->tm_mon + 1); do { - getdata_buf(line, i+15, I18N[1879], yn, 3, LCECHO); + getdata_buf(line, i+15, gettext[1879], yn, 3, LCECHO); } while ((endtime.tm_mon = atoi(yn) - 1) < 0 || endtime.tm_mon > 11); snprintf(yn, sizeof(yn), "%d", ptime->tm_mday); do { - getdata_buf(line, i+24, I18N[1880], yn, 3, LCECHO); + getdata_buf(line, i+24, gettext[1880], yn, 3, LCECHO); } while ((endtime.tm_mday = atoi(yn)) < 1 || endtime.tm_mday > 31); snprintf(yn, sizeof(yn), "%d", ptime->tm_hour); do { - getdata_buf(line, i+33, I18N[1881], yn, 3, LCECHO); + getdata_buf(line, i+33, gettext[1881], yn, 3, LCECHO); } while ((endtime.tm_hour = atoi(yn)) < 0 || endtime.tm_hour > 23); return mktime(&endtime); } @@ -388,7 +387,7 @@ capture_screen() FILE *fp; int i; - getdata(b_lines - 2, 0, I18N[1882], + getdata(b_lines - 2, 0, gettext[1882], fname, 4, LCECHO); if (fname[0] != 'y') return; @@ -412,7 +411,7 @@ vmsg_lines(const int lines, const char msg[]) if (msg) outs((char *)msg); else - outs(I18N[1883]); + outs(gettext[1883]); do { if( (ch = igetch()) == Ctrl('T') ) capture_screen(); @@ -479,7 +478,7 @@ search_num(int ch, int max) int x, y; char genbuf[10]; - outmsg(I18N[1886]); + outmsg(gettext[1886]); outc(ch); genbuf[0] = ch; getyx(&y, &x); @@ -528,7 +527,7 @@ void stand_title(char *title) { clear(); - prints(I18N[1887], title); + prints(gettext[1887], title); } void @@ -592,22 +591,29 @@ log_user(const char *fmt, ...) va_end(ap); sethomefile(filename, cuser.userid, "USERLOG"); - return log_file(filename, 1, "%s: %s %s", cuser.userid, msg, Cdate(&now)); + return log_file(filename, LOG_CREAT | LOG_VF, + "%s: %s %s", cuser.userid, msg, Cdate(&now)); } -int log_file(char *fn, int ifcreate, const char *fmt,...) +int log_file(char *fn, int flag, const char *fmt,...) { int fd; - char msg[256]; - va_list ap; - va_start(ap, fmt); - vsnprintf(msg , 128, fmt, ap); - va_end(ap); + char msg[256], *realmsg; + if( !(flag & LOG_VF) ){ + realmsg = (char *)fmt; + } + else{ + va_list ap; + va_start(ap, fmt); + vsnprintf(msg , 128, fmt, ap); + va_end(ap); + realmsg = msg; + } - if( (fd = open(fn, O_APPEND | O_WRONLY | (ifcreate ? O_CREAT : 0), - (ifcreate ? 0664 : 0))) < 0 ) + if( (fd = open(fn, O_APPEND | O_WRONLY | ((flag & LOG_CREAT)? O_CREAT : 0), + ((flag & LOG_CREAT) ? 0664 : 0))) < 0 ) return -1; - if( write(fd, msg, strlen(msg)) < 0 ){ + if( write(fd, realmsg, strlen(realmsg)) < 0 ){ close(fd); return -1; } @@ -622,11 +628,11 @@ show_help(int *index) clear(); while (*index > 0 && *index < MAX_STRING) { - str = I18N[*index]; + str = gettext[*index]; if (*str == '\0') - prints(I18N[1888], str + 1); + prints(gettext[1888], str + 1); else if (*str == '\01') - prints(I18N[1889], str + 1); + prints(gettext[1889], str + 1); else prints(" %s\n", str); index++; diff --git a/mbbsd/syspost.c b/mbbsd/syspost.c index f6b30551..0e9a7a02 100644 --- a/mbbsd/syspost.c +++ b/mbbsd/syspost.c @@ -17,8 +17,8 @@ post_msg(char *bname, char *title, char *msg, char *author) if (!fp) return -1; - fprintf(fp, I18N[2551], author, bname, title); - fprintf(fp, I18N[2552], ctime(&now)); + fprintf(fp, gettext[2551], author, bname, title); + fprintf(fp, gettext[2552], ctime(&now)); /* 文章的內容 */ fprintf(fp, "%s", msg); @@ -67,13 +67,13 @@ post_change_perm(int oldperm, int newperm, char *sysopid, char *userid) if (!(fp = fopen(genbuf, "w"))) return; - fprintf(fp, I18N[2553], ctime(&now)); + fprintf(fp, gettext[2553], ctime(&now)); for (i = 5; i < NUMPERMS; i++) { if (((oldperm >> i) & 1) != ((newperm >> i) & 1)) { - fprintf(fp, I18N[2554], + fprintf(fp, gettext[2554], sysopid, - (((oldperm >> i) & 1) ? I18N[2555] : I18N[2556]), - userid, I18N[str_permid[i]]); + (((oldperm >> i) & 1) ? gettext[2555] : gettext[2556]), + userid, gettext[str_permid[i]]); flag++; } } @@ -81,16 +81,16 @@ post_change_perm(int oldperm, int newperm, char *sysopid, char *userid) if (flag) { clrtobot(); clear(); - while (!getdata_str(5, 0, I18N[2557], - reason, sizeof(reason), DOECHO, I18N[2558])); - fprintf(fp, I18N[2559], + while (!getdata_str(5, 0, gettext[2557], + reason, sizeof(reason), DOECHO, gettext[2558])); + fprintf(fp, gettext[2559], cuser.userid, reason); fclose(fp); snprintf(fhdr.title, sizeof(fhdr.title), - I18N[2560], + gettext[2560], cuser.userid, userid); - strlcpy(fhdr.owner, I18N[2561], sizeof(fhdr.owner)); + strlcpy(fhdr.owner, gettext[2561], sizeof(fhdr.owner)); append_record("boards/S/Security/.DIR", &fhdr, sizeof(fhdr)); } else fclose(fp); @@ -124,12 +124,12 @@ post_violatelaw(char *crime, char *police, char *reason, char *result) stampfile(genbuf, &fhdr); if (!(fp = fopen(genbuf, "w"))) return; - fprintf(fp, I18N[2562], + fprintf(fp, gettext[2562], crime, ctime(&now), police, crime, reason, result); fclose(fp); snprintf(fhdr.title, sizeof(fhdr.title), - I18N[2563], crime); - strlcpy(fhdr.owner, I18N[2564], sizeof(fhdr.owner)); + gettext[2563], crime); + strlcpy(fhdr.owner, gettext[2564], sizeof(fhdr.owner)); append_record("boards/V/ViolateLaw/.DIR", &fhdr, sizeof(fhdr)); @@ -139,11 +139,11 @@ void post_newboard(char *bgroup, char *bname, char *bms) { char genbuf[256], title[128]; - snprintf(title, sizeof(title), I18N[2565], bname); + snprintf(title, sizeof(title), gettext[2565], bname); snprintf(genbuf, sizeof(genbuf), - I18N[2566], + gettext[2566], cuser.userid, bname, bgroup, bms); - post_msg("Record", title, genbuf, I18N[2567]); + post_msg("Record", title, genbuf, gettext[2567]); } void @@ -158,15 +158,15 @@ give_money_post(char *userid, int money) stampfile(genbuf, &fhdr); if (!(fp = fopen(genbuf, "w"))) return; - fprintf(fp, I18N[2568], cuser.userid, ctime(&now)); + fprintf(fp, gettext[2568], cuser.userid, ctime(&now)); clrtobot(); clear(); - fprintf(fp, I18N[2569], + fprintf(fp, gettext[2569], cuser.userid, userid, money); fclose(fp); - snprintf(fhdr.title, sizeof(fhdr.title), I18N[2570], + snprintf(fhdr.title, sizeof(fhdr.title), gettext[2570], cuser.userid); - strlcpy(fhdr.owner, I18N[2571], sizeof(fhdr.owner)); + strlcpy(fhdr.owner, gettext[2571], sizeof(fhdr.owner)); append_record("boards/S/Security/.DIR", &fhdr, sizeof(fhdr)); } diff --git a/mbbsd/talk.c b/mbbsd/talk.c index 30ac4246..f3b14e26 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -3,10 +3,10 @@ #define QCAST int (*)(const void *, const void *) -//#define sig_des [(a)] (I18N[1896 + (a)]) -#define sig_des(a) (I18N[1896 + (a)]) +//#define sig_des [(a)] (gettext[1896 + (a)]) +#define sig_des(a) (gettext[1896 + (a)]) /*static char *sig_des[] = { - I18N[1896], I18N[1897], "", I18N[1898], I18N[1899], I18N[1900] + gettext[1896], gettext[1897], "", gettext[1898], gettext[1899], gettext[1900] };*/ #define MAX_SHOW_MODE 4 @@ -57,7 +57,7 @@ iswritable_stat(userinfo_t * uentp, int fri_stat) int isvisible_stat(userinfo_t * me, userinfo_t * uentp, int fri_stat) { - if (uentp->userid[0] == 0) + if (!uentp || uentp->userid[0] == 0) return 0; if (PERM_HIDE(uentp) && !(PERM_HIDE(me))) /* 對方紫色隱形而你沒有 */ @@ -77,7 +77,7 @@ char * modestring(userinfo_t * uentp, int simple) { static char modestr[40]; - char *notonline = I18N[1901]; + char *notonline = gettext[1901]; register int mode = uentp->mode; register char *word; int fri_stat; @@ -85,9 +85,9 @@ modestring(userinfo_t * uentp, int simple) /* for debugging */ if (mode >= MAX_MODES) { syslog(LOG_WARNING, "what!? mode = %d", mode); - word = I18N[ModeTypeTable[mode % MAX_MODES]]; + word = gettext[ModeTypeTable[mode % MAX_MODES]]; } else - word = I18N[ModeTypeTable[mode]]; + word = gettext[ModeTypeTable[mode]]; fri_stat = friend_stat(currutmp, uentp); if (!(HAS_PERM(PERM_SYSOP) || HAS_PERM(PERM_SEECLOAK)) && ((uentp->invisible || (fri_stat & HRM)) && @@ -95,18 +95,18 @@ modestring(userinfo_t * uentp, int simple) return notonline; else if (mode == EDITING) { snprintf(modestr, sizeof(modestr), "E:%s", - I18N[ModeTypeTable[uentp->destuid < EDITING ? uentp->destuid : + gettext[ModeTypeTable[uentp->destuid < EDITING ? uentp->destuid : EDITING]]); word = modestr; } else if (!mode && *uentp->chatid == 1) { if (!simple) snprintf(modestr, sizeof(modestr), - I18N[1902], getuserid(uentp->destuid)); + gettext[1902], getuserid(uentp->destuid)); else - snprintf(modestr, sizeof(modestr), I18N[1903]); + snprintf(modestr, sizeof(modestr), gettext[1903]); } else if (!mode && *uentp->chatid == 3) - snprintf(modestr, sizeof(modestr), I18N[1904]); + snprintf(modestr, sizeof(modestr), gettext[1904]); else if ( #ifdef NOKILLWATERBALL uentp->msgcount > 0 @@ -116,15 +116,15 @@ modestring(userinfo_t * uentp, int simple) ) if (uentp->msgcount < 10) { char *cnum[10] = - {"", I18N[1905], I18N[1906], I18N[1907], I18N[1908], I18N[1909], I18N[1910], I18N[1911], - I18N[1912], I18N[1913]}; + {"", gettext[1905], gettext[1906], gettext[1907], gettext[1908], gettext[1909], gettext[1910], gettext[1911], + gettext[1912], gettext[1913]}; snprintf(modestr, sizeof(modestr), - I18N[1914], cnum[(int)(uentp->msgcount)]); + gettext[1914], cnum[(int)(uentp->msgcount)]); } else - snprintf(modestr, sizeof(modestr), I18N[1915]); + snprintf(modestr, sizeof(modestr), gettext[1915]); else if (!mode) return (uentp->destuid == 6) ? uentp->chatid : - I18N[1890 + ((0 <= uentp->destuid && uentp->destuid < 6) ? + gettext[1890 + ((0 <= uentp->destuid && uentp->destuid < 6) ? uentp->destuid : 0)]; else if (simple) return word; @@ -132,24 +132,24 @@ modestring(userinfo_t * uentp, int simple) snprintf(modestr, sizeof(modestr), "%s (%s)", word, uentp->chatid); else if (mode == TALK) { if (!isvisible_uid(uentp->destuid)) /* Leeym 對方(紫色)隱形 */ - snprintf(modestr, sizeof(modestr), "%s", I18N[1916]); + snprintf(modestr, sizeof(modestr), "%s", gettext[1916]); /* Leeym * 大家自己發揮吧! */ else snprintf(modestr, sizeof(modestr), "%s %s", word, getuserid(uentp->destuid)); } else if (mode == M_FIVE) { if (!isvisible_uid(uentp->destuid)) - snprintf(modestr, sizeof(modestr), "%s", I18N[1917]); + snprintf(modestr, sizeof(modestr), "%s", gettext[1917]); else snprintf(modestr, sizeof(modestr), "%s %s", word, getuserid(uentp->destuid)); } else if (mode == CHESSWATCHING) { - snprintf(modestr, sizeof(modestr), I18N[1918]); + snprintf(modestr, sizeof(modestr), gettext[1918]); } else if (mode == CHC) { if (isvisible_uid(uentp->destuid)) - snprintf(modestr, sizeof(modestr), "%s", I18N[1919]); + snprintf(modestr, sizeof(modestr), "%s", gettext[1919]); else snprintf(modestr, sizeof(modestr), - I18N[1920], getuserid(uentp->destuid)); + gettext[1920], getuserid(uentp->destuid)); } else if (mode != PAGE && mode != TQUERY) return word; else @@ -322,7 +322,7 @@ my_kick(userinfo_t * uentp) log_usies("KICK ", genbuf); if ((uentp->pid <= 0 || kill(uentp->pid, SIGHUP) == -1) && (errno == ESRCH)) purge_utmp(uentp); - outs(I18N[1921]); + outs(gettext[1921]); } else outs(msg_cancel); pressanykey(); @@ -336,12 +336,12 @@ chicken_query(char *userid) time_diff(&(xuser.mychicken)); if (!isdeadth(&(xuser.mychicken))) { show_chicken_data(&(xuser.mychicken), NULL); - prints(I18N[1922], userid); + prints(gettext[1922], userid); } } else { move(1, 0); clrtobot(); - prints(I18N[1923], userid); + prints(gettext[1923], userid); } pressanykey(); } @@ -355,8 +355,8 @@ my_query(char *uident) unsigned long int j; userinfo_t *uentp; const char *money[10] = - {I18N[1924], I18N[1925], I18N[1926], I18N[1927], I18N[1928], - I18N[1929], I18N[1930], I18N[1931], I18N[1932], I18N[1933]}; + {gettext[1924], gettext[1925], gettext[1926], gettext[1927], gettext[1928], + gettext[1929], gettext[1930], gettext[1931], gettext[1932], gettext[1933]}; const char *sex[8] = {MSG_BIG_BOY, MSG_BIG_GIRL, MSG_LITTLE_BOY, MSG_LITTLE_GIRL, @@ -376,7 +376,7 @@ my_query(char *uident) j = muser.money; for (i = 0; i < 10 && j > 10; i++) j /= 10; - prints(I18N[1934], + prints(gettext[1934], muser.userid, muser.username, 26 - strlen(muser.userid) - strlen(muser.username), "", @@ -385,33 +385,33 @@ my_query(char *uident) prints(" ($%d)", muser.money); prints("\n"); - prints(I18N[1935], muser.numlogins); + prints(gettext[1935], muser.numlogins); move(2, 40); #ifdef ASSESS - prints(I18N[1936], muser.numposts, muser.goodpost, muser.badpost); + prints(gettext[1936], muser.numposts, muser.goodpost, muser.badpost); #else - prints(I18N[1937], muser.numposts); + prints(gettext[1937], muser.numposts); #endif - prints(I18N[1938], + prints(gettext[1938], (uentp && isvisible_stat(currutmp, uentp, fri_stat)) ? - modestring(uentp, 0) : I18N[1939]); + modestring(uentp, 0) : gettext[1939]); outs(((uentp && uentp->mailalert) || load_mailalert(muser.userid)) - ? I18N[1940] : - I18N[1941]); - prints(I18N[1942], + ? gettext[1940] : + gettext[1941]); + prints(gettext[1942], Cdate(&muser.lastlogin), - (muser.lasthost[0] ? muser.lasthost : I18N[1943])); - prints(I18N[1944], + (muser.lasthost[0] ? muser.lasthost : gettext[1943])); + prints(gettext[1944], muser.five_win, muser.five_lose, muser.five_tie, muser.chc_win, muser.chc_lose, muser.chc_tie); #ifdef ASSESS - prints(I18N[1945], muser.goodsale, muser.badsale); + prints(gettext[1945], muser.goodsale, muser.badsale); move(6, 40); #endif if ((uentp && ((fri_stat & HFM) || strcmp(muser.userid,cuser.userid) == 0) && !uentp->invisible)) - prints(I18N[1946], sex[muser.sex % 8]); + prints(gettext[1946], sex[muser.sex % 8]); showplans(uident); pressanykey(); @@ -439,11 +439,11 @@ water_scr(water_t * tw, int which, char type) prints(" "); move(16 + i, 4); if (tw->msg[(tw->top - i + 4) % 5].last_call_in[0] != 0) - prints(I18N[1947], + prints(gettext[1947], colors[i], tw->msg[(tw->top - i + 4) % 5].last_call_in); else - prints(I18N[1948]); + prints(gettext[1948]); } move(21, 4); @@ -455,14 +455,14 @@ water_scr(water_t * tw, int which, char type) move(0, 0); prints(" "); move(0, 0); - prints(I18N[1949], tw->userid); + prints(gettext[1949], tw->userid); clrtoeol(); move(0, strlen(tw->userid) + 6); } else { move(8 + which, 28); prints("123456789012345678901234567890"); move(8 + which, 28); - prints(I18N[1950], + prints(gettext[1950], tw->uin ? ' ' : 'x', tw->userid); } @@ -488,7 +488,7 @@ my_write2(void) //init screen move(7, 28); - prints(I18N[1951]); + prints(gettext[1951]); for (i = 0; i < 5; ++i) if (swater[i] == NULL || swater[i]->pid == 0) break; @@ -500,9 +500,9 @@ my_write2(void) water_scr(swater[i], i, 0); } move(15, 4); - prints(I18N[1952]); + prints(gettext[1952]); move(22, 4); - prints(I18N[1953]); + prints(gettext[1953]); water_scr(swater[0], 0, 1); refresh(); @@ -547,7 +547,7 @@ my_write2(void) move(0, 0); prints("\033[m"); clrtoeol(); - snprintf(genbuf, sizeof(genbuf), I18N[1954], tw->userid); + snprintf(genbuf, sizeof(genbuf), gettext[1954], tw->userid); if (!oldgetdata(0, 0, genbuf, msg, 80 - strlen(tw->userid) - 6, DOECHO)) break; @@ -588,7 +588,7 @@ my_write(pid_t pid, char *prompt, char *id, int flag, userinfo_t * puin) strlcpy(destid, id, sizeof(destid)); if (!uin && !(flag == 0 && water_which->count > 0)) { - vmsg(I18N[1955]); + vmsg(gettext[1955]); watermode = -1; return 0; } @@ -602,9 +602,6 @@ my_write(pid_t pid, char *prompt, char *id, int flag, userinfo_t * puin) /* 一般水球 */ watermode = 0; if (!(len = getdata(0, 0, prompt, msg, 56, DOECHO))) { - outmsg(I18N[1956]); - clrtoeol(); - refresh(); currutmp->chatid[0] = c0; currutmp->mode = mode0; currstat = currstat0; @@ -626,7 +623,7 @@ my_write(pid_t pid, char *prompt, char *id, int flag, userinfo_t * puin) strip_ansi(msg, msg, STRIP_ALL); if (uin && *uin->userid && (flag == 0 || flag == 4)) { - snprintf(buf, sizeof(buf), I18N[1957], uin->userid, msg); + snprintf(buf, sizeof(buf), gettext[1957], uin->userid, msg); getdata(0, 0, buf, genbuf, 3, LCECHO); if (genbuf[0] == 'n') { currutmp->chatid[0] = c0; @@ -638,7 +635,7 @@ my_write(pid_t pid, char *prompt, char *id, int flag, userinfo_t * puin) } watermode = -1; if (!uin || !*uin->userid || strcasecmp(destid, uin->userid)) { - vmsg(I18N[1959]); + vmsg(gettext[1959]); currutmp->chatid[0] = c0; currutmp->mode = mode0; currstat = currstat0; @@ -669,7 +666,7 @@ my_write(pid_t pid, char *prompt, char *id, int flag, userinfo_t * puin) uin->pager == 2 || (uin->pager == 4 && !(fri_stat & HFM)))) - outmsg(I18N[1960]); + outmsg(gettext[1960]); else { int write_pos = uin->msgcount; /* try to avoid race */ if ( write_pos < (MAX_MSGS - 1) ) { /* race here */ @@ -684,7 +681,7 @@ my_write(pid_t pid, char *prompt, char *id, int flag, userinfo_t * puin) sizeof(uin->msgs[write_pos].last_call_in)); uin->pager = pager0; } else if (flag != 2) - outmsg(I18N[1961]); + outmsg(gettext[1961]); if (uin->msgcount >= 1 && #ifdef NOKILLWATERBALL @@ -693,11 +690,11 @@ my_write(pid_t pid, char *prompt, char *id, int flag, userinfo_t * puin) (uin->pid <= 0 || kill(uin->pid, SIGUSR2) == -1) #endif && flag != 2) - outmsg(I18N[1962]); + outmsg(gettext[1962]); else if (uin->msgcount == 1 && flag != 2) - outmsg(I18N[1963]); + outmsg(gettext[1963]); else if (uin->msgcount > 1 && uin->msgcount < MAX_MSGS && flag != 2) - outmsg(I18N[1964]); + outmsg(gettext[1964]); } clrtoeol(); @@ -738,10 +735,10 @@ t_display_new(void) if (water[0].count && watermode > 0) { move(1, 0); - outs(I18N[1965]); + outs(gettext[1965]); outs(WATERMODE(WATER_ORIG) ? - I18N[1966] : - I18N[1967]); + gettext[1966] : + gettext[1967]); if (WATERMODE(WATER_NEW)) { move(2, 0); clrtoeol(); @@ -762,7 +759,7 @@ t_display_new(void) } else prints(" "); else - prints(I18N[1968], + prints(gettext[1968], water_which == &water[0] ? "\033[1;33;47m " : " " ); @@ -795,7 +792,7 @@ t_display_new(void) i++; } move(i + off, 0); - outs(I18N[1969]); + outs(gettext[1969]); if (WATERMODE(WATER_NEW)) while (i++ <= water[0].count) { move(i + off, 0); @@ -816,8 +813,8 @@ t_display(void) setuserfile(genbuf, fn_writelog); if (more(genbuf, YEA) != -1) { move(b_lines - 4, 0); - outs(I18N[1970]); - getdata(b_lines - 1, 0, I18N[1971], + outs(gettext[1970]); + getdata(b_lines - 1, 0, gettext[1971], ans, sizeof(ans), LCECHO); if (*ans == 'm') { fileheader_t mymail; @@ -827,8 +824,8 @@ t_display(void) stampfile(buf, &mymail); mymail.filemode = FILE_READ ; - strlcpy(mymail.owner, I18N[1972], sizeof(mymail.owner)); - strlcpy(mymail.title, I18N[1973], sizeof(mymail.title)); + strlcpy(mymail.owner, gettext[1972], sizeof(mymail.owner)); + strlcpy(mymail.title, gettext[1973], sizeof(mymail.title)); sethomedir(title, cuser.userid); Rename(genbuf, buf); append_record(title, &mymail, sizeof(mymail)); @@ -1008,7 +1005,7 @@ do_talk(int fd) setutmpmode(TALK); ch = 58 - strlen(save_page_requestor); - snprintf(genbuf, sizeof(genbuf), I18N[1974], cuser.userid, cuser.username); + snprintf(genbuf, sizeof(genbuf), gettext[1974], cuser.userid, cuser.username); i = ch - strlen(genbuf); if (i >= 0) i = (i >> 1) + 1; @@ -1020,7 +1017,7 @@ do_talk(int fd) data[i] = '\0'; snprintf(mid_line, sizeof(mid_line), - I18N[1975], data, genbuf, save_page_requestor, data); + gettext[1975], data, genbuf, save_page_requestor, data); memset(&mywin, 0, sizeof(mywin)); memset(&itswin, 0, sizeof(itswin)); @@ -1051,7 +1048,7 @@ do_talk(int fd) break; move(b_lines, 0); clrtoeol(); - outs(I18N[1976]); + outs(gettext[1976]); im_leaving = 1; continue; } @@ -1092,13 +1089,13 @@ do_talk(int fd) char ans[4]; int i; - fprintf(flog, I18N[1977], + fprintf(flog, gettext[1977], Cdatelite(&now)); for (i = 0; i < scr_lns; i++) fprintf(flog, "%.*s\n", big_picture[i].len, big_picture[i].data); fclose(flog); more(fpath, NA); - getdata(b_lines - 1, 0, I18N[1978], + getdata(b_lines - 1, 0, gettext[1978], ans, sizeof(ans), LCECHO); if (*ans == 'm') { fileheader_t mymail; @@ -1107,9 +1104,9 @@ do_talk(int fd) sethomepath(genbuf, cuser.userid); stampfile(genbuf, &mymail); mymail.filemode = FILE_READ ; - strlcpy(mymail.owner, I18N[1979], sizeof(mymail.owner)); + strlcpy(mymail.owner, gettext[1979], sizeof(mymail.owner)); snprintf(mymail.title, sizeof(mymail.title), - I18N[1980], + gettext[1980], getuserid(currutmp->destuid)); sethomedir(title, cuser.userid); Rename(fpath, genbuf); @@ -1158,7 +1155,7 @@ int make_connection_to_somebody(userinfo_t *uin, int timeout){ if (pid > 0) kill(pid, SIGUSR1); clear(); - prints(I18N[1981], uin->userid); + prints(gettext[1981], uin->userid); listen(sock, 1); add_io(sock, timeout); @@ -1170,7 +1167,7 @@ int make_connection_to_somebody(userinfo_t *uin, int timeout){ if (!ch && uin->chatid[0] == 1 && uin->destuip == currutmp - &SHM->uinfo[0]) { bell(); - outmsg(I18N[1982]); + outmsg(gettext[1982]); refresh(); } else if (ch == EDITING || ch == TALK || ch == CHATING || ch == PAGE || ch == MAILALL || ch == MONITOR || @@ -1180,7 +1177,7 @@ int make_connection_to_somebody(userinfo_t *uin, int timeout){ add_io(0, 0); close(sock); currutmp->sockactive = currutmp->destuid = 0; - vmsg(I18N[1983]); + vmsg(gettext[1983]); unlockutmpmode(); return -1; } else { @@ -1188,7 +1185,7 @@ int make_connection_to_somebody(userinfo_t *uin, int timeout){ add_io(sock, 20); /* added for linux... achen */ #endif move(0, 0); - outs(I18N[1984]); + outs(gettext[1984]); bell(); uin->destuip = currutmp - &SHM->uinfo[0]; @@ -1239,30 +1236,30 @@ my_talk(userinfo_t * uin, int fri_stat, char defact) kill(uin->pid, SIGUSR1); sock = make_connection_to_somebody(uin, 20); if (sock < 0) - vmsg(I18N[1985]); + vmsg(gettext[1985]); else { strlcpy(currutmp->mateid, uin->userid, sizeof(currutmp->mateid)); chc(sock, CHC_WATCH); } } else - outs(I18N[1986]); + outs(gettext[1986]); } else if (!HAS_PERM(PERM_SYSOP) && (((fri_stat & HRM) && !(fri_stat & HFM)) || ((!uin->pager) && !(fri_stat & HFM)))) { - outs(I18N[1987]); + outs(gettext[1987]); } else if (!HAS_PERM(PERM_SYSOP) && (((fri_stat & HRM) && !(fri_stat & HFM)) || uin->pager == 2)) { - outs(I18N[1988]); + outs(gettext[1988]); } else if (!HAS_PERM(PERM_SYSOP) && !(fri_stat & HFM) && uin->pager == 4) { - outs(I18N[1989]); + outs(gettext[1989]); } else if (!(pid = uin->pid) /* || (kill(pid, 0) == -1) */ ) { //resetutmpent(); outs(msg_usr_left); } else { showplans(uin->userid); - getdata(2, 0, I18N[1990], genbuf, 4, LCECHO); + getdata(2, 0, gettext[1990], genbuf, 4, LCECHO); switch (*genbuf) { case 'y': case 't': @@ -1287,8 +1284,8 @@ my_talk(userinfo_t * uin, int fri_stat, char defact) if (!cuser.mychicken.name[0] || !xuser.mychicken.name[0]) error = 2; if (error) { - vmsg(error == 2 ? I18N[1991] : - I18N[1992]); + vmsg(error == 2 ? gettext[1991] : + gettext[1992]); return; } uin->sig = SIG_PK; @@ -1338,41 +1335,41 @@ my_talk(userinfo_t * uin, int fri_stat, char defact) } } else { move(9, 9); - outs(I18N[1993]); + outs(gettext[1993]); switch (c) { case 'a': - outs(I18N[1994]); + outs(gettext[1994]); break; case 'b': - prints(I18N[1995], sig_des(uin->sig)); + prints(gettext[1995], sig_des(uin->sig)); break; case 'd': - outs(I18N[1996]); + outs(gettext[1996]); break; case 'c': - outs(I18N[1997]); + outs(gettext[1997]); break; case 'e': - outs(I18N[1998]); + outs(gettext[1998]); break; case 'f': { char msgbuf[60]; read(msgsock, msgbuf, 60); - prints(I18N[1999], sig_des(uin->sig)); + prints(gettext[1999], sig_des(uin->sig)); move(10, 18); outs(msgbuf); } break; case '1': - prints(I18N[2000], sig_des(uin->sig)); + prints(gettext[2000], sig_des(uin->sig)); break; case '2': - prints(I18N[2001], sig_des(uin->sig)); + prints(gettext[2001], sig_des(uin->sig)); break; default: - prints(I18N[2002], sig_des(uin->sig)); + prints(gettext[2002], sig_des(uin->sig)); } close(msgsock); } @@ -1394,17 +1391,17 @@ t_showhelp() { clear(); - outs(I18N[2003]); + outs(gettext[2003]); if (HAS_PERM(PERM_PAGE)) { - outs(I18N[2004]); + outs(gettext[2004]); } if (HAS_PERM(PERM_SYSOP)) { - outs(I18N[2005]); - outs(I18N[2006]); - outs(I18N[2007]); + outs(gettext[2005]); + outs(gettext[2006]); + outs(gettext[2007]); #if defined(SHOWBOARD) && defined(DEBUG) - outs(I18N[2008]); + outs(gettext[2008]); #endif } pressanykey(); @@ -1693,10 +1690,10 @@ draw_pickup(int drawall, pickup_t * pickup, int pickup_way, int show_pid, int myfriend, int friendme, int bfriend, int badfriend) { char *msg_pickup_way[PICKUP_WAYS] = { - I18N[2009], I18N[2010], I18N[2011], I18N[2012], I18N[2013], I18N[2014], I18N[2015] + gettext[2009], gettext[2010], gettext[2011], gettext[2012], gettext[2013], gettext[2014], gettext[2015] }; char *MODE_STRING[MAX_SHOW_MODE] = { - I18N[2016], I18N[2017], I18N[2018], I18N[2019] + gettext[2016], gettext[2017], gettext[2018], gettext[2019] }; char pagerchar[5] = "* -Wf"; @@ -1709,24 +1706,23 @@ draw_pickup(int drawall, pickup_t * pickup, int pickup_way, #endif if (drawall) { - showtitle((cuser.uflag & FRIEND_FLAG) ? I18N[2020] : I18N[2021], + showtitle((cuser.uflag & FRIEND_FLAG) ? gettext[2020] : gettext[2021], BBSName); - prints(I18N[2022], + prints(gettext[2022], show_uid ? "UID" : "No.", (HAS_PERM(PERM_SEECLOAK) || HAS_PERM(PERM_SYSOP)) ? 'C' : ' ', - I18N[2023], + gettext[2023], MODE_STRING[show_mode], - show_board ? "Board" : I18N[2024], - show_pid ? " PID" : I18N[2025] + show_board ? "Board" : gettext[2024], + show_pid ? " PID" : gettext[2025] ); move(b_lines, 0); - outs(I18N[2026]); + outs(gettext[2026]); } move(1, 0); - prints(I18N[2027], + prints(gettext[2027], msg_pickup_way[pickup_way], SHM->UTMPnumber, myfriend, friendme, currutmp->brc_id ? (bfriend + 1) : 0, badfriend); - for (i = 0, ch = page * nPickups + 1; i < nPickups; ++i, ++ch) { move(i + 3, 0); prints("a"); @@ -1738,7 +1734,7 @@ draw_pickup(int drawall, pickup_t * pickup, int pickup_way, continue; } if (!uentp->pid) { - prints(I18N[2028], ch); + prints(gettext[2028], ch); continue; } if (PERM_HIDE(uentp)) @@ -1765,9 +1761,9 @@ draw_pickup(int drawall, pickup_t * pickup, int pickup_way, #endif if ((uentp->userlevel & PERM_VIOLATELAW)) - memcpy(mind, I18N[2029], 4); + memcpy(mind, gettext[2029], 4); else if (uentp->birth) - memcpy(mind, I18N[2030], 4); + memcpy(mind, gettext[2030], 4); else memcpy(mind, uentp->mind, 4); mind[4] = 0; @@ -1822,7 +1818,7 @@ call_in(userinfo_t * uentp, int fri_stat) { if (iswritable_stat(uentp, fri_stat)) { char genbuf[60]; - snprintf(genbuf, sizeof(genbuf), I18N[2031], uentp->userid); + snprintf(genbuf, sizeof(genbuf), gettext[2031], uentp->userid); my_write(uentp->pid, genbuf, uentp->userid, 0, NULL); return 1; } @@ -1933,7 +1929,7 @@ userlist(void) if (HAS_PERM(PERM_SYSOP)) { char buf[100]; snprintf(buf, sizeof(buf), - I18N[2032], currutmp->userid); + gettext[2032], currutmp->userid); if (!getdata(1, 0, buf, currutmp->userid, sizeof(buf), DOECHO)) strlcpy(currutmp->userid, cuser.userid, sizeof(currutmp->userid)); @@ -1945,7 +1941,7 @@ userlist(void) if (HAS_PERM(PERM_SYSOP)) { char buf[100]; - snprintf(buf, sizeof(buf), I18N[2033], currutmp->from); + snprintf(buf, sizeof(buf), gettext[2033], currutmp->from); if (!getdata(1, 0, buf, currutmp->from, sizeof(currutmp->from), DOECHO)) strncpy(currutmp->from, buf, 23); @@ -2124,14 +2120,14 @@ userlist(void) char genbuf[60]; char ans[4]; - if (!getdata(0, 0, I18N[2034], genbuf, sizeof(genbuf), DOECHO)) + if (!getdata(0, 0, gettext[2034], genbuf, sizeof(genbuf), DOECHO)) break; - if (getdata(0, 0, I18N[2035], + if (getdata(0, 0, gettext[2035], ans, sizeof(ans), LCECHO) && *ans == 'n') break; if (!(cuser.uflag & FRIEND_FLAG) && HAS_PERM(PERM_SYSOP)) { - getdata(1, 0, I18N[2036], + getdata(1, 0, gettext[2036], ans, sizeof(ans), LCECHO); if( *ans != 'y' && *ans != 'Y' ){ vmsg("abort"); @@ -2180,7 +2176,7 @@ userlist(void) int id; userec_t muser; strlcpy(currauthor, uentp->userid, sizeof(currauthor)); - stand_title(I18N[2037]); + stand_title(gettext[2037]); move(1, 0); if ((id = getuser(uentp->userid)) > 0) { memcpy(&muser, &xuser, sizeof(muser)); @@ -2193,12 +2189,12 @@ userlist(void) case 'i':{ char mindbuf[5]; - getdata(b_lines - 1, 0, I18N[2038], + getdata(b_lines - 1, 0, gettext[2038], mindbuf, sizeof(mindbuf), DOECHO); - if (strcmp(mindbuf, I18N[2039]) == 0) - vmsg(I18N[2040]); - else if (strcmp(mindbuf, I18N[2041]) == 0) - vmsg(I18N[2042]); + if (strcmp(mindbuf, gettext[2039]) == 0) + vmsg(gettext[2040]); + else if (strcmp(mindbuf, gettext[2041]) == 0) + vmsg(gettext[2042]); else memcpy(currutmp->mind, mindbuf, 4); } @@ -2232,7 +2228,7 @@ userlist(void) break; case 'a': if (HAS_PERM(PERM_LOGINOK) && !(fri_stat & IFH)) { - if (getans(I18N[2043]) == 'y') { + if (getans(gettext[2043]) == 'y') { friend_add(uentp->userid, FRIEND_OVERRIDE,uentp->username); friend_load(FRIEND_OVERRIDE); } @@ -2242,7 +2238,7 @@ userlist(void) case 'd': if (HAS_PERM(PERM_LOGINOK) && (fri_stat & IFH)) { - if (getans(I18N[2044]) == 'y') { + if (getans(gettext[2044]) == 'y') { friend_delete(uentp->userid, FRIEND_OVERRIDE); friend_load(FRIEND_OVERRIDE); } @@ -2267,36 +2263,37 @@ userlist(void) case 'g': if (HAS_PERM(PERM_LOGINOK) && strcmp(uentp->userid, cuser.userid) != 0) { - char genbuf[10]; + char genbuf[10]; move(b_lines - 2, 0); - prints(I18N[2045], uentp->userid); - if (getdata(b_lines - 1, 0, I18N[2046], + prints(gettext[2045], uentp->userid); + if (getdata(b_lines - 1, 0, gettext[2046], genbuf, 7, LCECHO)) { clrtoeol(); if ((ch = atoi(genbuf)) <= 0 || ch <= give_tax(ch)){ redrawall = redraw = 1; break; } - sprintf(genbuf, I18N[2047], uentp->userid, ch); - if (getans(genbuf) != 'y'){ + if (getans(gettext[2047], + uentp->userid, ch) != 'y'){ redrawall = redraw = 1; break; } reload_money(); if (ch > cuser.money) { - outs(I18N[2048]); + outs(gettext[2048]); } else { deumoney(uentp->uid, ch - give_tax(ch)); - log_file(FN_MONEY, 1, I18N[2050], - cuser.userid,uentp->userid, ch,ctime(&currutmp->lastact)); + log_file(FN_MONEY, LOG_CREAT | LOG_VF, + gettext[2050], cuser.userid, + uentp->userid, ch, ctime(&currutmp->lastact)); mail_redenvelop(cuser.userid, uentp->userid, ch - give_tax(ch), 'Y'); - vmsg(I18N[2049],demoney(-ch)); + vmsg(gettext[2049],demoney(-ch)); } } else { clrtoeol(); - vmsg(I18N[2051]); + vmsg(gettext[2051]); } redrawall = redraw = 1; } @@ -2304,8 +2301,8 @@ userlist(void) case 'm': if (HAS_PERM(PERM_BASIC)) { - stand_title(I18N[2052]); - prints(I18N[2053], uentp->userid); + stand_title(gettext[2052]); + prints(gettext[2053], uentp->userid); my_send(uentp->userid); setutmpmode(LUSERS); redrawall = redraw = 1; @@ -2348,12 +2345,12 @@ userlist(void) case Ctrl('W'): if (HAS_PERM(PERM_LOGINOK)) { int tmp; - char *wm[3] = {I18N[2054], I18N[2055], I18N[2056]}; + char *wm[3] = {gettext[2054], gettext[2055], gettext[2056]}; tmp = cuser.uflag2 & WATER_MASK; cuser.uflag2 -= tmp; tmp = (tmp + 1) % 3; cuser.uflag2 |= tmp; - vmsg(I18N[2057], wm[tmp]); + vmsg(gettext[2057], wm[tmp]); redrawall = redraw = 1; } break; @@ -2367,7 +2364,7 @@ userlist(void) break; case 'N': - oldgetdata(1, 0, I18N[2058], + oldgetdata(1, 0, gettext[2058], cuser.username, sizeof(cuser.username), DOECHO); strcpy(currutmp->username, cuser.username); redrawall = redraw = 1; @@ -2420,7 +2417,7 @@ t_idle(void) char passbuf[PASSLEN]; setutmpmode(IDLE); - getdata(b_lines - 1, 0, I18N[2059], genbuf, 3, DOECHO); + getdata(b_lines - 1, 0, gettext[2059], genbuf, 3, DOECHO); if (genbuf[0] == 'q' || genbuf[0] == 'Q') { currutmp->mode = mode0; currstat = stat0; @@ -2432,14 +2429,14 @@ t_idle(void) if (currutmp->destuid == 6) if (!cuser.userlevel || - !getdata(b_lines - 1, 0, I18N[2060], + !getdata(b_lines - 1, 0, gettext[2060], currutmp->chatid, sizeof(currutmp->chatid), DOECHO)) currutmp->destuid = 0; do { move(b_lines - 2, 0); clrtoeol(); - prints(I18N[2061], (currutmp->destuid != 6) ? - I18N[1890 + currutmp->destuid] : currutmp->chatid); + prints(gettext[2061], (currutmp->destuid != 6) ? + gettext[1890 + currutmp->destuid] : currutmp->chatid); refresh(); getdata(b_lines - 1, 0, MSG_PASSWD, passbuf, sizeof(passbuf), NOECHO); passbuf[8] = '\0'; @@ -2459,7 +2456,7 @@ t_qchicken(void) { char uident[STRLEN]; - stand_title(I18N[2062]); + stand_title(gettext[2062]); usercomplete(msg_uid, uident); if (uident[0]) chicken_query(uident); @@ -2471,7 +2468,7 @@ t_query(void) { char uident[STRLEN]; - stand_title(I18N[2063]); + stand_title(gettext[2063]); usercomplete(msg_uid, uident); if (uident[0]) my_query(uident); @@ -2489,7 +2486,7 @@ t_talk() * if (count_ulist() <= 1){ outs("目前線上只有您一人,快邀請朋友來光臨【" * BBSNAME "】吧!"); return XEASY; } */ - stand_title(I18N[2064]); + stand_title(gettext[2064]); generalnamecomplete(msg_uid, uident, sizeof(uident), SHM->UTMPnumber, completeutmp_compar, @@ -2507,9 +2504,9 @@ t_talk() /* multi-login check */ unum = 1; while ((ucount = count_logins(tuid, 0)) > 1) { - outs(I18N[2065]); + outs(gettext[2065]); count_logins(tuid, 1); - getdata(1, 33, I18N[2066], genbuf, 4, DOECHO); + getdata(1, 33, gettext[2066], genbuf, 4, DOECHO); unum = atoi(genbuf); if (unum == 0) return 0; @@ -2535,7 +2532,7 @@ reply_connection_request(userinfo_t *uip) if (uip->mode != PAGE) { snprintf(genbuf, sizeof(genbuf), - I18N[2067], page_requestor); + gettext[2067], page_requestor); getdata(0, 0, genbuf, buf, sizeof(buf), LCECHO); return -1; } @@ -2575,25 +2572,25 @@ talkreply(void) clear(); prints("\n\n"); - prints(I18N[2068], sig_des(sig)); - prints(I18N[2069], + prints(gettext[2068], sig_des(sig)); + prints(gettext[2069], sig_des(sig), sig_des(sig)); - prints(I18N[2070]); - prints(I18N[2071]); - prints(I18N[2072], sig_des(sig), sig_des(sig)); + prints(gettext[2070]); + prints(gettext[2071]); + prints(gettext[2072], sig_des(sig), sig_des(sig)); getuser(uip->userid); currutmp->msgs[0].pid = uip->pid; strlcpy(currutmp->msgs[0].userid, uip->userid, sizeof(currutmp->msgs[0].userid)); - strlcpy(currutmp->msgs[0].last_call_in, I18N[2073], + strlcpy(currutmp->msgs[0].last_call_in, gettext[2073], sizeof(currutmp->msgs[0].last_call_in)); - prints(I18N[2074], + prints(gettext[2074], uip->from, xuser.numlogins, xuser.numposts); showplans(uip->userid); show_call_in(0, 0); snprintf(genbuf, sizeof(genbuf), - I18N[2075], + gettext[2075], page_requestor, sig_des(sig)); getdata(0, 0, genbuf, buf, sizeof(buf), LCECHO); a = reply_connection_request(uip); @@ -2602,8 +2599,8 @@ talkreply(void) buf[0] = 'n'; write(a, buf, 1); if (buf[0] == 'f' || buf[0] == 'F') { - if (!getdata(b_lines, 0, I18N[2076], genbuf, 60, DOECHO)) - strlcpy(genbuf, I18N[2077], sizeof(genbuf)); + if (!getdata(b_lines, 0, gettext[2076], genbuf, 60, DOECHO)) + strlcpy(genbuf, gettext[2077], sizeof(genbuf)); write(a, genbuf, 60); } diff --git a/mbbsd/topsong.c b/mbbsd/topsong.c index a3681a0f..9fbbe195 100644 --- a/mbbsd/topsong.c +++ b/mbbsd/topsong.c @@ -68,7 +68,7 @@ sortsong() } qsort(songs, MAX_SONGS, sizeof(songcmp_t), (QCAST) count_cmp); fprintf(fo, - I18N[2078], totalcount); + gettext[2078], totalcount); for (n = 0; n < 100 && songs[n].name[0]; n++) { fprintf(fo, " %5d. %-38.38s %4ld \033[32m[%.2f]\033[m\n", n + 1, songs[n].name, songs[n].count, diff --git a/mbbsd/user.c b/mbbsd/user.c index 92c4a08a..0684fd22 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -28,12 +28,12 @@ u_loginview() move(4, 0); for (i = 0; i < NUMVIEWFILE; i++) prints(" %c. %-20s %-15s \n", 'A' + i, - I18N[loginview_file[i].string_index] - , ((pbits >> i) & 1 ? I18N[2079] : - I18N[2080])); + gettext[loginview_file[i].string_index] + , ((pbits >> i) & 1 ? gettext[2079] : + gettext[2080])); clrtobot(); - while ((i = getkey(I18N[2081]))!='\r') { + while ((i = getkey(gettext[2081]))!='\r') { i = i - 'a'; if (i >= NUMVIEWFILE || i < 0) @@ -41,7 +41,7 @@ u_loginview() else { pbits ^= (1 << i); move(i + 4, 28); - prints((pbits >> i) & 1 ? I18N[2082] : I18N[2083]); + prints((pbits >> i) & 1 ? gettext[2082] : gettext[2083]); } } @@ -60,13 +60,13 @@ user_display(userec_t * u, int real) clrtobot(); prints( - I18N[2084]); - prints(I18N[2085], + gettext[2084]); + prints(gettext[2085], u->userid, u->username, u->realname, #ifdef FOREIGN_REG - u->uflag2 & FOREIGN ? I18N[2087] : "", + u->uflag2 & FOREIGN ? gettext[2087] : "", u->uflag2 & FOREIGN ? - (u->uflag2 & LIVERIGHT) ? I18N[2088] : I18N[2089] + (u->uflag2 & LIVERIGHT) ? gettext[2088] : gettext[2089] : "", #else "","", @@ -75,14 +75,14 @@ user_display(userec_t * u, int real) sex[u->sex % 8], u->money); sethomedir(genbuf, u->userid); - prints(I18N[2090], + prints(gettext[2090], get_num_records(genbuf, sizeof(fileheader_t)), u->exmailbox, u->mobile, u->month, u->day, u->year % 100, u->mychicken.name); - prints(I18N[2091], ctime(&u->firstlogin)); - prints(I18N[2092], ctime(&u->lastlogin)); - prints(I18N[2093], ctime(&u->lastsong)); - prints(I18N[2094], + prints(gettext[2091], ctime(&u->firstlogin)); + prints(gettext[2092], ctime(&u->lastlogin)); + prints(gettext[2093], ctime(&u->lastsong)); + prints(gettext[2094], u->numlogins, u->numposts); if (real) { @@ -90,11 +90,11 @@ user_display(userec_t * u, int real) for (diff = 0; diff < 32; diff++) if (!(u->userlevel & (1 << diff))) genbuf[diff] = '-'; - prints(I18N[2095], + prints(gettext[2095], u->justify, genbuf); } else { diff = (now - login_start_time) / 60; - prints(I18N[2096], + prints(gettext[2096], diff / 60, diff % 60); } @@ -103,7 +103,7 @@ user_display(userec_t * u, int real) int i; boardheader_t *bhdr; - outs(I18N[2097]); + outs(gettext[2097]); for (i = 0, bhdr = bcache; i < numboards; i++, bhdr++) { if (is_uBM(bhdr->BM, u->userid)) { @@ -113,15 +113,15 @@ user_display(userec_t * u, int real) } outc('\n'); } - outs(I18N[2098]); + outs(gettext[2098]); outs((u->userlevel & PERM_LOGINOK) ? - I18N[2099] : - I18N[2100]); + gettext[2099] : + gettext[2100]); #ifdef NEWUSER_LIMIT if ((u->lastlogin - u->firstlogin < 3 * 86400) && !HAS_PERM(PERM_POST)) - outs(I18N[2101]); + outs(gettext[2101]); #endif } @@ -135,11 +135,11 @@ mail_violatelaw(char *crime, char *police, char *reason, char *result) stampfile(genbuf, &fhdr); if (!(fp = fopen(genbuf, "w"))) return; - fprintf(fp, I18N[2102], + fprintf(fp, gettext[2102], ctime(&now), police, crime, reason, result); fclose(fp); - strcpy(fhdr.title, I18N[2103]); - strcpy(fhdr.owner, I18N[2104]); + strcpy(fhdr.title, gettext[2103]); + strcpy(fhdr.owner, gettext[2104]); snprintf(genbuf, 200, "home/%c/%s/.DIR", crime[0], crime); append_record(genbuf, &fhdr, sizeof(fhdr)); } @@ -152,26 +152,26 @@ violate_law(userec_t * u, int unum) move(1, 0); clrtobot(); move(2, 0); - prints(I18N[2105]); - prints(I18N[2106]); - getdata(5, 0, I18N[2107], ans, 3, DOECHO); + prints(gettext[2105]); + prints(gettext[2106]); + getdata(5, 0, gettext[2107], ans, 3, DOECHO); switch (ans[0]) { case '1': strcpy(reason, "Cross-post"); break; case '2': - strcpy(reason, I18N[2108]); + strcpy(reason, gettext[2108]); break; case '3': - strcpy(reason, I18N[2109]); + strcpy(reason, gettext[2109]); break; case '4': - while (!getdata(7, 0, I18N[2110], reason, 50, DOECHO)); - strcat(reason, I18N[2111]); + while (!getdata(7, 0, gettext[2110], reason, 50, DOECHO)); + strcat(reason, gettext[2111]); break; case '8': case '9': - while (!getdata(6, 0, I18N[2112], reason, 50, DOECHO)); + while (!getdata(6, 0, gettext[2112], reason, 50, DOECHO)); break; default: return; @@ -184,15 +184,15 @@ violate_law(userec_t * u, int unum) snprintf(src, sizeof(src), "home/%c/%s", u->userid[0], u->userid); snprintf(dst, sizeof(dst), "tmp/%s", u->userid); Rename(src, dst); - post_violatelaw(u->userid, cuser.userid, reason, I18N[2113]); + post_violatelaw(u->userid, cuser.userid, reason, gettext[2113]); kill_user(unum); } else { u->userlevel |= PERM_VIOLATELAW; u->vl_count++; passwd_update(unum, u); - post_violatelaw(u->userid, cuser.userid, reason, I18N[2114]); - mail_violatelaw(u->userid, cuser.userid, reason, I18N[2115]); + post_violatelaw(u->userid, cuser.userid, reason, gettext[2114]); + mail_violatelaw(u->userid, cuser.userid, reason, gettext[2115]); } pressanykey(); } @@ -201,29 +201,29 @@ static void Customize(void) { char done = 0, mindbuf[5]; - showtitle(I18N[2119], I18N[2120]); + showtitle(gettext[2119], gettext[2120]); memcpy(mindbuf, &currutmp->mind, 4); mindbuf[4] = 0; while( !done ){ move(2, 0); - prints(I18N[2121]); + prints(gettext[2121]); move(4, 0); - prints("%-30s%10s\n", I18N[2122], - I18N[2116 + (cuser.uflag2 & WATER_MASK)]); - prints("%-30s%10s\n", I18N[2123], - ((cuser.userlevel & PERM_NOOUTMAIL) ? I18N[2124] : I18N[2125])); - prints("%-30s%10s\n", I18N[2126], - ((cuser.uflag2 & FAVNEW_FLAG) ? I18N[2127] : I18N[2128])); - prints("%-30s%10s\n", I18N[2129], mindbuf); - prints("%-30s%10s\n", I18N[2130], - ((cuser.uflag2 & FAVNOHILIGHT) ? I18N[2131] : I18N[2132])); - switch(getkey(I18N[2133])){ + prints("%-30s%10s\n", gettext[2122], + gettext[2116 + (cuser.uflag2 & WATER_MASK)]); + prints("%-30s%10s\n", gettext[2123], + ((cuser.userlevel & PERM_NOOUTMAIL) ? gettext[2124] : gettext[2125])); + prints("%-30s%10s\n", gettext[2126], + ((cuser.uflag2 & FAVNEW_FLAG) ? gettext[2127] : gettext[2128])); + prints("%-30s%10s\n", gettext[2129], mindbuf); + prints("%-30s%10s\n", gettext[2130], + ((cuser.uflag2 & FAVNOHILIGHT) ? gettext[2131] : gettext[2132])); + switch(getkey(gettext[2133])){ case 'a':{ int currentset = cuser.uflag2 & WATER_MASK; currentset = (currentset + 1) % 3; cuser.uflag2 &= ~WATER_MASK; cuser.uflag2 |= currentset; - vmsg(I18N[2134]); + vmsg(gettext[2134]); } break; case 'b': @@ -235,12 +235,12 @@ static void Customize(void) subscribe_newfav(); break; case 'd':{ - getdata(b_lines - 1, 0, I18N[2135], + getdata(b_lines - 1, 0, gettext[2135], mindbuf, sizeof(mindbuf), DOECHO); - if (strcmp(mindbuf, I18N[2136]) == 0) - vmsg(I18N[2137]); - else if (strcmp(mindbuf, I18N[2138]) == 0) - vmsg(I18N[2139]); + if (strcmp(mindbuf, gettext[2136]) == 0) + vmsg(gettext[2137]); + else if (strcmp(mindbuf, gettext[2138]) == 0) + vmsg(gettext[2139]); else memcpy(currutmp->mind, mindbuf, 4); } @@ -253,7 +253,7 @@ static void Customize(void) } passwd_update(usernum, &cuser); } - pressanykey(); + vmsg("設定完成"); } void @@ -274,8 +274,9 @@ uinfo_query(userec_t * u, int real, int unum) memcpy(&x, u, sizeof(userec_t)); ans = getans(real ? - I18N[2140] : - I18N[2141]); + gettext[2140] : + gettext[2141]); + if (ans > '2' && ans != 'C' && ans != 'c' && !real) ans = '0'; @@ -296,32 +297,32 @@ uinfo_query(userec_t * u, int real, int unum) return; case '1': move(0, 0); - outs(I18N[2142]); + outs(gettext[2142]); - getdata_buf(i++, 0, I18N[2143], x.username, + getdata_buf(i++, 0, gettext[2143], x.username, sizeof(x.username), DOECHO); if (real) { - getdata_buf(i++, 0, I18N[2144], + getdata_buf(i++, 0, gettext[2144], x.realname, sizeof(x.realname), DOECHO); #ifdef FOREIGN_REG - getdata_buf(i++, 0, cuser.uflag2 & FOREIGN ? I18N[2145] : I18N[2146], x.ident, sizeof(x.ident), DOECHO); + getdata_buf(i++, 0, cuser.uflag2 & FOREIGN ? gettext[2145] : gettext[2146], x.ident, sizeof(x.ident), DOECHO); #else - getdata_buf(i++, 0, I18N[2147], x.ident, sizeof(x.ident), DOECHO); + getdata_buf(i++, 0, gettext[2147], x.ident, sizeof(x.ident), DOECHO); #endif - getdata_buf(i++, 0, I18N[2148], + getdata_buf(i++, 0, gettext[2148], x.address, sizeof(x.address), DOECHO); } snprintf(buf, sizeof(buf), "%010d", x.mobile); - getdata_buf(i++, 0, I18N[2149], buf, 11, LCECHO); + getdata_buf(i++, 0, gettext[2149], buf, 11, LCECHO); x.mobile = atoi(buf); - getdata_str(i++, 0, I18N[2150], buf, 50, DOECHO, + getdata_str(i++, 0, gettext[2150], buf, 50, DOECHO, x.email); if (strcmp(buf, x.email) && strchr(buf, '@')) { strlcpy(x.email, buf, sizeof(x.email)); mail_changed = 1 - real; } snprintf(genbuf, sizeof(genbuf), "%i", (u->sex + 1) % 8); - getdata_str(i++, 0, I18N[2151], + getdata_str(i++, 0, gettext[2151], buf, 3, DOECHO, genbuf); if (buf[0] >= '1' && buf[0] <= '8') x.sex = (buf[0] - '1') % 8; @@ -333,7 +334,7 @@ uinfo_query(userec_t * u, int real, int unum) snprintf(genbuf, sizeof(genbuf), "%02i/%02i/%02i", u->month, u->day, u->year % 100); - len = getdata_str(i, 0, I18N[2152], buf, 9, + len = getdata_str(i, 0, gettext[2152], buf, 9, DOECHO, genbuf); if (len && len != 8) continue; @@ -357,7 +358,7 @@ uinfo_query(userec_t * u, int real, int unum) int l; if (HAS_PERM(PERM_BBSADM)) { snprintf(genbuf, sizeof(genbuf), "%d", x.money); - if (getdata_str(i++, 0, I18N[2153], buf, 10, DOECHO, genbuf)) + if (getdata_str(i++, 0, gettext[2153], buf, 10, DOECHO, genbuf)) if ((l = atol(buf)) != 0) { if (l != x.money) { money_change = 1; @@ -367,40 +368,40 @@ uinfo_query(userec_t * u, int real, int unum) } } snprintf(genbuf, sizeof(genbuf), "%d", x.exmailbox); - if (getdata_str(i++, 0, I18N[2154], buf, 6, + if (getdata_str(i++, 0, gettext[2154], buf, 6, DOECHO, genbuf)) if ((l = atol(buf)) != 0) x.exmailbox = (int)l; - getdata_buf(i++, 0, I18N[2155], x.justify, + getdata_buf(i++, 0, gettext[2155], x.justify, sizeof(x.justify), DOECHO); - getdata_buf(i++, 0, I18N[2156], + getdata_buf(i++, 0, gettext[2156], x.lasthost, sizeof(x.lasthost), DOECHO); snprintf(genbuf, sizeof(genbuf), "%d", x.numlogins); - if (getdata_str(i++, 0, I18N[2157], buf, 10, DOECHO, genbuf)) + if (getdata_str(i++, 0, gettext[2157], buf, 10, DOECHO, genbuf)) if ((fail = atoi(buf)) >= 0) x.numlogins = fail; snprintf(genbuf, sizeof(genbuf), "%d", u->numposts); - if (getdata_str(i++, 0, I18N[2158], buf, 10, DOECHO, genbuf)) + if (getdata_str(i++, 0, gettext[2158], buf, 10, DOECHO, genbuf)) if ((fail = atoi(buf)) >= 0) x.numposts = fail; snprintf(genbuf, sizeof(genbuf), "%d", u->goodpost); - if (getdata_str(i++, 0, I18N[2159], buf, 10, DOECHO, genbuf)) + if (getdata_str(i++, 0, gettext[2159], buf, 10, DOECHO, genbuf)) if ((fail = atoi(buf)) >= 0) x.goodpost = fail; snprintf(genbuf, sizeof(genbuf), "%d", u->badpost); - if (getdata_str(i++, 0, I18N[2160], buf, 10, DOECHO, genbuf)) + if (getdata_str(i++, 0, gettext[2160], buf, 10, DOECHO, genbuf)) if ((fail = atoi(buf)) >= 0) x.badpost = fail; snprintf(genbuf, sizeof(genbuf), "%d", u->vl_count); - if (getdata_str(i++, 0, I18N[2161], buf, 10, DOECHO, genbuf)) + if (getdata_str(i++, 0, gettext[2161], buf, 10, DOECHO, genbuf)) if ((fail = atoi(buf)) >= 0) x.vl_count = fail; snprintf(genbuf, sizeof(genbuf), "%d/%d/%d", u->five_win, u->five_lose, u->five_tie); - if (getdata_str(i++, 0, I18N[2162], buf, 16, DOECHO, + if (getdata_str(i++, 0, gettext[2162], buf, 16, DOECHO, genbuf)) while (1) { p = strtok(buf, "/\r\n"); @@ -419,7 +420,7 @@ uinfo_query(userec_t * u, int real, int unum) } snprintf(genbuf, sizeof(genbuf), "%d/%d/%d", u->chc_win, u->chc_lose, u->chc_tie); - if (getdata_str(i++, 0, I18N[2163], buf, 16, DOECHO, + if (getdata_str(i++, 0, gettext[2163], buf, 16, DOECHO, genbuf)) while (1) { p = strtok(buf, "/\r\n"); @@ -437,7 +438,7 @@ uinfo_query(userec_t * u, int real, int unum) break; } #ifdef FOREIGN_REG - if (getdata_str(i++, 0, I18N[2164], buf, 2, DOECHO, x.uflag2 & FOREIGN ? "2" : "1")) + if (getdata_str(i++, 0, gettext[2164], buf, 2, DOECHO, x.uflag2 & FOREIGN ? "2" : "1")) if ((fail = atoi(buf)) > 0){ if (fail == 2){ x.uflag2 |= FOREIGN; @@ -446,7 +447,7 @@ uinfo_query(userec_t * u, int real, int unum) x.uflag2 &= ~FOREIGN; } if (x.uflag2 & FOREIGN) - if (getdata_str(i++, 0, I18N[2165], buf, 2, DOECHO, x.uflag2 & LIVERIGHT ? "1" : "2")){ + if (getdata_str(i++, 0, gettext[2165], buf, 2, DOECHO, x.uflag2 & LIVERIGHT ? "1" : "2")){ if ((fail = atoi(buf)) > 0){ if (fail == 1){ x.uflag2 |= LIVERIGHT; @@ -466,29 +467,29 @@ uinfo_query(userec_t * u, int real, int unum) case '2': i = 19; if (!real) { - if (!getdata(i++, 0, I18N[2166], buf, PASSLEN, NOECHO) || + if (!getdata(i++, 0, gettext[2166], buf, PASSLEN, NOECHO) || !checkpasswd(u->passwd, buf)) { - outs(I18N[2167]); + outs(gettext[2167]); fail++; break; } } else { char witness[3][32]; for (i = 0; i < 3; i++) { - if (!getdata(19 + i, 0, I18N[2168], + if (!getdata(19 + i, 0, gettext[2168], witness[i], sizeof(witness[i]), DOECHO)) { - outs(I18N[2169]); + outs(gettext[2169]); fail++; break; } else if (!(uid = getuser(witness[i]))) { - outs(I18N[2170]); + outs(gettext[2170]); fail++; break; } else { userec_t atuser; passwd_query(uid, &atuser); if (now - atuser.firstlogin < 6 * 30 * 24 * 60 * 60) { - outs(I18N[2171]); + outs(gettext[2171]); i--; } } @@ -499,16 +500,16 @@ uinfo_query(userec_t * u, int real, int unum) i = 20; } - if (!getdata(i++, 0, I18N[2172], buf, PASSLEN, NOECHO)) { - outs(I18N[2173]); + if (!getdata(i++, 0, gettext[2172], buf, PASSLEN, NOECHO)) { + outs(gettext[2173]); fail++; break; } strncpy(genbuf, buf, PASSLEN); - getdata(i++, 0, I18N[2174], buf, PASSLEN, NOECHO); + getdata(i++, 0, gettext[2174], buf, PASSLEN, NOECHO); if (strncmp(buf, genbuf, PASSLEN)) { - outs(I18N[2175]); + outs(gettext[2175]); fail++; break; } @@ -534,10 +535,10 @@ uinfo_query(userec_t * u, int real, int unum) break; case '5': - if (getdata_str(b_lines - 3, 0, I18N[2176], genbuf, IDLEN + 1, + if (getdata_str(b_lines - 3, 0, gettext[2176], genbuf, IDLEN + 1, DOECHO, x.userid)) { if (searchuser(genbuf)) { - outs(I18N[2177]); + outs(gettext[2177]); fail++; } else strlcpy(x.userid, genbuf, sizeof(x.userid)); @@ -547,7 +548,7 @@ uinfo_query(userec_t * u, int real, int unum) if (x.mychicken.name[0]) x.mychicken.name[0] = 0; else - strlcpy(x.mychicken.name, I18N[2178], sizeof(x.mychicken.name)); + strlcpy(x.mychicken.name, gettext[2178], sizeof(x.mychicken.name)); break; default: return; @@ -557,7 +558,7 @@ uinfo_query(userec_t * u, int real, int unum) pressanykey(); return; } - if (getans(msg_sure_ny) == 'y') { + if (getans(msg_sure_ny) == 'y') { if (flag) post_change_perm(temp, i, cuser.userid, x.userid); if (strcmp(u->userid, x.userid)) { @@ -594,21 +595,21 @@ uinfo_query(userec_t * u, int real, int unum) if (!(fp = fopen(genbuf, "w"))) return; - fprintf(fp, I18N[2179], + fprintf(fp, gettext[2179], ctime(&now), cuser.userid, x.userid, money, x.money); clrtobot(); clear(); - while (!getdata(5, 0, I18N[2180], + while (!getdata(5, 0, gettext[2180], reason, sizeof(reason), DOECHO)); - fprintf(fp, I18N[2181], + fprintf(fp, gettext[2181], cuser.userid, reason); fclose(fp); snprintf(fhdr.title, sizeof(fhdr.title), - I18N[2182], cuser.userid, + gettext[2182], cuser.userid, x.userid); - strlcpy(fhdr.owner, I18N[2183], sizeof(fhdr.owner)); + strlcpy(fhdr.owner, gettext[2183], sizeof(fhdr.owner)); append_record("boards/S/Security/.DIR", &fhdr, sizeof(fhdr)); } } @@ -634,6 +635,13 @@ u_ansi() } int +u_language() +{ + cuser.language = (cuser.language + 1) % MAX_LANG; + gettext = SHM->i18nstr[cuser.language]; + return 0; +} +int u_cloak() { outs((currutmp->invisible ^= 1) ? MSG_CLOAKED : MSG_UNCLOAK); @@ -652,7 +660,7 @@ u_switchproverb() FILE *fp = fopen(buf, "a"); assert(fp); - fprintf(fp, I18N[2184]); + fprintf(fp, gettext[2184]); fclose(fp); } passwd_update(usernum, &cuser); @@ -668,7 +676,7 @@ u_editproverb() setuserfile(buf, fn_proverb); move(1, 0); clrtobot(); - outs(I18N[2185]); + outs(gettext[2185]); pressanykey(); vedit(buf, NA, NULL); return 0; @@ -681,7 +689,7 @@ showplans(char *uid) sethomefile(genbuf, uid, fn_plans); if (!show_file(genbuf, 7, MAX_QUERYLINES, ONLY_COLOR)) - prints(I18N[2186], uid); + prints(gettext[2186], uid); } int @@ -700,7 +708,7 @@ showsignature(char *fname, int *j) for (ch = '1'; ch <= '9'; ch++) { fname[*j] = ch; if ((fp = fopen(fname, "r"))) { - prints(I18N[2187], ch); + prints(gettext[2187], ch); for (i = 0; i < MAX_SIGLINES && fgets(buf, sizeof(buf), fp); i++) outs(buf); num++; @@ -720,7 +728,7 @@ u_editsig() showsignature(genbuf, &j); - getdata(0, 0, I18N[2188], + getdata(0, 0, gettext[2188], ans, sizeof(ans), LCECHO); aborted = 0; @@ -730,7 +738,7 @@ u_editsig() aborted = 2; if (aborted) { - if (!getdata(1, 0, I18N[2189], ans, sizeof(ans), DOECHO)) + if (!getdata(1, 0, gettext[2189], ans, sizeof(ans), DOECHO)) ans[0] = '1'; if (ans[0] >= '1' && ans[0] <= '9') { genbuf[j] = ans[0]; @@ -741,7 +749,7 @@ u_editsig() setutmpmode(EDITSIG); aborted = vedit(genbuf, NA, NULL); if (aborted != -1) - outs(I18N[2190]); + outs(gettext[2190]); } } pressanykey(); @@ -754,7 +762,7 @@ u_editplan() { char genbuf[200]; - getdata(b_lines - 1, 0, I18N[2191], + getdata(b_lines - 1, 0, gettext[2191], genbuf, 3, LCECHO); if (genbuf[0] == 'e') { @@ -764,13 +772,13 @@ u_editplan() setuserfile(genbuf, fn_plans); aborted = vedit(genbuf, NA, NULL); if (aborted != -1) - outs(I18N[2192]); + outs(gettext[2192]); pressanykey(); return 0; } else if (genbuf[0] == 'd') { setuserfile(genbuf, fn_plans); unlink(genbuf); - outmsg(I18N[2193]); + outmsg(gettext[2193]); } return 0; } @@ -780,7 +788,7 @@ u_editcalendar() { char genbuf[200]; - getdata(b_lines - 1, 0, I18N[2194], + getdata(b_lines - 1, 0, gettext[2194], genbuf, 3, LCECHO); sethomefile(genbuf, cuser.userid, "calendar"); @@ -791,11 +799,11 @@ u_editcalendar() sethomefile(genbuf, cuser.userid, "calendar"); aborted = vedit(genbuf, NA, NULL); if (aborted != -1) - vmsg(I18N[2195]); + vmsg(gettext[2195]); return 0; } else if (genbuf[0] == 'd') { unlink(genbuf); - vmsg(I18N[2196]); + vmsg(gettext[2196]); } return 0; } @@ -808,12 +816,12 @@ getfield(int line, char *info, char *desc, char *buf, int len) char genbuf[200]; move(line, 2); - prints(I18N[2197], buf, info); - snprintf(prompt, sizeof(prompt), I18N[2198], desc); + prints(gettext[2197], buf, info); + snprintf(prompt, sizeof(prompt), gettext[2198], desc); if (getdata_str(line + 1, 2, prompt, genbuf, len, DOECHO, buf)) strcpy(buf, genbuf); move(line, 2); - prints(I18N[2199], desc, buf); + prints(gettext[2199], desc, buf); clrtoeol(); } @@ -916,47 +924,47 @@ toregister(char *email, char *genbuf, char *phone, char *career, fclose(fn); } clear(); - stand_title(I18N[2200]); + stand_title(gettext[2200]); if (cuser.userlevel & PERM_NOREGCODE){ strcpy(email, "x"); goto REGFORM2; } move(2, 0); - outs(I18N[2201]); + outs(gettext[2201]); #ifdef HAVEMOBILE - outs(I18N[2202]); + outs(gettext[2202]); #endif while (1) { email[0] = 0; - getfield(15, I18N[2203], "E-Mail Address", email, 50); + getfield(15, gettext[2203], "E-Mail Address", email, 50); if (strcmp(email, "x") == 0 || strcmp(email, "X") == 0) break; #ifdef HAVEMOBILE else if (strcmp(email, "m") == 0 || strcmp(email, "M") == 0) { if (isvalidmobile(mobile)) { char yn[3]; - getdata(16, 0, I18N[2204], + getdata(16, 0, gettext[2204], yn, sizeof(yn), LCECHO); if (yn[0] == 'Y' || yn[0] == 'y') break; } else { move(17, 0); - prints(I18N[2205]); + prints(gettext[2205]); } } #endif else if (isvalidemail(email)) { char yn[3]; - getdata(16, 0, I18N[2206], + getdata(16, 0, gettext[2206], yn, sizeof(yn), LCECHO); if (yn[0] == 'Y' || yn[0] == 'y') break; } else { move(17, 0); - prints(I18N[2207]); + prints(gettext[2207]); } } strncpy(cuser.email, email, sizeof(cuser.email)); @@ -990,7 +998,7 @@ toregister(char *email, char *genbuf, char *phone, char *career, sethomefile(buf, cuser.userid, "justify"); } snprintf(buf, sizeof(buf), "%s%s%s%s", - I18N[2208], BBSNAME, I18N[2209], getregcode(genbuf)); + gettext[2208], BBSNAME, gettext[2209], getregcode(genbuf)); strlcpy(tmp, cuser.userid, sizeof(tmp)); strlcpy(cuser.userid, "SYSOP", sizeof(cuser.userid)); #ifdef HAVEMOBILE @@ -1000,7 +1008,7 @@ toregister(char *email, char *genbuf, char *phone, char *career, #endif bsmtp("etc/registermail", buf, email, 0); strlcpy(cuser.userid, tmp, sizeof(cuser.userid)); - outs(I18N[2210]); + outs(gettext[2210]); pressanykey(); return; } @@ -1011,12 +1019,12 @@ static int HaveRejectStr(char *s, char **rej) { int i; char *ptr, *rejectstr[] = - {I18N[2211], I18N[2212], I18N[2213], I18N[2214], I18N[2215], I18N[2216], I18N[2217], "..", "xx", - I18N[2218], I18N[2219], I18N[2220], I18N[2221], I18N[2222], - I18N[2223], I18N[2224], I18N[2225], I18N[2226], I18N[2227], I18N[2228], I18N[2229], I18N[2230], I18N[2231], I18N[2232], I18N[2233], - I18N[2234], I18N[2235], I18N[2236], I18N[2237],/*"ㄔ",*/ I18N[2238], I18N[2239], I18N[2240], I18N[2241], I18N[2242], - I18N[2243], I18N[2244], I18N[2245], I18N[2246], I18N[2247], I18N[2248], I18N[2249], I18N[2250], I18N[2251], I18N[2252], I18N[2253], - I18N[2254], I18N[2255], I18N[2256], I18N[2257], I18N[2258], NULL}; + {gettext[2211], gettext[2212], gettext[2213], gettext[2214], gettext[2215], gettext[2216], gettext[2217], "..", "xx", + gettext[2218], gettext[2219], gettext[2220], gettext[2221], gettext[2222], + gettext[2223], gettext[2224], gettext[2225], gettext[2226], gettext[2227], gettext[2228], gettext[2229], gettext[2230], gettext[2231], gettext[2232], gettext[2233], + gettext[2234], gettext[2235], gettext[2236], gettext[2237],/*"ㄔ",*/ gettext[2238], gettext[2239], gettext[2240], gettext[2241], gettext[2242], + gettext[2243], gettext[2244], gettext[2245], gettext[2246], gettext[2247], gettext[2248], gettext[2249], gettext[2250], gettext[2251], gettext[2252], gettext[2253], + gettext[2254], gettext[2255], gettext[2256], gettext[2257], gettext[2258], NULL}; if( rej != NULL ) for( i = 0 ; rej[i] != NULL ; ++i ) @@ -1027,8 +1035,8 @@ static int HaveRejectStr(char *s, char **rej) if( strstr(s, rejectstr[i]) ) return 1; - if( (ptr = strstr(s, I18N[2259])) != NULL ){ - if( ptr != s && strncmp(ptr - 1, I18N[2260], 4) == 0 ) + if( (ptr = strstr(s, gettext[2259])) != NULL ){ + if( ptr != s && strncmp(ptr - 1, gettext[2260], 4) == 0 ) return 0; return 1; } @@ -1042,20 +1050,20 @@ static char *isvalidname(char *rname) return NULL; #else char *rejectstr[] = - {I18N[2261], I18N[2262], I18N[2263], I18N[2264], I18N[2265], I18N[2266], I18N[2267], I18N[2268], I18N[2269], - I18N[2270], I18N[2271], I18N[2272], I18N[2273], I18N[2274], I18N[2275], I18N[2276], I18N[2277], - I18N[2278], I18N[2279], I18N[2280], I18N[2281], I18N[2282], I18N[2283], I18N[2284], I18N[2285], - I18N[2286], I18N[2287], I18N[2288], I18N[2289], I18N[2290], I18N[2291], + {gettext[2261], gettext[2262], gettext[2263], gettext[2264], gettext[2265], gettext[2266], gettext[2267], gettext[2268], gettext[2269], + gettext[2270], gettext[2271], gettext[2272], gettext[2273], gettext[2274], gettext[2275], gettext[2276], gettext[2277], + gettext[2278], gettext[2279], gettext[2280], gettext[2281], gettext[2282], gettext[2283], gettext[2284], gettext[2285], + gettext[2286], gettext[2287], gettext[2288], gettext[2289], gettext[2290], gettext[2291], NULL}; if( removespace(rname) && rname[0] < 0 && strlen(rname) >= 4 && !HaveRejectStr(rname, rejectstr) && - strncmp(rname, I18N[2292], 2) != 0 && //起頭是「小」 - strncmp(rname, I18N[2293], 4) != 0 && //起頭是「我是」 - !(strlen(rname) == 4 && strncmp(&rname[2], I18N[2294], 2) == 0) && + strncmp(rname, gettext[2292], 2) != 0 && //起頭是「小」 + strncmp(rname, gettext[2293], 4) != 0 && //起頭是「我是」 + !(strlen(rname) == 4 && strncmp(&rname[2], gettext[2294], 2) == 0) && !(strlen(rname) >= 4 && strncmp(&rname[0], &rname[2], 2) == 0)) return NULL; - return I18N[2295]; + return gettext[2295]; #endif } @@ -1065,14 +1073,17 @@ static char *isvalidcareer(char *career) #ifndef FOREIGN_REG char *rejectstr[] = {NULL}; if (!(removespace(career) && career[0] < 0 && strlen(career) >= 6) || - strcmp(career, I18N[2296]) == 0 || HaveRejectStr(career, rejectstr) ) - return I18N[2297]; - if (strcmp(&career[strlen(career) - 2], I18N[2298]) == 0 || - strcmp(&career[strlen(career) - 4], I18N[2299]) == 0 || - strcmp(career, I18N[2300]) == 0) - return I18N[2301]; - if (strcmp(career, I18N[2302]) == 0) - return I18N[2303]; + strcmp(career, gettext[2296]) == 0 || HaveRejectStr(career, rejectstr) ) + return gettext[2297]; + if (strcmp(&career[strlen(career) - 2], gettext[2298]) == 0 || + strcmp(&career[strlen(career) - 4], gettext[2299]) == 0 || + strcmp(career, gettext[2300]) == 0) + return gettext[2301]; + if (strcmp(career, gettext[2302]) == 0) + return gettext[2303]; +#else + if( strlen(career) < 6 ) + return "您的輸入不正確"; #endif return NULL; } @@ -1081,23 +1092,23 @@ static char *isvalidaddr(char *addr) { #ifndef FOREIGN_REG char *rejectstr[] = - {I18N[2304], I18N[2305], I18N[2306], NULL}; + {gettext[2304], gettext[2305], gettext[2306], NULL}; if (!removespace(addr) || addr[0] > 0 || strlen(addr) < 15) - return I18N[2307]; - if (strstr(addr, I18N[2308]) != NULL || strstr(addr, I18N[2309]) != NULL) - return I18N[2310]; - if ((strstr(addr, I18N[2311]) == NULL && strstr(addr, I18N[2312]) == NULL && - strstr(addr, I18N[2313]) == NULL && strstr(addr, I18N[2314]) == NULL) || + return gettext[2307]; + if (strstr(addr, gettext[2308]) != NULL || strstr(addr, gettext[2309]) != NULL) + return gettext[2310]; + if ((strstr(addr, gettext[2311]) == NULL && strstr(addr, gettext[2312]) == NULL && + strstr(addr, gettext[2313]) == NULL && strstr(addr, gettext[2314]) == NULL) || HaveRejectStr(addr, rejectstr) || - strcmp(&addr[strlen(addr) - 2], I18N[2315]) == 0 || - strcmp(&addr[strlen(addr) - 2], I18N[2316]) == 0 || - strcmp(&addr[strlen(addr) - 2], I18N[2317]) == 0 || - strcmp(&addr[strlen(addr) - 2], I18N[2318]) == 0 || - strcmp(&addr[strlen(addr) - 2], I18N[2319]) == 0 || - strcmp(&addr[strlen(addr) - 2], I18N[2320]) == 0 || - strcmp(&addr[strlen(addr) - 2], I18N[2321]) == 0 ) - return I18N[2322]; + strcmp(&addr[strlen(addr) - 2], gettext[2315]) == 0 || + strcmp(&addr[strlen(addr) - 2], gettext[2316]) == 0 || + strcmp(&addr[strlen(addr) - 2], gettext[2317]) == 0 || + strcmp(&addr[strlen(addr) - 2], gettext[2318]) == 0 || + strcmp(&addr[strlen(addr) - 2], gettext[2319]) == 0 || + strcmp(&addr[strlen(addr) - 2], gettext[2320]) == 0 || + strcmp(&addr[strlen(addr) - 2], gettext[2321]) == 0 ) + return gettext[2322]; #endif return NULL; } @@ -1107,12 +1118,12 @@ static char *isvalidphone(char *phone) int i; for( i = 0 ; phone[i] != 0 ; ++i ) if( !isdigit(phone[i]) ) - return I18N[2323]; + return gettext[2323]; if (!removespace(phone) || strlen(phone) < 9 || strstr(phone, "00000000") != NULL || strstr(phone, "22222222") != NULL ) { - return I18N[2324] ; + return gettext[2324] ; } return NULL; } @@ -1132,7 +1143,7 @@ u_register(void) FILE *fn; if (cuser.userlevel & PERM_LOGINOK) { - outs(I18N[2325]); + outs(gettext[2325]); return XEASY; } if ((fn = fopen(fn_register, "r"))) { @@ -1142,7 +1153,7 @@ u_register(void) if (strncmp(genbuf, "uid: ", 5) == 0 && strcmp(genbuf + 5, cuser.userid) == 0) { fclose(fn); - outs(I18N[2326]); + outs(gettext[2326]); return XEASY; } } @@ -1179,7 +1190,7 @@ u_register(void) } if (cuser.userlevel & PERM_NOREGCODE) { - vmsg(I18N[2327]); + vmsg(gettext[2327]); goto REGFORM; } @@ -1187,42 +1198,46 @@ u_register(void) strcmp(cuser.email, "x") != 0 && /* 上次手動認證失敗 */ strcmp(cuser.email, "X") != 0) { clear(); - stand_title(I18N[2328]); + stand_title(gettext[2328]); move(2, 0); - prints(I18N[2329], + prints(gettext[2329], cuser.userid, cuser.username); inregcode[0] = 0; do{ - getdata(10, 0, I18N[2330], inregcode, sizeof(inregcode), DOECHO); + getdata(10, 0, gettext[2330], inregcode, sizeof(inregcode), DOECHO); if( strcmp(inregcode, "x") == 0 || strcmp(inregcode, "X") == 0 || strlen(inregcode) == 13 ) break; if( strlen(inregcode) != 13 ) - vmsg(I18N[2331]); + vmsg(gettext[2331]); } while( 1 ); if (strcmp(inregcode, getregcode(regcode)) == 0) { int unum; if ((unum = getuser(cuser.userid)) == 0) { - vmsg(I18N[2332]); + vmsg(gettext[2332]); u_exit("getuser error"); exit(0); } - mail_muser(cuser, I18N[2333], "etc/registeredmail"); + mail_muser(cuser, gettext[2333], "etc/registeredmail"); if(cuser.uflag2 & FOREIGN) - mail_muser(cuser, I18N[2334], "etc/foreign_welcome"); + mail_muser(cuser, gettext[2334], "etc/foreign_welcome"); cuser.userlevel |= (PERM_LOGINOK | PERM_POST); - prints(I18N[2335]); + prints(gettext[2335]); sethomefile(genbuf, cuser.userid, "justify.wait"); unlink(genbuf); + snprintf(cuser.justify, sizeof(cuser.justify), + "%s:%s:auto", phone, career); + sethomefile(genbuf, cuser.userid, "justify"); + log_file(genbuf, LOG_CREAT, cuser.justify); pressanykey(); u_exit("registed"); exit(0); return QUIT; } else if (strcmp(inregcode, "x") != 0 && strcmp(inregcode, "X") != 0) { - vmsg(I18N[2336]); + vmsg(gettext[2336]); } else { toregister(email, genbuf, phone, career, ident, rname, addr, mobile); @@ -1231,7 +1246,7 @@ u_register(void) } REGFORM: - getdata(b_lines - 1, 0, I18N[2337], + getdata(b_lines - 1, 0, gettext[2337], ans, 3, LCECHO); if (ans[0] != 'y') return FULLUPDATE; @@ -1241,12 +1256,12 @@ u_register(void) while (1) { clear(); move(1, 0); - prints(I18N[2338], + prints(gettext[2338], cuser.userid, cuser.username); #ifdef FOREIGN_REG fore[0] = 'y'; fore[1] = 0; - getfield(2, "Y/n", I18N[2339], fore, 2); + getfield(2, "Y/n", gettext[2339], fore, 2); if (fore[0] == 'n') fore[0] |= FOREIGN; else @@ -1254,43 +1269,43 @@ u_register(void) if (!fore[0]){ #endif while( 1 ){ - getfield(3, "D123456789", I18N[2340], ident, 11); + getfield(3, "D123456789", gettext[2340], ident, 11); if ('a' <= ident[0] && ident[0] <= 'z') ident[0] -= 32; if( ispersonalid(ident) ) break; - vmsg(I18N[2341]); + vmsg(gettext[2341]); } #ifdef FOREIGN_REG } else{ int i; while( 1 ){ - getfield(4, "0123456789",I18N[2342], ident, 11); + getfield(4, "0123456789",gettext[2342], ident, 11); move(6, 2); - prints(I18N[2343]); - getdata(7, 2, I18N[2344], ans, 3, LCECHO); + prints(gettext[2343]); + getdata(7, 2, gettext[2344], ans, 3, LCECHO); if (ans[0] == 'y' || ans[0] == 'Y') break; - vmsg(I18N[2345]); + vmsg(gettext[2345]); } for(i = 0; ans[i] != 0; i++) if ('a' <= ident[0] && ident[0] <= 'z') ident[0] -= 32; if( ispersonalid(ident) ){ fore[0] = 0; - vmsg(I18N[2346]); + vmsg(gettext[2346]); } } #endif while (1) { getfield(8, #ifdef FOREIGN_REG - I18N[2347], + gettext[2347], #else - I18N[2348], + gettext[2348], #endif - I18N[2349], rname, 20); + gettext[2349], rname, 20); if( (errcode = isvalidname(rname)) == NULL ) break; else @@ -1298,19 +1313,19 @@ u_register(void) } move(11, 0); - prints(I18N[2350] + prints(gettext[2350] ); while (1) { - getfield(9, I18N[2351], - I18N[2352], career, 40); + getfield(9, gettext[2351], + gettext[2352], career, 40); if( (errcode = isvalidcareer(career)) == NULL ) break; else vmsg(errcode); } while (1) { - getfield(11, I18N[2353], - I18N[2354], addr, 50); + getfield(11, gettext[2353], + gettext[2354], addr, 50); if( (errcode = isvalidaddr(addr)) == NULL #ifdef FOREIGN_REG && fore[0] == 0 @@ -1321,18 +1336,18 @@ u_register(void) vmsg(errcode); } while (1) { - getfield(13, I18N[2355], I18N[2356], phone, 11); + getfield(13, gettext[2355], gettext[2356], phone, 11); if( (errcode = isvalidphone(phone)) == NULL ) break; else vmsg(errcode); } - getfield(15, I18N[2357], - I18N[2358], mobile, 20); + getfield(15, gettext[2357], + gettext[2358], mobile, 20); while (1) { int len; - getfield(17, I18N[2359], I18N[2360], birthday, 9); + getfield(17, gettext[2359], gettext[2360], birthday, 9); len = strlen(birthday); if (!len) { snprintf(birthday, 9, "%02i/%02i/%02i", @@ -1345,18 +1360,18 @@ u_register(void) day = (birthday[3] - '0') * 10 + (birthday[4] - '0'); year = (birthday[6] - '0') * 10 + (birthday[7] - '0'); } else{ - vmsg(I18N[2361]); + vmsg(gettext[2361]); continue; } if (mon > 12 || mon < 1 || day > 31 || day < 1 || year > 90 || year < 40){ - vmsg(I18N[2362]); + vmsg(gettext[2362]); continue; } break; } - getfield(19, I18N[2363], I18N[2364], sex_is, 2); - getdata(20, 0, I18N[2365], + getfield(19, gettext[2363], gettext[2364], sex_is, 2); + getdata(20, 0, gettext[2365], ans, 3, LCECHO); if (ans[0] == 'q') return 0; @@ -1386,7 +1401,7 @@ u_register(void) clear(); move(9, 3); - prints(I18N[2366]); + prints(gettext[2366]); pressanykey(); cuser.userlevel |= PERM_POST; brc_initial_board("WhoAmI"); @@ -1410,9 +1425,9 @@ u_list_CB(int num, userec_t * uentp) if (uentp == NULL) { move(2, 0); clrtoeol(); - prints(I18N[2367], - I18N[2368], - HAS_PERM(PERM_SEEULEVELS) ? I18N[2369] : ""); + prints(gettext[2367], + gettext[2368], + HAS_PERM(PERM_SEEULEVELS) ? gettext[2369] : ""); i = 3; return 0; } @@ -1423,7 +1438,7 @@ u_list_CB(int num, userec_t * uentp) return 0; if (i == b_lines) { - prints(I18N[2370], + prints(gettext[2370], usercounter, totalusers, usercounter * 100 / totalusers); i = igetch(); if (i == 'q' || i == 'Q') @@ -1477,7 +1492,7 @@ u_list() u_list_special = usercounter = 0; totalusers = SHM->number; if (HAS_PERM(PERM_SEEULEVELS)) { - getdata(b_lines - 1, 0, I18N[2371], + getdata(b_lines - 1, 0, gettext[2371], genbuf, 3, DOECHO); if (genbuf[0] != '2') u_list_special = PERM_BASIC | PERM_CHAT | PERM_PAGE | PERM_POST | PERM_LOGINOK | PERM_BM; @@ -1489,7 +1504,7 @@ u_list() } move(b_lines, 0); clrtoeol(); - prints(I18N[2372], usercounter, totalusers); + prints(gettext[2372], usercounter, totalusers); igetch(); return 0; } diff --git a/mbbsd/var.c b/mbbsd/var.c index 45fb71ac..111e1fad 100644 --- a/mbbsd/var.c +++ b/mbbsd/var.c @@ -637,3 +637,6 @@ char reentrant_write_request = 0; #else #define COMMON_TIME (now) #endif + +/* I18N */ +char **gettext; diff --git a/mbbsd/vice.c b/mbbsd/vice.c index d1a3fb9e..f9e3737d 100644 --- a/mbbsd/vice.c +++ b/mbbsd/vice.c @@ -106,7 +106,7 @@ vice_main() i = 0; move(10, 24); clrtoeol(); - prints(SHM->i18nstr[cuser.language][2373]); + prints(gettext[2373]); while (fgets(serial, 15, fd)) { if ((ptr = strchr(serial, '\r'))) *ptr = 0; @@ -119,27 +119,27 @@ vice_main() j += 9; j %= 45; } - getdata(8, 0, SHM->i18nstr[cuser.language][2374], + getdata(8, 0, gettext[2374], ch, sizeof(ch), LCECHO); if (ch[0] != 'c' || lockutmpmode(VICE, LOCK_MULTI)) { fclose(fd); return 0; } - showtitle(SHM->i18nstr[cuser.language][2375], BBSNAME); + showtitle(gettext[2375], BBSNAME); rewind(fd); while (fgets(serial, 15, fd)) { if ((ptr = strchr(serial, '\n'))) *ptr = 0; money = TABLE[check(tbingo, serial)]; total += money; - prints(SHM->i18nstr[cuser.language][2376], serial, money); + prints(gettext[2376], serial, money); } pressanykey(); if (total > 0) { ran_showmfile(VICE_WIN, MAX_WIN_PICTURE); move(22, 0); clrtoeol(); - prints(SHM->i18nstr[cuser.language][2377], total); + prints(gettext[2377], total); demoney(total); } else ran_showmfile(VICE_LOST, MAX_LOST_PICTURE); diff --git a/mbbsd/vote.c b/mbbsd/vote.c index e342e2f8..abf552d2 100644 --- a/mbbsd/vote.c +++ b/mbbsd/vote.c @@ -162,8 +162,8 @@ vote_report(char *bname, char *fname, char *fpath) /* append record to .DIR */ memset(&header, 0, sizeof(fileheader_t)); - strlcpy(header.owner, I18N[2378], sizeof(header.owner)); - snprintf(header.title, sizeof(header.title), I18N[2379], bname); + strlcpy(header.owner, gettext[2378], sizeof(header.owner)); + snprintf(header.title, sizeof(header.title), gettext[2379], bname); { register struct tm *ptime = localtime(&dtime); @@ -261,10 +261,10 @@ b_result_one(boardheader_t * fh, int ind, int *total) if ((xfp = fopen(buf, "r"))) { fgets(inbuf, sizeof(inbuf), xfp); - fprintf(tfp, I18N[2380], msg_seperator, inbuf); + fprintf(tfp, gettext[2380], msg_seperator, inbuf); fclose(xfp); } - fprintf(tfp, I18N[2381], + fprintf(tfp, gettext[2381], msg_seperator, ctime(&closetime)); fh->vtime = now; @@ -276,13 +276,13 @@ b_result_one(boardheader_t * fh, int ind, int *total) if ((cfp = fopen(b_control, "r"))) { fgets(inbuf, sizeof(inbuf), cfp); fgets(inbuf, sizeof(inbuf), cfp); - fprintf(tfp, I18N[2382], + fprintf(tfp, gettext[2382], people_num, junk); - fprintf(tfp, I18N[2383]); + fprintf(tfp, gettext[2383]); for (junk = 0; junk < item_num; junk++) { fgets(inbuf, sizeof(inbuf), cfp); inbuf[(strlen(inbuf) - 1)] = '\0'; - fprintf(tfp, I18N[2384], inbuf + 3, counts[junk], + fprintf(tfp, gettext[2384], inbuf + 3, counts[junk], (float)(counts[junk] * 100) / (float)(people_num), (float)(counts[junk] * 100) / (float)(*total)); } @@ -291,12 +291,12 @@ b_result_one(boardheader_t * fh, int ind, int *total) unlink(b_control); free(counts); - fprintf(tfp, I18N[2385], msg_seperator); + fprintf(tfp, gettext[2385], msg_seperator); setbfile(buf, bname, STR_new_comments); b_suckinfile(tfp, buf); unlink(buf); - fprintf(tfp, I18N[2386], msg_seperator, *total); + fprintf(tfp, gettext[2386], msg_seperator, *total); fclose(tfp); setbfile(b_report, bname, "report"); @@ -437,7 +437,7 @@ vote_view(char *bname, int vote_index) if ((fp = fopen(buf, "r"))) { fgets(inbuf, sizeof(inbuf), fp); - prints(I18N[2387], inbuf); + prints(gettext[2387], inbuf); fclose(fp); } setbfile(buf, bname, STR_new_control); @@ -449,12 +449,12 @@ vote_view(char *bname, int vote_index) fscanf(fp, "%hd,%hd\n%lu\n", &item_num, &i, &closetime); counts = (int *)malloc(item_num * sizeof(int)); - prints(I18N[2388], atoi(inbuf), (num / sizeof(short)), + prints(gettext[2388], atoi(inbuf), (num / sizeof(short)), ctime(&closetime)); /* Thor: 開放 票數 預知 */ setbfile(buf, bname, STR_new_flags); - prints(I18N[2389], b_nonzeroNum(buf)); + prints(gettext[2389], b_nonzeroNum(buf)); setbfile(buf, bname, STR_new_ballots); #if 0 // backward compatible @@ -471,7 +471,7 @@ vote_view(char *bname, int vote_index) inbuf[(strlen(inbuf) - 1)] = '\0'; inbuf[30] = '\0'; /* truncate */ move(num % 15 + 6, num / 15 * 40); - prints(I18N[2390], inbuf, counts[i]); + prints(gettext[2390], inbuf, counts[i]); total += counts[i]; if (num == 29) { num = -1; @@ -485,8 +485,8 @@ vote_view(char *bname, int vote_index) pos = getbnum(bname); fhp = bcache + pos - 1; move(t_lines - 3, 0); - prints(I18N[2391], total); - getdata(b_lines - 1, 0, I18N[2392], genbuf, + prints(gettext[2391], total); + getdata(b_lines - 1, 0, gettext[2392], genbuf, 4, LCECHO); if (genbuf[0] == 'a') { setbfile(buf, bname, STR_new_control); @@ -543,7 +543,7 @@ vote_view_all(char *bname) fgets(inbuf, sizeof(inbuf), xfp); fclose(xfp); } else - strlcpy(inbuf, I18N[2393], sizeof(inbuf)); + strlcpy(inbuf, gettext[2393], sizeof(inbuf)); prints("%s\n", inbuf); } for (i = 1; i < 20; i++) { @@ -562,14 +562,14 @@ vote_view_all(char *bname) fgets(inbuf, sizeof(inbuf), xfp); fclose(xfp); } else - strlcpy(inbuf, I18N[2394], sizeof(inbuf)); + strlcpy(inbuf, gettext[2394], sizeof(inbuf)); prints("%s\n", inbuf); } } if (x < 0) return FULLUPDATE; - snprintf(buf, sizeof(buf), I18N[2395], x); + snprintf(buf, sizeof(buf), gettext[2395], x); getdata(b_lines - 1, 0, buf, genbuf, 4, LCECHO); @@ -605,13 +605,13 @@ vote_maintain(char *bname) if ((pos = getbnum(bname)) <= 0) return 0; - stand_title(I18N[2396]); + stand_title(gettext[2396]); fhp = bcache + pos - 1; /* CharlieL */ if (fhp->bvote != 2 && fhp->bvote != 0) { getdata(b_lines - 1, 0, - I18N[2397], + gettext[2397], genbuf, 4, LCECHO); if (genbuf[0] == 'v') return vote_view_all(bname); @@ -698,22 +698,22 @@ vote_maintain(char *bname) } clear(); move(0, 0); - prints(I18N[2398], x); + prints(gettext[2398], x); setbfile(buf, bname, STR_new_title); - getdata(4, 0, I18N[2399], inbuf, 50, LCECHO); + getdata(4, 0, gettext[2399], inbuf, 50, LCECHO); if (inbuf[0] == '\0') - strlcpy(inbuf, I18N[2400], sizeof(inbuf)); + strlcpy(inbuf, gettext[2400], sizeof(inbuf)); fp = fopen(buf, "w"); assert(fp); fprintf(fp, "%s", inbuf); fclose(fp); - prints(I18N[2401]); + prints(gettext[2401]); pressanykey(); setbfile(buf, bname, STR_new_desc); aborted = vedit(buf, NA, NULL); if (aborted == -1) { - vmsg(I18N[2402]); + vmsg(gettext[2402]); return FULLUPDATE; } aborted = 0; @@ -721,13 +721,13 @@ vote_maintain(char *bname) unlink(buf); getdata(4, 0, - I18N[2403], + gettext[2403], inbuf, 2, LCECHO); setbfile(buf, bname, STR_new_limited); if (inbuf[0] == 'y') { fp = fopen(buf, "w"); assert(fp); - //fprintf(fp, I18N[2404]); + //fprintf(fp, gettext[2404]); fclose(fp); friend_edit(FRIEND_CANVOTE); } else { @@ -735,7 +735,7 @@ vote_maintain(char *bname) unlink(buf); } clear(); - getdata(0, 0, I18N[2405], inbuf, 4, DOECHO); + getdata(0, 0, gettext[2405], inbuf, 4, DOECHO); closetime = atoi(inbuf); if (closetime <= 0) @@ -749,7 +749,7 @@ vote_maintain(char *bname) assert(fp); fprintf(fp, "000,000\n%lu\n", closetime); - outs(I18N[2406]); + outs(gettext[2406]); num = 0; x = 0; /* x is the page number */ while (!aborted) { @@ -774,7 +774,7 @@ vote_maintain(char *bname) num = 0; } } - snprintf(buf, sizeof(buf), I18N[2407], x * 30 + num); + snprintf(buf, sizeof(buf), gettext[2407], x * 30 + num); getdata(t_lines - 3, 0, buf, inbuf, 3, DOECHO); @@ -799,7 +799,7 @@ vote_maintain(char *bname) if (substitute_record(fn_board, fhp, sizeof(*fhp), pos) == -1) outs(err_board_update); reset_board(pos); - outs(I18N[2408]); + outs(gettext[2408]); return FULLUPDATE; } @@ -872,22 +872,22 @@ user_vote_one(char *bname, int ind) setbfile(buf, bname, FN_CANVOTE); if (!belong(buf, cuser.userid)) { fclose(cfp); - vmsg(I18N[2409]); + vmsg(gettext[2409]); return FULLUPDATE; } else { - vmsg(I18N[2410]); + vmsg(gettext[2410]); more(buf, YEA); } } if (vote_flag(bname, ind, '\0')) { - vmsg(I18N[2411]); + vmsg(gettext[2411]); return FULLUPDATE; } setutmpmode(VOTING); setbfile(buf, bname, STR_new_desc); more(buf, YEA); - stand_title(I18N[2412]); + stand_title(gettext[2412]); if ((pos = getbnum(bname)) <= 0) return 0; @@ -903,7 +903,7 @@ user_vote_one(char *bname, int ind) memset(choices, 0, sizeof(choices)); max_page = (item_num - 1)/ 30 + 1; - prints(I18N[2413], + prints(gettext[2413], tickets, ctime(&closetime)); #define REDO_DRAW 1 @@ -938,14 +938,14 @@ user_vote_one(char *bname, int ind) vote[0] = vote[1] = '\0'; move(t_lines - 2, 0); - prints(I18N[2414], tickets - i); - getdata(t_lines - 4, 0, I18N[2415], vote, sizeof(vote), DOECHO); + prints(gettext[2414], tickets - i); + getdata(t_lines - 4, 0, gettext[2415], vote, sizeof(vote), DOECHO); *vote = toupper(*vote); #define CURRENT_CHOICE \ chosen[curr_page * 30 + vote[0] - 'A'] if (vote[0] == '0' || (!vote[0] && !i)) { - outs(I18N[2416]); + outs(gettext[2416]); break; } else if (vote[0] == '1' && i); else if (!vote[0]) @@ -987,11 +987,11 @@ user_vote_one(char *bname, int ind) } if (vote_flag(bname, ind, vote[0]) != 0) - prints(I18N[2417]); + prints(gettext[2417]); else { setbfile(buf, bname, STR_new_ballots); if ((fd = open(buf, O_WRONLY | O_CREAT | O_APPEND, 0600)) == 0) - outs(I18N[2418]); + outs(gettext[2418]); else { struct stat statb; char buf[3], mycomments[3][74], b_comments[80]; @@ -1008,18 +1008,18 @@ user_vote_one(char *bname, int ind) fstat(fd, &statb); close(fd); getdata(b_lines - 2, 0, - I18N[2419], + gettext[2419], buf, 3, DOECHO); if (buf[0] == 'Y' || buf[0] == 'y') { do { move(5, 0); clrtobot(); - outs(I18N[2420]); + outs(gettext[2420]); for (i = 0; (i < 3) && - getdata(7 + i, 0, I18N[2421], + getdata(7 + i, 0, gettext[2421], mycomments[i], sizeof(mycomments[i]), DOECHO); i++); - getdata(b_lines - 2, 0, I18N[2422], buf, 3, LCECHO); + getdata(b_lines - 2, 0, gettext[2422], buf, 3, LCECHO); } while (buf[0] == 'E' || buf[0] == 'e'); if (buf[0] == 'Q' || buf[0] == 'q') break; @@ -1027,7 +1027,7 @@ user_vote_one(char *bname, int ind) if (mycomments[0]) if ((fcm = fopen(b_comments, "a"))) { fprintf(fcm, - I18N[2423], + gettext[2423], cuser.userid); for (i = 0; i < 3; i++) fprintf(fcm, " %s\n", mycomments[i]); @@ -1036,7 +1036,7 @@ user_vote_one(char *bname, int ind) } } move(b_lines - 1, 0); - prints(I18N[2424]); + prints(gettext[2424]); } } break; @@ -1067,11 +1067,11 @@ user_vote(char *bname) clrtobot(); if (fhp->bvote == 2 || fhp->bvote == 0) { - vmsg(I18N[2425]); + vmsg(gettext[2425]); return FULLUPDATE; } if (!HAS_PERM(PERM_LOGINOK)) { - vmsg(I18N[2426]); + vmsg(gettext[2426]); return FULLUPDATE; } strlcpy(STR_new_control, STR_bv_control, sizeof(STR_new_control)); @@ -1088,7 +1088,7 @@ user_vote(char *bname) fgets(inbuf, sizeof(inbuf), xfp); fclose(xfp); } else - strlcpy(inbuf, I18N[2427], sizeof(inbuf)); + strlcpy(inbuf, gettext[2427], sizeof(inbuf)); prints("%s\n", inbuf); } for (i = 1; i < 20; i++) { @@ -1107,7 +1107,7 @@ user_vote(char *bname) fgets(inbuf, sizeof(inbuf), xfp); fclose(xfp); } else - strlcpy(inbuf, I18N[2428], sizeof(inbuf)); + strlcpy(inbuf, gettext[2428], sizeof(inbuf)); prints("%s\n", inbuf); } } @@ -1115,7 +1115,7 @@ user_vote(char *bname) if (x < 0) return FULLUPDATE; - snprintf(buf, sizeof(buf), I18N[2429], x); + snprintf(buf, sizeof(buf), gettext[2429], x); getdata(b_lines - 1, 0, buf, genbuf, 4, LCECHO); @@ -1145,7 +1145,7 @@ vote_results(char *bname) setbfile(buf, bname, STR_bv_results); if (more(buf, YEA) == -1) - vmsg(I18N[2430]); + vmsg(gettext[2430]); return FULLUPDATE; } diff --git a/mbbsd/voteboard.c b/mbbsd/voteboard.c index d2d568c5..199cc803 100644 --- a/mbbsd/voteboard.c +++ b/mbbsd/voteboard.c @@ -22,7 +22,7 @@ do_voteboardreply(fileheader_t * fhdr) clear(); if (!CheckPostPerm()) { move(5, 10); - prints(SHM->i18nstr[cuser.language][2457]); + prints(gettext[2457]); pressanykey(); return; } @@ -48,12 +48,12 @@ do_voteboardreply(fileheader_t * fhdr) } if (yes>3) prints(genbuf); - if (!strncmp(genbuf, SHM->i18nstr[cuser.language][2458], 12)) { + if (!strncmp(genbuf, gettext[2458], 12)) { ptr = strchr(genbuf, '('); assert(ptr); sscanf(ptr + 1, "%ld", &endtime); if (endtime < now) { - prints(SHM->i18nstr[cuser.language][2459]); + prints(gettext[2459]); pressanykey(); fclose(fi); return; @@ -64,8 +64,8 @@ do_voteboardreply(fileheader_t * fhdr) strtok(genbuf+4," \n"); if (!strncmp(genbuf + 4, cuser.userid, IDLEN)) { move(5, 10); - prints(SHM->i18nstr[cuser.language][2460]); - getdata(17, 0, SHM->i18nstr[cuser.language][2461], opnion, 3, LCECHO); + prints(gettext[2460]); + getdata(17, 0, gettext[2461], opnion, 3, LCECHO); if (opnion[0] != 'y') { fclose(fi); return; @@ -76,12 +76,12 @@ do_voteboardreply(fileheader_t * fhdr) } fclose(fi); do { - if (!getdata(19, 0, SHM->i18nstr[cuser.language][2462], opnion, 3, LCECHO)) { + if (!getdata(19, 0, gettext[2462], opnion, 3, LCECHO)) { return; } } while (opnion[0] != 'y' && opnion[0] != 'n'); - sprintf(genbuf, SHM->i18nstr[cuser.language][2463], - opnion[0] == 'y' ? SHM->i18nstr[cuser.language][2464] : SHM->i18nstr[cuser.language][2465]); + sprintf(genbuf, gettext[2463], + opnion[0] == 'y' ? gettext[2464] : gettext[2465]); if (!getdata_buf(20, 0, genbuf, reason, 35, DOECHO)) { return; } @@ -107,7 +107,7 @@ do_voteboardreply(fileheader_t * fhdr) } if (!endtime) { now += 14 * 24 * 60 * 60; - fprintf(fo, SHM->i18nstr[cuser.language][2466], now, ctime(&now)); + fprintf(fo, gettext[2466], now, ctime(&now)); now -= 14 * 24 * 60 * 60; } fprintf(fo, "%s", genbuf); @@ -120,7 +120,7 @@ do_voteboardreply(fileheader_t * fhdr) fprintf(fo, "%3d.%s", ++yes, genbuf + 4); } if (opnion[0] == 'y') - fprintf(fo, SHM->i18nstr[cuser.language][2467], ++yes, cuser.userid, reason, cuser.lasthost); + fprintf(fo, gettext[2467], ++yes, cuser.userid, reason, cuser.lasthost); fprintf(fo, "%s", genbuf); for(no=0; fgets(genbuf, sizeof(genbuf), fi);) { @@ -131,11 +131,11 @@ do_voteboardreply(fileheader_t * fhdr) fprintf(fo, "%3d.%s", ++no, genbuf + 4); } if (opnion[0] == 'n') - fprintf(fo, SHM->i18nstr[cuser.language][2468], ++no, cuser.userid, reason, cuser.lasthost); - fprintf(fo, SHM->i18nstr[cuser.language][2469]); - fprintf(fo, SHM->i18nstr[cuser.language][2470], yes, no); - fprintf(fo, "%s"BBSNAME"("MYHOSTNAME"%s", SHM->i18nstr[cuser.language][2471], - SHM->i18nstr[cuser.language][2472]); + fprintf(fo, gettext[2468], ++no, cuser.userid, reason, cuser.lasthost); + fprintf(fo, gettext[2469]); + fprintf(fo, gettext[2470], yes, no); + fprintf(fo, "%s"BBSNAME"("MYHOSTNAME"%s", gettext[2471], + gettext[2472]); flock(fd, LOCK_UN); close(fd); @@ -159,176 +159,176 @@ do_voteboard(int type) clear(); if (!CheckPostPerm()) { move(5, 10); - prints(SHM->i18nstr[cuser.language][2473]); + prints(gettext[2473]); pressanykey(); return FULLUPDATE; } move(0, 0); clrtobot(); - prints(SHM->i18nstr[cuser.language][2474]); - prints(SHM->i18nstr[cuser.language][2475]); - prints(SHM->i18nstr[cuser.language][2476]); + prints(gettext[2474]); + prints(gettext[2475]); + prints(gettext[2476]); move(4, 0); clrtobot(); - prints(SHM->i18nstr[cuser.language][2477]); + prints(gettext[2477]); if(type==0) - prints(SHM->i18nstr[cuser.language][2478]); + prints(gettext[2478]); do { - getdata(6, 0, SHM->i18nstr[cuser.language][2479], topic, 3, DOECHO); + getdata(6, 0, gettext[2479], topic, 3, DOECHO); temp = atoi(topic); } while (temp < 0 || temp > 9 || (type && temp>2)); switch (temp) { case 0: return FULLUPDATE; case 1: - if (!getdata(7, 0, SHM->i18nstr[cuser.language][2480], topic, 30, DOECHO)) + if (!getdata(7, 0, gettext[2480], topic, 30, DOECHO)) return FULLUPDATE; - snprintf(title, sizeof(title), "%s %s", SHM->i18nstr[cuser.language][2481], topic); + snprintf(title, sizeof(title), "%s %s", gettext[2481], topic); snprintf(genbuf, sizeof(genbuf), - "%s\n\n%s%s\n", SHM->i18nstr[cuser.language][2482], SHM->i18nstr[cuser.language][2483], topic); - strcat(genbuf, SHM->i18nstr[cuser.language][2484]); + "%s\n\n%s%s\n", gettext[2482], gettext[2483], topic); + strcat(genbuf, gettext[2484]); break; case 2: - if (!getdata(7, 0, SHM->i18nstr[cuser.language][2485], topic, 30, DOECHO)) + if (!getdata(7, 0, gettext[2485], topic, 30, DOECHO)) return FULLUPDATE; - snprintf(title, sizeof(title), "%s %s", SHM->i18nstr[cuser.language][2486], topic); + snprintf(title, sizeof(title), "%s %s", gettext[2486], topic); snprintf(genbuf, sizeof(genbuf), - "%s\n\n%s%s\n", SHM->i18nstr[cuser.language][2487], SHM->i18nstr[cuser.language][2488], topic); - strcat(genbuf, SHM->i18nstr[cuser.language][2489]); + "%s\n\n%s%s\n", gettext[2487], gettext[2488], topic); + strcat(genbuf, gettext[2489]); break; case 3: do { - if (!getdata(7, 0, SHM->i18nstr[cuser.language][2490], topic, IDLEN + 1, DOECHO)) + if (!getdata(7, 0, gettext[2490], topic, IDLEN + 1, DOECHO)) return FULLUPDATE; else if (invalid_brdname(topic)) - outs(SHM->i18nstr[cuser.language][2491]); + outs(gettext[2491]); else if (getbnum(topic) > 0) - outs(SHM->i18nstr[cuser.language][2492]); + outs(gettext[2492]); else break; } while (temp > 0); - snprintf(title, sizeof(title), SHM->i18nstr[cuser.language][2493], topic); + snprintf(title, sizeof(title), gettext[2493], topic); snprintf(genbuf, sizeof(genbuf), - "%s\n\n%s%s\n%s", SHM->i18nstr[cuser.language][2494], SHM->i18nstr[cuser.language][2495], topic, SHM->i18nstr[cuser.language][2496]); + "%s\n\n%s%s\n%s", gettext[2494], gettext[2495], topic, gettext[2496]); - if (!getdata(8, 0, SHM->i18nstr[cuser.language][2497], topic, 20, DOECHO)) + if (!getdata(8, 0, gettext[2497], topic, 20, DOECHO)) return FULLUPDATE; strcat(genbuf, topic); - strcat(genbuf, SHM->i18nstr[cuser.language][2498]); - if (!getdata(9, 0, SHM->i18nstr[cuser.language][2499], topic, 20, DOECHO)) + strcat(genbuf, gettext[2498]); + if (!getdata(9, 0, gettext[2499], topic, 20, DOECHO)) return FULLUPDATE; strcat(genbuf, topic); - strcat(genbuf, SHM->i18nstr[cuser.language][2500]); - getdata(10, 0, SHM->i18nstr[cuser.language][2501], topic, IDLEN * 3 + 3, DOECHO); + strcat(genbuf, gettext[2500]); + getdata(10, 0, gettext[2501], topic, IDLEN * 3 + 3, DOECHO); strcat(genbuf, topic); - strcat(genbuf, SHM->i18nstr[cuser.language][2502]); + strcat(genbuf, gettext[2502]); break; case 4: move(1,0); clrtobot(); - generalnamecomplete(SHM->i18nstr[cuser.language][2503], + generalnamecomplete(gettext[2503], topic, IDLEN+1, SHM->Bnumber, completeboard_compar, completeboard_permission, completeboard_getname); - snprintf(title, sizeof(title), SHM->i18nstr[cuser.language][2504], topic); + snprintf(title, sizeof(title), gettext[2504], topic); snprintf(genbuf, sizeof(genbuf), - "%s\n\n%s%s\n", SHM->i18nstr[cuser.language][2505], SHM->i18nstr[cuser.language][2506], topic); - strcat(genbuf, SHM->i18nstr[cuser.language][2507]); + "%s\n\n%s%s\n", gettext[2505], gettext[2506], topic); + strcat(genbuf, gettext[2507]); break; case 5: move(1,0); clrtobot(); - generalnamecomplete(SHM->i18nstr[cuser.language][2508], + generalnamecomplete(gettext[2508], topic, IDLEN+1, SHM->Bnumber, completeboard_compar, completeboard_permission, completeboard_getname); - snprintf(title, sizeof(title), SHM->i18nstr[cuser.language][2509], topic); - snprintf(genbuf, sizeof(genbuf), "%s\n\n%s%s\n%s%s", SHM->i18nstr[cuser.language][2510], SHM->i18nstr[cuser.language][2511], topic, SHM->i18nstr[cuser.language][2512], cuser.userid); - strcat(genbuf, SHM->i18nstr[cuser.language][2513]); + snprintf(title, sizeof(title), gettext[2509], topic); + snprintf(genbuf, sizeof(genbuf), "%s\n\n%s%s\n%s%s", gettext[2510], gettext[2511], topic, gettext[2512], cuser.userid); + strcat(genbuf, gettext[2513]); break; case 6: move(1,0); clrtobot(); - generalnamecomplete(SHM->i18nstr[cuser.language][2514], + generalnamecomplete(gettext[2514], topic, IDLEN+1, SHM->Bnumber, completeboard_compar, completeboard_permission, completeboard_getname); - snprintf(title, sizeof(title), SHM->i18nstr[cuser.language][2515], topic); + snprintf(title, sizeof(title), gettext[2515], topic); snprintf(genbuf, sizeof(genbuf), - "%s\n\n%s%s\n%s", SHM->i18nstr[cuser.language][2516], SHM->i18nstr[cuser.language][2517], - topic, SHM->i18nstr[cuser.language][2518]); + "%s\n\n%s%s\n%s", gettext[2516], gettext[2517], + topic, gettext[2518]); temp=getbnum(topic); do { - if (!getdata(7, 0, SHM->i18nstr[cuser.language][2519], topic, IDLEN + 1, DOECHO)) + if (!getdata(7, 0, gettext[2519], topic, IDLEN + 1, DOECHO)) return FULLUPDATE; }while (!userid_is_BM(topic, bcache[temp - 1].BM)); strcat(genbuf, topic); - strcat(genbuf, SHM->i18nstr[cuser.language][2520]); + strcat(genbuf, gettext[2520]); break; case 7: - if (!getdata(7, 0, SHM->i18nstr[cuser.language][2521], topic, 30, DOECHO)) + if (!getdata(7, 0, gettext[2521], topic, 30, DOECHO)) return FULLUPDATE; - snprintf(title, sizeof(title), SHM->i18nstr[cuser.language][2522], topic); + snprintf(title, sizeof(title), gettext[2522], topic); snprintf(genbuf, sizeof(genbuf), - "%s\n\n%s%s\n%s%s", SHM->i18nstr[cuser.language][2523], SHM->i18nstr[cuser.language][2524], - topic, SHM->i18nstr[cuser.language][2525], cuser.userid); - strcat(genbuf, SHM->i18nstr[cuser.language][2526]); + "%s\n\n%s%s\n%s%s", gettext[2523], gettext[2524], + topic, gettext[2525], cuser.userid); + strcat(genbuf, gettext[2526]); break; case 8: - if (!getdata(7, 0, SHM->i18nstr[cuser.language][2527], topic, 30, DOECHO)) + if (!getdata(7, 0, gettext[2527], topic, 30, DOECHO)) return FULLUPDATE; - snprintf(title, sizeof(title), SHM->i18nstr[cuser.language][2528], topic); + snprintf(title, sizeof(title), gettext[2528], topic); snprintf(genbuf, sizeof(genbuf), "%s\n\n%s%s\n%s", - SHM->i18nstr[cuser.language][2529], SHM->i18nstr[cuser.language][2530], topic, SHM->i18nstr[cuser.language][2531]); - if (!getdata(8, 0, SHM->i18nstr[cuser.language][2532], topic, IDLEN + 1, DOECHO)) + gettext[2529], gettext[2530], topic, gettext[2531]); + if (!getdata(8, 0, gettext[2532], topic, IDLEN + 1, DOECHO)) return FULLUPDATE; strcat(genbuf, topic); - strcat(genbuf, SHM->i18nstr[cuser.language][2533]); + strcat(genbuf, gettext[2533]); break; case 9: - if (!getdata(7, 0, SHM->i18nstr[cuser.language][2534], topic, 30, DOECHO)) + if (!getdata(7, 0, gettext[2534], topic, 30, DOECHO)) return FULLUPDATE; - snprintf(title, sizeof(title), SHM->i18nstr[cuser.language][2535], topic); + snprintf(title, sizeof(title), gettext[2535], topic); snprintf(genbuf, sizeof(genbuf), "%s\n\n%s%s\n%s%s", - SHM->i18nstr[cuser.language][2536], SHM->i18nstr[cuser.language][2537], topic, SHM->i18nstr[cuser.language][2538], cuser.userid); - strcat(genbuf, SHM->i18nstr[cuser.language][2539]); + gettext[2536], gettext[2537], topic, gettext[2538], cuser.userid); + strcat(genbuf, gettext[2539]); break; default: return FULLUPDATE; } - outs(SHM->i18nstr[cuser.language][2540]); + outs(gettext[2540]); for (temp = 12; temp < 17; temp++) { - if (!getdata(temp, 0, SHM->i18nstr[cuser.language][2541], topic, 60, DOECHO)) + if (!getdata(temp, 0, gettext[2541], topic, 60, DOECHO)) break; strcat(genbuf, topic); strcat(genbuf, "\n"); } if (temp == 11) return FULLUPDATE; - strcat(genbuf, SHM->i18nstr[cuser.language][2542]); + strcat(genbuf, gettext[2542]); now += 14 * 24 * 60 * 60; snprintf(topic, sizeof(topic), "(%ld)", now); strcat(genbuf, topic); strcat(genbuf, ctime(&now)); now -= 14 * 24 * 60 * 60; - strcat(genbuf, SHM->i18nstr[cuser.language][2543]); - strcat(genbuf, SHM->i18nstr[cuser.language][2544]); - outs(SHM->i18nstr[cuser.language][2545]); + strcat(genbuf, gettext[2543]); + strcat(genbuf, gettext[2544]); + outs(gettext[2545]); setbpath(fpath, currboard); stampfile(fpath, &votefile); if (!(fp = fopen(fpath, "w"))) { - outs(SHM->i18nstr[cuser.language][2546]); + outs(gettext[2546]); return FULLUPDATE; } - fprintf(fp, "%s%s %s%s\n%s%s\n%s%s", SHM->i18nstr[cuser.language][2547], cuser.userid, - SHM->i18nstr[cuser.language][2548], currboard, - SHM->i18nstr[cuser.language][2549], title, - SHM->i18nstr[cuser.language][2550], ctime(&now)); + fprintf(fp, "%s%s %s%s\n%s%s\n%s%s", gettext[2547], cuser.userid, + gettext[2548], currboard, + gettext[2549], title, + gettext[2550], ctime(&now)); fprintf(fp, "%s\n", genbuf); fclose(fp); strlcpy(votefile.owner, cuser.userid, sizeof(votefile.owner)); diff --git a/mbbsd/xyz.c b/mbbsd/xyz.c index 785d33e4..de0bd8cb 100644 --- a/mbbsd/xyz.c +++ b/mbbsd/xyz.c @@ -7,7 +7,7 @@ int x_90() { - use_dict(I18N[2431], "etc/90"); + use_dict(gettext[2431], "etc/90"); return 0; } @@ -15,21 +15,21 @@ x_90() int x_89() { - use_dict(I18N[2432], "etc/89"); + use_dict(gettext[2432], "etc/89"); return 0; } /* Ptt88年度大學聯招查榜系統 */ int x_88() { - use_dict(I18N[2433], "etc/88"); + use_dict(gettext[2433], "etc/88"); return 0; } /* Ptt87年度大學聯招查榜系統 */ int x_87() { - use_dict(I18N[2434], "etc/87"); + use_dict(gettext[2434], "etc/87"); return 0; } @@ -37,7 +37,7 @@ x_87() int x_86() { - use_dict(I18N[2435], "etc/86"); + use_dict(gettext[2435], "etc/86"); return 0; } @@ -180,7 +180,7 @@ note() notedata_t myitem; if (cuser.money < 5) { - vmsg(I18N[2436]); + vmsg(gettext[2436]); return 0; } setutmpmode(EDNOTE); @@ -188,11 +188,11 @@ note() myitem.buf[0][0] = myitem.buf[1][0] = myitem.buf[2][0] = '\0'; move(12, 0); clrtobot(); - outs(I18N[2437]); - for (i = 0; (i < 3) && getdata(16 + i, 0, I18N[2438], myitem.buf[i], + outs(gettext[2437]); + for (i = 0; (i < 3) && getdata(16 + i, 0, gettext[2438], myitem.buf[i], sizeof(myitem.buf[i]) - 5, DOECHO) && *myitem.buf[i]; i++); - getdata(b_lines - 1, 0, I18N[2439], + getdata(b_lines - 1, 0, gettext[2439], buf, 3, LCECHO); if (buf[0] == 'q' || (i == 0 && *buf != 'e')) @@ -226,33 +226,33 @@ note() if (total > MAX_NOTE) total = MAX_NOTE; } - fputs(I18N[2440], fp); + fputs(gettext[2440], fp); collect = 1; while (total) { - snprintf(buf, sizeof(buf), I18N[2441], + snprintf(buf, sizeof(buf), gettext[2441], myitem.userid, myitem.username); len = strlen(buf); for (i = len; i < 71; i++) strcat(buf, " "); - snprintf(buf2, sizeof(buf2), I18N[2442], + snprintf(buf2, sizeof(buf2), gettext[2442], Cdate(&(myitem.date))); strcat(buf, buf2); fputs(buf, fp); if (collect) fputs(buf, foo); for (i = 0; i < 3 && *myitem.buf[i]; i++) { - fprintf(fp, I18N[2443], + fprintf(fp, gettext[2443], myitem.buf[i]); if (collect) - fprintf(foo, I18N[2444], + fprintf(foo, gettext[2444], myitem.buf[i]); } - fputs(I18N[2445], fp); + fputs(gettext[2445], fp); if (collect) { - fputs(I18N[2446], foo); + fputs(gettext[2446], foo); fclose(foo); collect = 0; } @@ -261,7 +261,7 @@ note() if (--total) read(fd, (char *)&myitem, sizeof(myitem)); } - fputs(I18N[2447], fp); + fputs(gettext[2447], fp); fclose(fp); close(fd); close(fx); @@ -306,15 +306,13 @@ mail_sysop() move(12, 0); clrtobot(); - outs(I18N[2448]); - outs(I18N[2449]); - outs(I18N[2450]); + outs(gettext[2448]); for (i = 0; i < j; i++) prints("%15d. \033[1;%dm%-16s%s\033[0m\n", i + 1, 31 + i % 7, sysoplist[i].userid, sysoplist[i].duty); - prints(I18N[2451], "", 31 + j % 7); - getdata(b_lines - 1, 0, I18N[2452], + prints(gettext[2451], "", 31 + j % 7); + getdata(b_lines - 1, 0, gettext[2452], genbuf, 4, DOECHO); i = genbuf[0] - '0' - 1; if (i >= 0 && i < j) { @@ -349,7 +347,7 @@ Goodbye() char genbuf[100]; char genbuf1[100]; - snprintf(genbuf1, sizeof(genbuf1), "%s%s%s", I18N[2453], BBSNAME, I18N[2454]); + snprintf(genbuf1, sizeof(genbuf1), "%s%s%s", gettext[2453], BBSNAME, gettext[2454]); getdata(b_lines - 1, 0, genbuf1, genbuf, 3, LCECHO); @@ -359,7 +357,7 @@ Goodbye() movie(999); if (cuser.userlevel) { getdata(b_lines - 1, 0, - I18N[2455], + gettext[2455], genbuf, 3, LCECHO); if (genbuf[0] == 'm') mail_sysop(); @@ -368,7 +366,7 @@ Goodbye() } log_memoryusage(); clear(); - prints(I18N[2456], + prints(gettext[2456], cuser.userid, cuser.username, BBSName); user_display(&cuser, 0); pressanykey(); |