diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-13 03:35:18 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-13 03:35:18 +0800 |
commit | 4e1ad2af155038106cd14a7f5deeee5771b3a531 (patch) | |
tree | e813b8f55e370ac55aba06c310c648f7e3531a4e /mbbsd/edit.c | |
parent | 2ec15646e35a5a49bea7eff28963c906afc5fc16 (diff) | |
download | pttbbs-4e1ad2af155038106cd14a7f5deeee5771b3a531.tar pttbbs-4e1ad2af155038106cd14a7f5deeee5771b3a531.tar.gz pttbbs-4e1ad2af155038106cd14a7f5deeee5771b3a531.tar.bz2 pttbbs-4e1ad2af155038106cd14a7f5deeee5771b3a531.tar.lz pttbbs-4e1ad2af155038106cd14a7f5deeee5771b3a531.tar.xz pttbbs-4e1ad2af155038106cd14a7f5deeee5771b3a531.tar.zst pttbbs-4e1ad2af155038106cd14a7f5deeee5771b3a531.zip |
* fix bug: incorrect user's tmp buf filename.
* don't test upper case if getdata with LCECHO flag
* add some comment
* some small code revise
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4585 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/edit.c')
-rw-r--r-- | mbbsd/edit.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/mbbsd/edit.c b/mbbsd/edit.c index 75600d81..50facfb1 100644 --- a/mbbsd/edit.c +++ b/mbbsd/edit.c @@ -1084,17 +1084,18 @@ load_file(FILE * fp, off_t offSig) } /* 暫存檔 */ -char * +const char * ask_tmpbuf(int y) { - static char fp_buf[10] = "buf.0"; - static char msg[] = "請選擇暫存檔 (0-9)[0]: "; + static char fp_buf[] = "buf.0"; + char msg[] = "請選擇暫存檔 (0-9)[0]: "; + char choice[2]; msg[19] = fp_buf[4]; do { - if (!getdata(y, 0, msg, fp_buf + 4, 4, DOECHO)) - fp_buf[4] = msg[19]; - } while (fp_buf[4] < '0' || fp_buf[4] > '9'); + getdata(y, 0, msg, choice, sizeof(choice), DOECHO); + } while (choice[0] < '0' || choice[0] > '9'); + fp_buf[4] = choice[0]; return fp_buf; } @@ -1104,7 +1105,7 @@ read_tmpbuf(int n) FILE *fp; char fp_tmpbuf[80]; char tmpfname[] = "buf.0"; - char *tmpf; + const char *tmpf; char ans[4] = "y"; if (curr_buf->totaln >= EDIT_LINE_LIMIT) @@ -2009,26 +2010,28 @@ block_prompt(void) { char fp_tmpbuf[80]; char tmpfname[] = "buf.0"; - char mode[2]; + char mode[2] = "w"; + char choice[2]; move(b_lines - 1, 0); clrtoeol(); - if (!getdata(b_lines - 1, 0, "把區塊移至暫存檔 (0:Cut, 5:Copy, 6-9, q: Cancel)[0] ", tmpfname + 4, 4, LCECHO)) - tmpfname[4] = '0'; + if (!getdata(b_lines - 1, 0, "把區塊移至暫存檔 (0:Cut, 5:Copy, 6-9, q: Cancel)[0] ", choice, sizeof(choice), LCECHO)) + choice[0] = '0'; - if (tmpfname[4] < '0' || tmpfname[4] > '9') + if (choice[0] < '0' || choice[0] > '9') goto cancel_block; - if (tmpfname[4] == '0') { + if (choice[0] == '0') { block_cut(); return; } - else if (tmpfname[4] == '5') { + else if (choice[0] == '5') { block_copy(); return; } + tmpfname[4] = choice[0]; setuserfile(fp_tmpbuf, tmpfname); if (dashf(fp_tmpbuf)) { more(fp_tmpbuf, NA); @@ -3131,7 +3134,7 @@ insert_ansi_code(void) int ch = curr_buf->insert_mode; curr_buf->insert_mode = curr_buf->redraw_everything = YEA; if (!curr_buf->ansimode) - insert_string(reset_color); + insert_string(ANSI_RESET); else { char ans[4]; move(b_lines - 2, 55); @@ -3169,7 +3172,7 @@ insert_ansi_code(void) strcat(color, "m"); insert_string(color); } else - insert_string(reset_color); + insert_string(ANSI_RESET); } curr_buf->insert_mode = ch; } |