summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/proto.h2
-rw-r--r--include/visio.h23
-rw-r--r--mbbsd/admin.c8
-rw-r--r--mbbsd/announce.c6
-rw-r--r--mbbsd/assess.c4
-rw-r--r--mbbsd/bbs.c22
-rw-r--r--mbbsd/board.c16
-rw-r--r--mbbsd/cal.c12
-rw-r--r--mbbsd/chess.c4
-rw-r--r--mbbsd/chicken.c4
-rw-r--r--mbbsd/edit.c2
-rw-r--r--mbbsd/io.c30
-rw-r--r--mbbsd/mail.c2
-rw-r--r--mbbsd/mbbsd.c6
-rw-r--r--mbbsd/pfterm.c46
-rw-r--r--mbbsd/pmore.c45
-rw-r--r--mbbsd/read.c6
-rw-r--r--mbbsd/register.c6
-rw-r--r--mbbsd/stuff.c33
-rw-r--r--mbbsd/talk.c4
-rw-r--r--mbbsd/user.c18
-rw-r--r--mbbsd/visio.c98
22 files changed, 250 insertions, 147 deletions
diff --git a/include/proto.h b/include/proto.h
index 674fea53..91b8ddd2 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -604,8 +604,6 @@ int search_aidu(char *bfile, aidu_t aidu);
int log_user(const char *fmt, ...) GCC_CHECK_FORMAT(1,2);
time4_t gettime(int line, time4_t dt, const char* head);
void setcalfile(char *buf, char *userid);
-char getans(const char *fmt,...) GCC_CHECK_FORMAT(1,2);
-int getkey(const char *fmt,...) GCC_CHECK_FORMAT(1,2);
int show_file(const char *filename, int y, int lines, int mode);
int cursor_key(int row, int column);
int search_num(int ch, int max);
diff --git a/include/visio.h b/include/visio.h
index 06b78907..aafcd0af 100644
--- a/include/visio.h
+++ b/include/visio.h
@@ -3,8 +3,10 @@
#define _VISIO_H
/*
- * visio.c
- * High-level virtual screen input output control
+ * visio.h
+ * piaip's new implementation of visio
+ *
+ * see visio.c for license, usage, and introduction.
*/
#include "bbs.h"
@@ -37,19 +39,19 @@
#define VCOL_MAXW (INT16_MAX)
#define VFILL_DEFAULT (0x00)
-#define VFILL_NO_ANSI VFILL_DEFAULT
+// #define VFILL_NO_ANSI VFILL_DEFAULT
#define VFILL_HAS_ANSI (0x01)
-#define VVILL_LEFT_ALIGN VFILL_DEFAULT
+// #define VVILL_LEFT_ALIGN VFILL_DEFAULT
#define VFILL_RIGHT_ALIGN (0x02)
-#define VFILL_HAS_BORDER VFILL_DEFAULT
+// #define VFILL_HAS_BORDER VFILL_DEFAULT
#define VFILL_NO_BORDER (0x08)
#define VGET_DEFAULT (0x00)
-#define VGET_DOECHO (VGET_DEFAULT)
+// #define VGET_DOECHO (VGET_DEFAULT)
#define VGET_NOECHO (0x01)
#define VGET_LOWERCASE (0x02)
#define VGET_DIGITS (0x04)
-#define VGET_GCARRY (0x08)
+#define VGET_TRANSPARENT (0x08)
// DATATYPE DEFINITION -------------------------------------------------
typedef void * VREFSCR;
@@ -69,6 +71,13 @@ typedef struct {
} VCOL;
+typedef int (*VGET_CALLBACK)(char *buf, int *pcurr, int len, void *ptr);
+typedef struct {
+ VGET_CALLBACK peek; // called immediately after key hit
+ VGET_CALLBACK accept; // called before inserting character data
+ // ... ?
+} VGET_EXTENSION;
+
// API DEFINITION ----------------------------------------------------
// curses flavor
diff --git a/mbbsd/admin.c b/mbbsd/admin.c
index 7d1118f3..66aec48a 100644
--- a/mbbsd/admin.c
+++ b/mbbsd/admin.c
@@ -70,7 +70,7 @@ static int retrieve_backup(userec_t *user)
return 0;
}
- ans = getans("目前的 PASSWD 檔沒有此 ID,新增嗎?[y/N]");
+ ans = vans("目前的 PASSWD 檔沒有此 ID,新增嗎?[y/N]");
if (ans != 'y') {
vmsg("目前的 PASSWDS 檔沒有此 ID,請先新增此帳號");
@@ -285,7 +285,7 @@ setperms(unsigned int pbits, const char * const pstring[])
}
clrtobot();
while (
- (i = getkey("請按 [A-5] 切換設定,按 [Return] 結束:"))!='\r')
+ (i = vmsg("請按 [A-5] 切換設定,按 [Return] 結束:"))!='\r')
{
if (isdigit(i))
i = i - '0' + 26;
@@ -493,7 +493,7 @@ m_mod_board(char *bname)
if (HasUserPerm(PERM_SYSOP)) {
char frombname[20], fromdir[PATHLEN];
#ifdef MERGEBBS
- if(getans("是否匯入SOB看板? (y/N)")=='y')
+ if(vans("是否匯入SOB看板? (y/N)")=='y')
{
setbdir(genbuf, bname);
m_sob_brd(bname, fromdir);
@@ -821,7 +821,7 @@ x_file(void)
case 'd':
strlcpy(buf, entries[sel], sizeof(buf));
v = strchr(buf, ' '); *v++ = 0;
- i = getans("確定要刪除 %s 嗎? (y/N) ", v);
+ i = vansf("確定要刪除 %s 嗎? (y/N) ", v);
if (i == 'y')
unlink(buf);
vmsgf("系統檔案[%s]: %s", buf, !dashf(buf) ?
diff --git a/mbbsd/announce.c b/mbbsd/announce.c
index 0a592630..4d785908 100644
--- a/mbbsd/announce.c
+++ b/mbbsd/announce.c
@@ -108,7 +108,7 @@ int copyqueue_toggle(CopyQueue *pcq)
if(i >= 0)
{
#if 0
- if (getans("已標記過此檔,要取消標記嗎 [y/N]: ") != 'y')
+ if (vans("已標記過此檔,要取消標記嗎 [y/N]: ") != 'y')
return 1;
#endif
/* remove it */
@@ -1440,7 +1440,7 @@ void BlogMain(int num)
"\n"
"C.建立部落格目錄 (您只有第一次時需要)\n"
);
- switch( getans("請選擇(0-5,C)?[0]") ){
+ switch( vans("請選擇(0-5,C)?[0]") ){
case '1':
snprintf(genbuf, sizeof(genbuf),
"bin/builddb.pl -c %s", currboard);
@@ -1469,7 +1469,7 @@ void BlogMain(int num)
break;
}
if( hash[0] != 0 &&
- getans("請確定刪除(Y/N)?[N] ") == 'y' ){
+ vans("請確定刪除(Y/N)?[N] ") == 'y' ){
MYSQL mysql;
char cmd[PATHLEN];
diff --git a/mbbsd/assess.c b/mbbsd/assess.c
index f7b05bb0..172181f3 100644
--- a/mbbsd/assess.c
+++ b/mbbsd/assess.c
@@ -86,7 +86,7 @@ u_fixgoodpost(void)
"另外,若有多重登入請先關閉其它連線。\n"
"\n");
outs("如果一切都準備好了,請按下 y 開始,或其它任意鍵跳出。\n\n");
- if (getans("優文的資料都查好了嗎?") != 'y')
+ if (vans("優文的資料都查好了嗎?") != 'y')
{
vmsg("跳出修正程式。");
return 0;
@@ -106,7 +106,7 @@ u_fixgoodpost(void)
bname, sizeof(bname), DOECHO))
{
move(5, 0);
- if (getans(ANSI_COLOR(1;33)"確定全部輸入完成了嗎? "
+ if (vans(ANSI_COLOR(1;33)"確定全部輸入完成了嗎? "
ANSI_RESET "[y/N]: ") != 'y')
continue;
endinput = 1; break;
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index dcd485f4..d1f3e4fd 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1391,7 +1391,7 @@ do_reply(/*const*/ fileheader_t * fhdr)
vmsg("很抱歉, 此文章已結案並標記, 不得回應.");
return FULLUPDATE;
}
- if(getkey("此篇文章已結案, 是否真的要回應?(y/N)")!='y')
+ if(vmsg("此篇文章已結案, 是否真的要回應?(y/N)")!='y')
return FULLUPDATE;
}
@@ -1630,7 +1630,7 @@ edit_post(int ent, fileheader_t * fhdr, const char *direct)
"您可以選擇直接覆蓋\檔案(y)、放棄(n),\n"
" 或是" ANSI_COLOR(1)"重新編輯" ANSI_RESET
"(新文會被貼到剛編的檔案後面)(e)。\n");
- c = tolower(getans("要直接覆蓋\檔案/取消/重編嗎 [Y/n/e]?"));
+ c = tolower(vans("要直接覆蓋\檔案/取消/重編嗎 [Y/n/e]?"));
if (c == 'n')
break;
@@ -2138,7 +2138,7 @@ do_limitedit(int ent, fileheader_t * fhdr, const char *direct)
if (fhdr->filemode & FILE_VOTE)
strcat(buf, " (C)本篇");
strcat(buf, "連署限制 (Q)取消?[Q]");
- buf[0] = getans(buf);
+ buf[0] = vans(buf);
if ((HasUserPerm(PERM_SYSOP) || (HasUserPerm(PERM_SYSSUPERSUBOP) && GROUPOP())) && buf[0] == 'a') {
@@ -2555,7 +2555,7 @@ do_bid(int ent, fileheader_t * fhdr, const boardheader_t *bp,
prints("恭喜 %s 以 %d 得標!", bidinfo.userid, bidinfo.high);
#ifdef ASSESS
if (!(bidinfo.flag & SALE_COMMENTED) && strcmp(bidinfo.userid, currutmp->userid) == 0){
- char tmp = getans("您對於這次交易的評價如何? 1:佳 2:欠佳 3:普通[Q]");
+ char tmp = vans("您對於這次交易的評價如何? 1:佳 2:欠佳 3:普通[Q]");
if ('1' <= tmp && tmp <= '3'){
switch(tmp){
case 1:
@@ -2929,7 +2929,7 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
#if defined(PLAY_ANGEL) && defined(BN_ANGELPRAY) && defined(ANGEL_ANONYMOUS_COMMENT)
if (HasUserPerm(PERM_ANGEL) && currboard && strcmp(currboard, BN_ANGELPRAY) == 0 &&
- getans("要使用小天使暱名推文嗎? [Y/n]: ") != 'n')
+ vans("要使用小天使暱名推文嗎? [Y/n]: ") != 'n')
{
// angel push
mynick[0] = 0;
@@ -3372,7 +3372,7 @@ lock_post(int ent, fileheader_t * fhdr, const char *direct)
getdata(b_lines - 1, 0, "請輸入鎖定理由:", genbuf, 50, DOECHO);
- if (getans("要將文章鎖定嗎(y/N)?") != 'y')
+ if (vans("要將文章鎖定嗎(y/N)?") != 'y')
return FULLUPDATE;
setbfile(fn1, currboard, fhdr->filename);
fhdr->filename[0] = 'L';
@@ -3380,7 +3380,7 @@ lock_post(int ent, fileheader_t * fhdr, const char *direct)
bp->SRexpire = now;
}
else if (fhdr->filename[0]=='L') {
- if (getans("要將文章鎖定解除嗎(y/N)?") != 'y')
+ if (vans("要將文章鎖定解除嗎(y/N)?") != 'y')
return FULLUPDATE;
fhdr->filename[0] = 'M';
setbfile(fn1, currboard, fhdr->filename);
@@ -3721,7 +3721,7 @@ push_bottom(int ent, fileheader_t *fhdr, const char *direct)
return DONOTHING;
setbottomtotal(currbid); // <- Ptt : will be remove when stable
num = getbottomtotal(currbid);
- if( getans(fhdr->filemode & FILE_BOTTOM ?
+ if( vans(fhdr->filemode & FILE_BOTTOM ?
"取消置底公告?(y/N)":
"加入置底公告?(y/N)") != 'y' )
return READ_REDRAW;
@@ -3755,7 +3755,7 @@ good_post(int ent, fileheader_t * fhdr, const char *direct)
if ((currmode & MODE_DIGEST) || !(currmode & MODE_BOARD))
return DONOTHING;
- if(getans(fhdr->filemode & FILE_DIGEST ?
+ if(vans(fhdr->filemode & FILE_DIGEST ?
"取消看板文摘?(Y/n)" : "收入看板文摘?(Y/n)") == 'n')
return READ_REDRAW;
@@ -3883,13 +3883,13 @@ change_cooldown(void)
return DONOTHING;
if (bp->brdattr & BRD_COOLDOWN) {
- if (getans("目前降溫中, 要開放嗎(y/N)?") != 'y')
+ if (vans("目前降溫中, 要開放嗎(y/N)?") != 'y')
return FULLUPDATE;
bp->brdattr &= ~BRD_COOLDOWN;
outs("大家都可以 post 文章了。\n");
} else {
getdata(b_lines - 1, 0, "請輸入冷靜理由:", genbuf, 50, DOECHO);
- if (getans("要限制 post 頻率, 降溫嗎(y/N)?") != 'y')
+ if (vans("要限制 post 頻率, 降溫嗎(y/N)?") != 'y')
return FULLUPDATE;
bp->brdattr |= BRD_COOLDOWN;
outs("開始冷靜。\n");
diff --git a/mbbsd/board.c b/mbbsd/board.c
index 8b39918c..4cb8fe58 100644
--- a/mbbsd/board.c
+++ b/mbbsd/board.c
@@ -543,7 +543,7 @@ b_config(void)
return FULLUPDATE;
}
- switch(tolower(getans("請輸入要改變的設定, 其它鍵結束: ")))
+ switch(tolower(vans("請輸入要改變的設定, 其它鍵結束: ")))
{
#ifdef USE_AUTOCPLOG
case 'x':
@@ -1310,7 +1310,7 @@ paste_taged_brds(int gid)
int bid, tmp;
if (gid == 0 || ! (HasUserPerm(PERM_SYSOP) || GROUPOP()) ||
- getans("貼上標記的看板?(y/N)")!='y') return 0;
+ vans("貼上標記的看板?(y/N)")!='y') return 0;
fav = get_fav_root();
for (tmp = 0; tmp < fav->DataTail; tmp++) {
boardheader_t *bh;
@@ -1534,7 +1534,7 @@ choose_board(int newflag)
move(b_lines - 2, 0); clrtobot();
outs("重新排序看板 "
ANSI_COLOR(1;33) "(注意, 這個動作會覆寫原來設定)" ANSI_RESET " \n");
- tmp = getans("排序方式 (1)按照板名排序 (2)按照類別排序 ==> [0]取消 ");
+ tmp = vans("排序方式 (1)按照板名排序 (2)按照類別排序 ==> [0]取消 ");
if( tmp == '1' )
fav_sort_by_name();
else if( tmp == '2' )
@@ -1689,7 +1689,7 @@ choose_board(int newflag)
break;
case Ctrl('D'):
if (HasFavEditPerm()) {
- if (getans("刪除所有標記[N]?") == 'y'){
+ if (vans("刪除所有標記[N]?") == 'y'){
fav_remove_all_tagged_item();
brdnum = -1;
}
@@ -1743,7 +1743,7 @@ choose_board(int newflag)
ptr = &nbrd[num];
if (IS_LISTING_FAV()) {
if (ptr->myattr & NBRD_FAV) {
- if (getans("你確定刪除嗎? [N/y]") != 'y')
+ if (vans("你確定刪除嗎? [N/y]") != 'y')
break;
fav_remove_item(ptr->bid, get_fav_type(ptr));
ptr->myattr &= ~NBRD_FAV;
@@ -1814,10 +1814,10 @@ choose_board(int newflag)
break;
}
- c = getans("請選擇 2)備份我的最愛 3)取回最愛備份 [Q]");
+ c = vans("請選擇 2)備份我的最愛 3)取回最愛備份 [Q]");
if(!c)
break;
- if(getans("確定嗎 [y/N] ") != 'y')
+ if(vans("確定嗎 [y/N] ") != 'y')
break;
switch(c){
case '2':
@@ -1911,7 +1911,7 @@ choose_board(int newflag)
assert(0<=num && num<nbrdsize);
ptr = &nbrd[num];
if (ptr->myattr & NBRD_SYMBOLIC) {
- if (getans("確定刪除連結?[N/y]") == 'y')
+ if (vans("確定刪除連結?[N/y]") == 'y')
delete_symbolic_link(getbcache(ptr->bid), ptr->bid);
}
brdnum = -1;
diff --git a/mbbsd/cal.c b/mbbsd/cal.c
index 4480b1bd..7cf8c671 100644
--- a/mbbsd/cal.c
+++ b/mbbsd/cal.c
@@ -269,7 +269,7 @@ inmailbox(int m)
int
p_cloak(void)
{
- if (getans(currutmp->invisible ? "確定要現身?[y/N]" : "確定要隱身?[y/N]") != 'y')
+ if (vans(currutmp->invisible ? "確定要現身?[y/N]" : "確定要隱身?[y/N]") != 'y')
return 0;
if (cuser.money >= 19) {
vice(19, "付費隱身");
@@ -284,7 +284,7 @@ int
p_from(void)
{
char tmp_from[sizeof(currutmp->from)];
- if (getans("確定要改故鄉?[y/N]") != 'y')
+ if (vans("確定要改故鄉?[y/N]") != 'y')
return 0;
reload_money();
if (cuser.money < 49)
@@ -387,13 +387,13 @@ int do_give_money(char *id, int uid, int money)
getuser(id, &xuser);
if (!strcmp(xuser.myangel, cuser.userid)){
mail_redenvelop(
- getkey("他是你的小主人,是否匿名?[Y/n]") == 'n' ?
+ vmsg("他是你的小主人,是否匿名?[Y/n]") == 'n' ?
cuser.userid : "小天使", id, money - tax,
- getans("要自行書寫紅包袋嗎?[y/N]"));
+ vans("要自行書寫紅包袋嗎?[y/N]"));
} else
#endif
mail_redenvelop(cuser.userid, id, money - tax,
- getans("要自行書寫紅包袋嗎?[y/N]"));
+ vans("要自行書寫紅包袋嗎?[y/N]"));
if (money < 50) {
usleep(2000000);
} else if (money < 200) {
@@ -460,7 +460,7 @@ give_money_ui(const char *userid)
} else {
outs("你的認證尚未過期,可暫時跳過密碼認證程序。\n");
// auth is valid.
- if (getans("確定進行交易嗎? (y/N): ") == 'y')
+ if (vans("確定進行交易嗎? (y/N): ") == 'y')
skipauth = 1;
else
tries = -1;
diff --git a/mbbsd/chess.c b/mbbsd/chess.c
index adf8d08c..1f52b093 100644
--- a/mbbsd/chess.c
+++ b/mbbsd/chess.c
@@ -1009,7 +1009,7 @@ ChessGenLog(ChessInfo* info, ChessGameResult result)
ChessGenLogGlobal(info, result);
}
- a = getans((cuser.uflag & DEFBACKUP_FLAG) ?
+ a = vans((cuser.uflag & DEFBACKUP_FLAG) ?
"是否將棋譜寄回信箱? [Y/n]" :
"是否將棋譜寄回信箱? [y/N]");
@@ -1243,7 +1243,7 @@ ChessWatchGame(void (*play)(int, ChessGameMode), int game, const char* title)
return -1;
}
- if (getans("是否進行觀棋? [N/y]") != 'y')
+ if (vans("是否進行觀棋? [N/y]") != 'y')
return 0;
if ((sock = make_connection_to_somebody(uin, 10)) < 0) {
diff --git a/mbbsd/chicken.c b/mbbsd/chicken.c
index 7963e393..dc077043 100644
--- a/mbbsd/chicken.c
+++ b/mbbsd/chicken.c
@@ -184,7 +184,7 @@ new_chicken(void)
"(j)惡魔 $100\n"
"(k)忍者 $85 (n)就可人$100 (m)蘿莉 $77\n"
"[0]不想買了 $0\n");
- i = getans("請選擇你要養的動物:");
+ i = vans("請選擇你要養的動物:");
// since (o) is confusing to some people, we alias 'm' to 'o'.
if (i == 'm') i = 'o';
@@ -522,7 +522,7 @@ ch_kill(chicken_t *mychicken)
{
int ans;
- ans = getans("棄養要被罰 100 元, 是否要棄養?(y/N)");
+ ans = vans("棄養要被罰 100 元, 是否要棄養?(y/N)");
if (ans == 'y') {
vice(100, "棄養寵物費");
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index 044517a2..6ac14e3c 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -2036,7 +2036,7 @@ block_prompt(void)
mode[0] = 'w';
}
- if (getans("刪除區塊(Y/N)?[N] ") != 'y')
+ if (vans("刪除區塊(Y/N)?[N] ") != 'y')
goto cancel_block;
block_save_to_file(tmpfname, mode[0] == 'a' ? BLOCK_APPEND : BLOCK_TRUNCATE);
diff --git a/mbbsd/io.c b/mbbsd/io.c
index ebf74f79..b2ee791d 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -1010,8 +1010,14 @@ getdata_buf(int line, int col, const char *prompt, char *buf, int len, int echo)
{
#ifdef TRY_VGETS
move(line, col);
- if(prompt && *prompts) outs(prompt);
- return vgetstr(buf, len, echo ? VGET_DOECHO : VGET_NOECHO, buf);
+ if(prompt && *prompt) outs(prompt);
+ if (echo == LCECHO)
+ echo = VGET_LOWERCASE;
+ else if (echo == NOECHO)
+ echo = VGET_NOECHO;
+ else
+ echo = VGET_DEFAULT;
+ return vgetstr(buf, len, echo, buf);
#else
return getdata_raw(line, col, prompt, buf, len, echo);
#endif
@@ -1023,8 +1029,14 @@ getdata_str(int line, int col, const char *prompt, char *buf, int len, int echo,
{
#ifdef TRY_VGETS
move(line, col);
- if(prompt && *prompts) outs(prompt);
- return vgetstr(buf, len, echo ? VGET_DOECHO : VGET_NOECHO, defaultstr);
+ if(prompt && *prompt) outs(prompt);
+ if (echo == LCECHO)
+ echo = VGET_LOWERCASE;
+ else if (echo == NOECHO)
+ echo = VGET_NOECHO;
+ else
+ echo = VGET_DEFAULT;
+ return vgetstr(buf, len, echo, defaultstr);
#else
// if pointer is the same, ignore copy.
if (defaultstr != buf)
@@ -1038,8 +1050,14 @@ getdata(int line, int col, const char *prompt, char *buf, int len, int echo)
{
#ifdef TRY_VGETS
move(line, col);
- if(prompt) outs(prompt);
- return vgets(buf, len, echo ? VGET_DOECHO : VGET_NOECHO);
+ if(prompt && *prompt) outs(prompt);
+ if (echo == LCECHO)
+ echo = VGET_LOWERCASE;
+ else if (echo == NOECHO)
+ echo = VGET_NOECHO;
+ else
+ echo = VGET_DEFAULT;
+ return vgets(buf, len, echo);
#else
buf[0] = 0;
return getdata_raw(line, col, prompt, buf, len, echo);
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index 2fa6f894..9b051613 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -1104,7 +1104,7 @@ mail_del(int ent, const fileheader_t * fhdr, const char *direct)
return READ_REDRAW;
}
- if (getans(msg_del_ny) == 'y') {
+ if (vans(msg_del_ny) == 'y') {
if (!delete_record(direct, sizeof(*fhdr), ent)) {
setupmailusage();
setdirpath(genbuf, direct, fhdr->filename);
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 2675b856..f9d9846b 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1050,7 +1050,7 @@ inline static void check_bad_login(void)
outs("通常並沒有辦法知道該ip是誰所有, "
"以及其意圖(是不小心按錯或有意測您密碼)\n"
"若您有帳號被盜用疑慮, 請經常更改您的密碼或使用加密連線");
- if (getans("您要刪除以上錯誤嘗試的記錄嗎? [y/N] ") == 'y')
+ if (vans("您要刪除以上錯誤嘗試的記錄嗎? [y/N] ") == 'y')
unlink(genbuf);
}
}
@@ -1215,7 +1215,7 @@ user_login(void)
if( ifbirth ){
birthday_make_a_wish(&ptime, &lasttime);
- if( getans("是否要顯示「壽星」於使用者名單上?(y/N)") == 'y' )
+ if( vans("是否要顯示「壽星」於使用者名單上?(y/N)") == 'y' )
currutmp->birth = 1;
}
check_bad_login();
@@ -1284,7 +1284,7 @@ user_login(void)
int num;
num = updatenewfav(1);
if (num > NEW_FAV_THRESHOLD &&
- getans("找到 %d 個新看板,確定要加入我的最愛嗎?[Y/n]", num) == 'n') {
+ vansf("找到 %d 個新看板,確定要加入我的最愛嗎?[Y/n]", num) == 'n') {
fav_free();
fav_load();
}
diff --git a/mbbsd/pfterm.c b/mbbsd/pfterm.c
index e77259a4..ebfad7e5 100644
--- a/mbbsd/pfterm.c
+++ b/mbbsd/pfterm.c
@@ -91,14 +91,46 @@
// pfterm is designed for general maple-family BBS systems, not
// specific to any branch.
//
-// Author: Hung-Te Lin (piaip), Dec. 2007.
+// Author: Hung-Te Lin (piaip), Dec 2007.
//
-// Copyright(c) 2007-2008 Hung-Te Lin <piaip@csie.ntu.edu.tw>
-// All Rights Reserved.
-// You are free to use, modify, redistribute this program in any
-// non-commercial usage (including network service).
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
+// Copyright (c) 2007-2008 Hung-Te Lin <piaip@csie.ntu.edu.tw>
+// All rights reserved.
+//
+// This is distributed under a Non-Commercial 4clause-BSD alike license.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. All advertising materials mentioning features or use of this software
+// must display appropriate acknowledgement, like:
+// This product includes software developed by Hung-Te Lin (piaip)
+// and its contributors.
+// The acknowledgement can be localized in any language or style.
+// 4. Neither the name of Hung-Te Lin nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+// 5. You may not exercise any of the rights granted to you above in any
+// manner that is primarily intended for or directed toward commercial
+// advantage or private monetary compensation. For avoidance of doubt,
+// using in a program providing commercial network service is also
+// prohibited.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// MAJOR IMPROVEMENTS:
// - Interpret ANSI code and maintain a virtual terminal
diff --git a/mbbsd/pmore.c b/mbbsd/pmore.c
index 7c51315f..d3d542e2 100644
--- a/mbbsd/pmore.c
+++ b/mbbsd/pmore.c
@@ -12,12 +12,45 @@
*
* Author: Hung-Te Lin (piaip), June 2005.
*
- * Copyright(c) 2005-2008 Hung-Te Lin <piaip@csie.ntu.edu.tw>
- * All Rights Reserved.
- * You are free to use, modify, redistribute this program in any
- * non-commercial usage (including network service).
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
+ * Copyright (c) 2005-2008 Hung-Te Lin <piaip@csie.ntu.edu.tw>
+ * All rights reserved.
+ *
+ * This is distributed under a Non-Commercial 4clause-BSD alike license.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display appropriate acknowledgement, like:
+ * This product includes software developed by Hung-Te Lin (piaip)
+ * and its contributors.
+ * The acknowledgement can be localized in any language or style.
+ * 4. Neither the name of Hung-Te Lin nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * 5. You may not exercise any of the rights granted to you above in any
+ * manner that is primarily intended for or directed toward commercial
+ * advantage or private monetary compensation. For avoidance of doubt,
+ * using in a program providing commercial network service is also
+ * prohibited.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
*
* MAJOR IMPROVEMENTS:
* - Clean source code, and more readable for mortal
diff --git a/mbbsd/read.c b/mbbsd/read.c
index e744322c..c2aff26c 100644
--- a/mbbsd/read.c
+++ b/mbbsd/read.c
@@ -102,7 +102,7 @@ AskTag(const char *msg)
int num;
num = TagNum;
- switch (getans("◆ %s A)文章 T)標記 Q)uit?", msg)) {
+ switch (vansf("◆ %s A)文章 T)標記 Q)uit?", msg)) {
case 'q':
num = -1;
break;
@@ -177,7 +177,7 @@ TagPruner(int bid)
return DONOTHING;
}
if (TagNum && ((currstat != READING) || (currmode & MODE_BOARD))) {
- if (getans("刪除所有標記[N]?") != 'y')
+ if (vans("刪除所有標記[N]?") != 'y')
return READ_REDRAW;
#ifdef SAFE_ARTICLE_DELETE
if(bp && !(currmode & MODE_DIGEST) && bp->nuser>30 )
@@ -899,7 +899,7 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
case 'G':
// special types
- switch(getans( currmode & MODE_SELECT ?
+ switch(vans( currmode & MODE_SELECT ?
"增加條件 標記(m/s)[m]: ":
"搜尋標記(m/s)[m]: "))
{
diff --git a/mbbsd/register.c b/mbbsd/register.c
index 519e47f5..48bc9534 100644
--- a/mbbsd/register.c
+++ b/mbbsd/register.c
@@ -764,7 +764,7 @@ check_register(void)
move(b_lines-3, 0);
outs("上次註冊單審查失敗。 (本記錄已備份於您的信箱中)\n"
"請重新申請並照上面指示正確填寫註冊單。");
- while(getans("請輸入 y 繼續: ") != 'y');
+ while(vans("請輸入 y 繼續: ") != 'y');
unlink(fn);
}
@@ -2162,7 +2162,7 @@ regform2_validate_page(int dryrun)
case KEY_END:
case 'q':
ch = 'q';
- if (getans("確定要離開了嗎? (本頁變更將不會儲存) [y/N]: ") != 'y')
+ if (vans("確定要離開了嗎? (本頁變更將不會儲存) [y/N]: ") != 'y')
{
prompt_regform_ui();
ch = 0;
@@ -2185,7 +2185,7 @@ regform2_validate_page(int dryrun)
break;
// have more blanks
- ch = getans("尚未指定的 %d 個項目要: (S跳過/y通過/n拒絕/e繼續編輯): ",
+ ch = vansf("尚未指定的 %d 個項目要: (S跳過/y通過/n拒絕/e繼續編輯): ",
blanks);
}
diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c
index 3ce0407d..a3e2ba3a 100644
--- a/mbbsd/stuff.c
+++ b/mbbsd/stuff.c
@@ -173,39 +173,6 @@ void syncnow(void)
// TODO
// move this function to visio.c
/**
- * 給 printf format 的參數,印到最底下一行。
- * 傳回使用者的選擇(char)。
- */
-char
-getans(const char *fmt,...)
-{
- char msg[256];
- char ans[3];
- va_list ap;
- va_start(ap, fmt);
- vsnprintf(msg , sizeof(msg), fmt, ap);
- va_end(ap);
-
- getdata(b_lines, 0, msg, ans, sizeof(ans), LCECHO);
- return ans[0];
-}
-
-// TODO
-// move this function to visio.c
-int
-getkey(const char *fmt,...)
-{
- char msg[256], i;
- va_list ap;
- va_start(ap, fmt);
- i = vsnprintf(msg , sizeof(msg), fmt, ap);
- va_end(ap);
- return vmsg(msg);
-}
-
-// TODO
-// move this function to visio.c
-/**
* 從第 y 列開始 show 出 filename 檔案中的前 lines 行。
* mode 為 output 的模式,參數同 strip_ansi。
* @param filename
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 778e4f04..54854953 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -2872,7 +2872,7 @@ userlist(void)
break;
case 'a':
if (HasUserPerm(PERM_LOGINOK) && !(fri_stat & IFH)) {
- if (getans("確定要加入好友嗎 [N/y]") == 'y') {
+ if (vans("確定要加入好友嗎 [N/y]") == 'y') {
friend_add(uentp->userid, FRIEND_OVERRIDE,uentp->nickname);
friend_load(FRIEND_OVERRIDE);
}
@@ -2882,7 +2882,7 @@ userlist(void)
case 'd':
if (HasUserPerm(PERM_LOGINOK) && (fri_stat & IFH)) {
- if (getans("確定要刪除好友嗎 [N/y]") == 'y') {
+ if (vans("確定要刪除好友嗎 [N/y]") == 'y') {
friend_delete(uentp->userid, FRIEND_OVERRIDE);
friend_load(FRIEND_OVERRIDE);
}
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 300fc356..88848b77 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -51,7 +51,7 @@ u_loginview(void)
in = i;
clrtobot();
- while ((i = getkey("請按 [A-%c] 切換設定,按 [Return] 結束:",
+ while ((i = vmsgf("請按 [A-%c] 切換設定,按 [Return] 結束:",
'A'+in-1))!='\r')
{
i = i - 'a';
@@ -92,9 +92,9 @@ int u_cancelbadpost(void)
}
if(
- getkey("我願意尊守站方規定,組規,以及板規[y/N]?")!='y' ||
- getkey("我願意尊重不歧視族群,不鬧板,尊重各板主權力[y/N]?")!='y' ||
- getkey("我願意謹慎發表有意義言論,不謾罵攻擊,不跨板廣告[y/N]?")!='y' )
+ vmsg("我願意尊守站方規定,組規,以及板規[y/N]?")!='y' ||
+ vmsg("我願意尊重不歧視族群,不鬧板,尊重各板主權力[y/N]?")!='y' ||
+ vmsg("我願意謹慎發表有意義言論,不謾罵攻擊,不跨板廣告[y/N]?")!='y' )
{vmsg("請您思考清楚後再來申請刪除."); return 0;}
@@ -447,7 +447,7 @@ void Customize(void)
}
/* input */
- key = getkey("請按 [a-%c,1-%c] 切換設定,其它任意鍵結束: ",
+ key = vmsgf("請按 [a-%c,1-%c] 切換設定,其它任意鍵結束: ",
'a' + ia-1, '1' + iax -1);
if (key >= 'a' && key < 'a' + ia)
@@ -558,7 +558,7 @@ uinfo_query(userec_t *u, int adminmode, int unum)
}
memcpy(&x, u, sizeof(userec_t));
- ans = getans(adminmode ?
+ ans = vans(adminmode ?
"(1)改資料(2)密碼(3)權限(4)砍帳號(5)改ID(6)寵物(7)審判(M)信箱 [0]結束 " :
"請選擇 (1)修改資料 (2)設定密碼 (M)修改信箱 (C) 個人化設定 ==> [0]結束 ");
@@ -912,7 +912,7 @@ uinfo_query(userec_t *u, int adminmode, int unum)
}
y += 3;
- if (i < 3 || fail > 0 || getans(msg_sure_ny) != 'y')
+ if (i < 3 || fail > 0 || vans(msg_sure_ny) != 'y')
{
fail++;
break;
@@ -962,7 +962,7 @@ uinfo_query(userec_t *u, int adminmode, int unum)
char reason[STRLEN];
char title[STRLEN], msg[1024];
while (!getdata(b_lines-3, 0, "請輸入理由以示負責:", reason, 50, DOECHO));
- if (getans(msg_sure_ny) != 'y')
+ if (vans(msg_sure_ny) != 'y')
{
fail++;
break;
@@ -1003,7 +1003,7 @@ uinfo_query(userec_t *u, int adminmode, int unum)
if (!pre_confirmed)
{
- if (getans(msg_sure_ny) != 'y')
+ if (vans(msg_sure_ny) != 'y')
return;
}
diff --git a/mbbsd/visio.c b/mbbsd/visio.c
index 499467a5..56628cf0 100644
--- a/mbbsd/visio.c
+++ b/mbbsd/visio.c
@@ -3,25 +3,64 @@
/*
* visio.c
- * High-Level virtual screen input output control
+ * piaip's new implementation of visio
+ * (visio: virtual screen input output, the name from Maple3)
*
- * Author: piaip, 2008
+ * This is not the original visio.c from Maple3.
+ * We just borrowed its file name and few API names/prototypes
+ * then re-implemented everything from scratch :)
*
- * This is not the original visio.c from maple3.
- * We just borrowed its file name and some API prototypes
- * then re-implemented everything :)
* We will try to keep the API behavior similiar (to help porting)
* but won't stick to it.
- * Maybe at the end only 'vmsg' and 'vmsgf' can still be compatible....
+ * Maybe at the end only 'vmsg' and 'vmsgf' will still be compatible....
*
* m3 visio = (ptt) visio+screen/term.
*
- * This visio contains only high level UI element/widgets.
+ * Author: Hung-Te Lin (piaip), April 2008.
+ *
+ * Copyright (c) 2005-2008 Hung-Te Lin <piaip@csie.ntu.edu.tw>
+ * All rights reserved.
+ *
+ * This is distributed under a Non-Commercial 4clause-BSD alike license.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display appropriate acknowledgement, like:
+ * This product includes software developed by Hung-Te Lin (piaip)
+ * and its contributors.
+ * The acknowledgement can be localized in any language or style.
+ * 4. Neither the name of Hung-Te Lin nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * 5. You may not exercise any of the rights granted to you above in any
+ * manner that is primarily intended for or directed toward commercial
+ * advantage or private monetary compensation. For avoidance of doubt,
+ * using in a program providing commercial network service is also
+ * prohibited.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* To add API here, please...
* (1) name the API in prefix of 'v'.
* (2) use only screen.c APIs.
- * (3) take care of wide screen.
+ * (3) take care of wide screen and DBCS.
* (4) utilize the colos in visio.h, and name asa VCLR_* (visio color)
*/
@@ -152,6 +191,7 @@ mvouts(int y, int x, const char *str)
{
move(y, x);
clrtoeol();
+ SOLVE_ANSI_CACHE();
outs(str);
}
@@ -358,8 +398,10 @@ vans(const char *msg)
{
char buf[3];
- // move(b_lines, 0); clrtoeol();
- vget(b_lines, 0, msg, buf, sizeof(buf), LCECHO);
+ move(b_lines, 0);
+ clrtoeol(); SOLVE_ANSI_CACHE();
+ outs(msg);
+ vgets(buf, sizeof(buf), VGET_LOWERCASE);
return (unsigned char)buf[0];
}
@@ -679,7 +721,7 @@ vs_cols(const VCOL *cols, const VCOLW *ws, int n, ...)
////////////////////////////////////////////////////////////////////////
#ifdef DBCSAWARE
-# define CHKDBCSTRAIL(_buf,_i) (/*ISDBCSAWARE() &&*/ DBCS_Status(_buf, _i) == DBCS_TRAILING)
+# define CHKDBCSTRAIL(_buf,_i) (ISDBCSAWARE() && DBCS_Status(_buf, _i) == DBCS_TRAILING)
#else // !DBCSAWARE
# define CHKDBCSTRAIL(buf,i) (0)
#endif // !DBCSAWARE
@@ -704,10 +746,10 @@ InputHistoryAdd(const char *s)
int i = 0;
if (!s || !*s || !*(s+1))
return 0;
+ // TODO if already in queue, change order...?
for (i = 0; i < IH_MAX_ENTRIES; i++)
if (strcmp(s, ih.buf[i]) == 0)
return 0;
- // TODO if already in queue, reject.
strlcpy(ih.buf[ih.iappend], s, sizeof(ih.buf[ih.iappend]));
ih.icurr = ih.iappend;
ih.iappend ++;
@@ -721,7 +763,7 @@ InputHistoryDelta(char *s, int sz, int d)
int i, xcurr = 0;
for (i = 1; i <= IH_MAX_ENTRIES; i++)
{
- xcurr = (ih.icurr+d*i)%IH_MAX_ENTRIES;
+ xcurr = (ih.icurr+ IH_MAX_ENTRIES + d*i)%IH_MAX_ENTRIES;
if (ih.buf[xcurr][0])
{
ih.icurr = xcurr;
@@ -731,15 +773,13 @@ InputHistoryDelta(char *s, int sz, int d)
if (ih.buf[ih.icurr][0])
{
strlcpy(s, ih.buf[ih.icurr], sz);
- // ih.icurr += d;
- // ih.icurr %= IH_MAX_ENTRIES;
}
}
void
InputHistoryPrev(char *s, int sz)
{
- InputHistoryDelta(s, sz, IH_MAX_ENTRIES-1);
+ InputHistoryDelta(s, sz, -1);
}
void
@@ -767,18 +807,19 @@ vgetstr(char *_buf, int len, int flags, const char *defstr)
int c;
// always use internal buffer to prevent temporary input issue.
- char buf[STRLEN] = "";
+ char buf[STRLEN] = ""; // zero whole.
// it is wrong to design input with larger buffer
// than STRLEN. Although we support large screen,
// inputting huge line will just make troubles...
if (len > STRLEN) len = STRLEN;
- assert(len <= sizeof(buf));
+ assert(len <= sizeof(buf) && len >= 2);
// memset(buf, 0, len);
if (defstr && *defstr)
{
strlcpy(buf, defstr, len);
+ strip_ansi(buf, buf, STRIP_ALL); // safer...
icurr = iend = strlen(buf);
}
@@ -792,9 +833,11 @@ vgetstr(char *_buf, int len, int flags, const char *defstr)
move(line, col);
clrtoeol();
SOLVE_ANSI_CACHE();
- outs(VCLR_INPUT_FIELD); // change color to prompt fields
+ if (!(flags & VGET_TRANSPARENT))
+ outs(VCLR_INPUT_FIELD); // change color to prompt fields
vfill(len, 0, buf);
- outs(ANSI_RESET);
+ if (!(flags & VGET_TRANSPARENT))
+ outs(ANSI_RESET);
// move to cursor position
move(line, col+icurr);
@@ -807,29 +850,33 @@ vgetstr(char *_buf, int len, int flags, const char *defstr)
c = KEY_DOWN;
// let UP do the magic.
case KEY_UP: case Ctrl('P'):
- if (flags & VGET_NOECHO) {
+ if ((flags & VGET_NOECHO) ||
+ (flags & VGET_DIGITS))
+ {
bell();
continue;
}
+
+ // NOECHO is already checked...
InputHistoryAdd(buf);
+
if (c == KEY_DOWN)
InputHistoryNext(buf, len);
else
InputHistoryPrev(buf, len);
+
icurr = iend = strlen(buf);
break;
// exiting keys
case '\n': case '\r':
- // confirm again.
- buf[iend] = 0;
abort = 1;
break;
case Ctrl('C'):
icurr = iend = 0;
+ buf[0] = 0;
buf[1] = c;
- buf[iend] = 0;
abort = 1;
break;
@@ -866,8 +913,7 @@ vgetstr(char *_buf, int len, int flags, const char *defstr)
// kill next one character.
memmove(buf+icurr, buf+icurr+1, iend-icurr);
iend--;
- } else
- bell();
+ }
if (icurr < iend) {
// kill next one character.
memmove(buf+icurr, buf+icurr+1, iend-icurr);