diff options
-rw-r--r-- | include/proto.h | 1 | ||||
-rw-r--r-- | mbbsd/admin.c | 4 | ||||
-rw-r--r-- | mbbsd/stuff.c | 11 | ||||
-rw-r--r-- | mbbsd/user.c | 2 |
4 files changed, 15 insertions, 3 deletions
diff --git a/include/proto.h b/include/proto.h index c95d6a18..40786439 100644 --- a/include/proto.h +++ b/include/proto.h @@ -486,6 +486,7 @@ void setcalfile(char *buf, char *userid); void stand_title(char *title); //int getans(const char *fmt,...) GCC_CHECK_FORMAT(1,2); char getans(char *); +int getkey(const char *fmt,...) GCC_CHECK_FORMAT(1,2); int vmsg(const char *fmt,...) GCC_CHECK_FORMAT(1,2); void trim(char *buf); void bell(void); diff --git a/mbbsd/admin.c b/mbbsd/admin.c index aa498b93..2175f764 100644 --- a/mbbsd/admin.c +++ b/mbbsd/admin.c @@ -232,7 +232,7 @@ setperms(unsigned int pbits, char *pstring[]) } clrtobot(); while ( - (i = getans("請按 [A-5] 切換設定,按 [Return] 結束:"))!='\r') + (i = getkey("請按 [A-5] 切換設定,按 [Return] 結束:"))!='\r') { i = i - 'a'; if (i < 0) @@ -955,7 +955,7 @@ scan_register_form(char *regfile, int automode, int neednum) prints("%d.%-12s:%s\n", n - 2, finfo[n], fdata[n]); } if (muser.userlevel & PERM_LOGINOK) { - ans[0] = getans("此帳號已經完成註冊, " + ans[0] = getkey("此帳號已經完成註冊, " "更新(Y/N/Skip)?[N] "); if (ans[0] != 'y' && ans[0] != 's') ans[0] = 'd'; diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c index 00c307fb..28388960 100644 --- a/mbbsd/stuff.c +++ b/mbbsd/stuff.c @@ -434,6 +434,17 @@ char getans(char *prompt) } int +getkey(const char *fmt,...) +{ + char msg[256] = "\033[1;36;44m ◆ ", i; + va_list ap; + va_start(ap, fmt); + i = vsnprintf(msg + 14, 100, fmt, ap); + va_end(ap); + return vmsg_lines(b_lines, msg); +} + +int vmsg(const char *fmt,...) { char msg[256] = "\033[1;36;44m ◆ ", i; diff --git a/mbbsd/user.c b/mbbsd/user.c index edbe4fb1..127de100 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -236,7 +236,7 @@ static void Customize(void) prints("%-30s%10s\n", "D. 目前的心情", mindbuf); prints("%-30s%10s\n", "E. 高亮度顯示我的最愛", ((cuser.uflag2 & FAVNOHILIGHT) ? "否" : "是")); - switch(getans("請按 [A-E] 切換設定,按 [Return] 結束:")){ + switch(getkey("請按 [A-E] 切換設定,按 [Return] 結束:")){ case 'a':{ int currentset = cuser.uflag2 & WATER_MASK; currentset = (currentset + 1) % 3; |