summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/pttstruct.h1
-rw-r--r--mbbsd/edit.c7
-rw-r--r--mbbsd/io.c15
-rw-r--r--mbbsd/record.c2
-rw-r--r--mbbsd/user.c23
5 files changed, 38 insertions, 10 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h
index c282d972..cb2049fd 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -118,6 +118,7 @@ typedef struct userec_t {
/* useless flag */
//#define COLOR_FLAG 0x80 /* true if the color mode open */
//#define MIND_FLAG 0x100 /* true if mind search mode open <-Heat*/
+#define RAWDBCS_FLAG 0x200 /* true if rawmode instead of DBCS-aware */
/* these are flags in userec_t.uflag2 */
#define WATER_MASK 000003 /* water mask */
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index dea2ffa7..c0bab9c4 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -213,7 +213,6 @@ static const char *table_mode[6] = {
};
#ifdef DBCSAWARE_EDIT
-
static char mbcs_mode =1;
#define IS_BIG5_HI(x) (0x81 <= (x) && (x) <= 0xfe)
@@ -1896,7 +1895,7 @@ display_textline_internal(textline_t *p, int i, int min, int max)
newpnt = fix_cursor(p->data, newpnt, FC_LEFT);
if(newpnt == curr_buf->edit_margin-1)
{
- (*output)(" ");
+ (*output)("\033[1m\033[m");
pdata++;
}
(*output)(pdata);
@@ -2477,6 +2476,10 @@ vedit(char *fpath, int saveheader, int *islocal)
currutmp->mode = EDITING;
currutmp->destuid = currstat;
+#ifdef DBCSAWARE_EDIT
+ mbcs_mode = !(cuser.uflag & RAWDBCS_FLAG);
+#endif
+
enter_edit_buffer();
curr_buf->oldcurrline = curr_buf->currline = curr_buf->top_of_win =
diff --git a/mbbsd/io.c b/mbbsd/io.c
index 0b9a7f53..26201c7c 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -531,6 +531,8 @@ strip_nonebig5(unsigned char *str, int maxlen)
#ifdef DBCSAWARE_GETDATA
+#define ISDBCSAWARE() (!(cuser.uflag & RAWDBCS_FLAG))
+
int getDBCSstatus(unsigned char *s, int pos)
{
int sts = DBCS_ASCII;
@@ -635,6 +637,7 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
--currchar;
#ifdef DBCSAWARE_GETDATA
if(currchar > 0 &&
+ ISDBCSAWARE() &&
getDBCSstatus(buf, currchar) == DBCS_TRAILING)
currchar --;
#endif
@@ -646,6 +649,7 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
++currchar;
#ifdef DBCSAWARE_GETDATA
if(buf[currchar] &&
+ ISDBCSAWARE() &&
getDBCSstatus(buf, currchar) == DBCS_TRAILING)
currchar++;
#endif
@@ -655,7 +659,10 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
case Ctrl('H'):
if (currchar) {
#ifdef DBCSAWARE_GETDATA
- int dbcs_off = (getDBCSstatus(buf, currchar-1) == DBCS_TRAILING) ? 2 : 1;
+ int dbcs_off = 1;
+ if (ISDBCSAWARE() &&
+ getDBCSstatus(buf, currchar-1) == DBCS_TRAILING)
+ dbcs_off = 2;
#endif
currchar -= dbcs_off;
clen -= dbcs_off;
@@ -684,8 +691,10 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
case KEY_DEL:
if (buf[currchar]) {
#ifdef DBCSAWARE_GETDATA
- int dbcs_off = (buf[currchar+1] &&
- getDBCSstatus(buf, currchar+1) == DBCS_TRAILING) ? 2 : 1;
+ int dbcs_off = 1;
+ if (ISDBCSAWARE() && buf[currchar+1] &&
+ getDBCSstatus(buf, currchar+1) == DBCS_TRAILING)
+ dbcs_off = 2;
#endif
clen -= dbcs_off;
for (i = currchar; i <= clen; i++)
diff --git a/mbbsd/record.c b/mbbsd/record.c
index 47eae492..7d57e471 100644
--- a/mbbsd/record.c
+++ b/mbbsd/record.c
@@ -480,7 +480,7 @@ stampfile(char *fpath, fileheader_t * fh)
#ifdef _BBS_UTIL_C_
do {
#endif
- sprintf(ip, "M.%d.A.%3.3X", (int)++dtime, random() & 0xFFF);
+ sprintf(ip, "M.%d.A.%3.3X", (int)(++dtime), (unsigned int)(random() & 0xFFF));
#ifdef _BBS_UTIL_C_
if (fp == -1 && errno != EEXIST)
return -1;
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 5702b880..6a0a9047 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -278,6 +278,7 @@ static void Customize(void)
memcpy(mindbuf, &currutmp->mind, 4);
mindbuf[4] = 0;
while( !done ){
+ char maxc = 'A';
move(2, 0);
outs("您目前的個人化設定: ");
move(4, 0);
@@ -288,16 +289,24 @@ static void Customize(void)
((cuser.uflag2 & FAVNEW_FLAG) ? "是" : "否"));
prints("%-30s%10s\n", "D. 目前的心情", mindbuf);
prints("%-30s%10s\n", "E. 高亮度顯示我的最愛",
- ((cuser.uflag2 & FAVNOHILIGHT) ? "否" : "是"));
+ (!(cuser.uflag2 & FAVNOHILIGHT) ? "是" : "否"));
+ maxc = 'E';
+
#ifdef PLAY_ANGEL
if( HAS_PERM(PERM_ANGEL) ){
prints("%-30s%10s\n", "F. 開放小主人詢問",
(REJECT_QUESTION ? "否" : "是"));
prints("%-30s%10s\n", "G. 接受的小主人性別", am[ANGEL_STATUS()]);
- key = getkey("請按 [A-G] 切換設定,按 [Return] 結束:");
- }else
+ maxc = 'G';
+ }
+#endif
+
+#if defined(DBCSAWARE_GETDATA) || defined(DBCSAWARE_EDIT)
+ prints("%-30s%10s\n", "H. 自動偵測全型中文",
+ (!(cuser.uflag & RAWDBCS_FLAG) ? "是" : "否"));
+ maxc = 'H';
#endif
- key = getkey("請按 [A-E] 切換設定,按 [Return] 結束:");
+ key = getkey("請按 [A-%c] 切換設定,按 [Return] 結束:", maxc);
switch (key) {
case 'a':{
@@ -345,6 +354,12 @@ static void Customize(void)
}
#endif
+#if defined(DBCSAWARE_GETDATA) || defined(DBCSAWARE_EDIT)
+ case 'h':
+ cuser.uflag ^= RAWDBCS_FLAG;
+ break;
+#endif
+
default:
done = 1;
}