summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-23 23:03:54 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-23 23:03:54 +0800
commitb640fe2c00e591888ecc1ca594e5e51336c3bf44 (patch)
tree58fbced83d4f120681a1a1e64f5c5b1050a30038 /mbbsd
parent432105a135d72c756520d12ece397d52091585ba (diff)
downloadpttbbs-b640fe2c00e591888ecc1ca594e5e51336c3bf44.tar
pttbbs-b640fe2c00e591888ecc1ca594e5e51336c3bf44.tar.gz
pttbbs-b640fe2c00e591888ecc1ca594e5e51336c3bf44.tar.bz2
pttbbs-b640fe2c00e591888ecc1ca594e5e51336c3bf44.tar.lz
pttbbs-b640fe2c00e591888ecc1ca594e5e51336c3bf44.tar.xz
pttbbs-b640fe2c00e591888ecc1ca594e5e51336c3bf44.tar.zst
pttbbs-b640fe2c00e591888ecc1ca594e5e51336c3bf44.zip
remove useless functions
integrate similiar functions git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1827 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/bbs.c4
-rw-r--r--mbbsd/card.c2
-rw-r--r--mbbsd/io.c25
-rw-r--r--mbbsd/mail.c4
-rw-r--r--mbbsd/menu.c21
-rw-r--r--mbbsd/more.c2
-rw-r--r--mbbsd/read.c71
-rw-r--r--mbbsd/stuff.c71
-rw-r--r--mbbsd/talk.c1
-rw-r--r--mbbsd/user.c2
-rw-r--r--mbbsd/var.c1
11 files changed, 79 insertions, 125 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 519ac5aa..a079c11a 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1176,7 +1176,7 @@ read_post(int ent, fileheader_t * fhdr, char *direct)
"(=[]<>)\033[30m相關主題 \033[31m(↑↓)\033[30m上下封 \033[31m(←)"
"\033[30m離開 \033[m");
- switch (egetch()) {
+ switch (igetch()) {
case 'q':
case 'Q':
case KEY_LEFT:
@@ -2078,7 +2078,7 @@ sequent_messages(fileheader_t * fptr)
"\033[30m下一封 \033[31m(←,q)\033[30m離開 \033[m");
continue_flag = 0;
- switch (egetch()) {
+ switch (igetch()) {
case KEY_LEFT:
case 'e':
case 'q':
diff --git a/mbbsd/card.c b/mbbsd/card.c
index 2ed12260..4906e5e9 100644
--- a/mbbsd/card.c
+++ b/mbbsd/card.c
@@ -41,7 +41,7 @@ card_select(int *now)
(*now == 2) ? cc[1] : cc[0],
(*now == 3) ? cc[1] : cc[0],
(*now == 4) ? cc[1] : cc[0]);
- switch (egetch()) {
+ switch (igetch()) {
case 'Q':
case 'q':
return 0;
diff --git a/mbbsd/io.c b/mbbsd/io.c
index 829386f8..c0f5d721 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -587,14 +587,6 @@ getdata_buf(int line, int col, char *prompt, char *buf, int len, int echo)
return oldgetdata(line, col, prompt, buf, len, echo);
}
-char
-getans(char *prompt)
-{
- char ans[5];
-
- getdata(b_lines, 0, prompt, ans, sizeof(ans), LCECHO);
- return ans[0];
-}
int
getdata_str(int line, int col, char *prompt, char *buf, int len, int echo, char *defaultstr)
@@ -611,23 +603,6 @@ getdata(int line, int col, char *prompt, char *buf, int len, int echo)
return oldgetdata(line, col, prompt, buf, len, echo);
}
-int
-rget(int x, char *prompt)
-{
- register int ch;
-
- move(x, 0);
- clrtobot();
- outs(prompt);
- refresh();
-
- ch = igetch();
- if (ch >= 'A' && ch <= 'Z')
- ch = tolower(ch);
-
- return ch;
-}
-
int
igetkey()
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index 6c0ae7c7..04c54c97 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -751,7 +751,7 @@ read_new_mail(fileheader_t * fptr)
outs(msg_mailer);
refresh();
- switch (egetch()) {
+ switch (igetch()) {
case 'r':
case 'R':
mail_reply(idc, fptr, currmaildir);
@@ -928,7 +928,7 @@ mail_read(int ent, fileheader_t * fhdr, char *direct)
refresh();
outs(msg_mailer);
- switch (egetch()) {
+ switch (igetch()) {
case 'r':
case 'R':
replied = YEA;
diff --git a/mbbsd/menu.c b/mbbsd/menu.c
index 5f8276b8..3c4dcbae 100644
--- a/mbbsd/menu.c
+++ b/mbbsd/menu.c
@@ -5,25 +5,6 @@
static int refscreen = NA;
extern char *boardprefix;
extern struct utmpfile_t *utmpshm;
-
-int
-egetch()
-{
- int rval;
-
- while (1) {
- rval = igetkey();
- if (talkrequest) {
- talkreply();
- refscreen = YEA;
- return rval;
- }
- if (rval != Ctrl('L'))
- return rval;
- redoscr();
- }
-}
-
extern char *fn_board;
extern char board_hidden_status;
@@ -311,7 +292,7 @@ domenu(int cmdmode, char *cmdtitle, int cmd, commands_t cmdtable[])
pos++;
cursor_show(menu_row + pos, menu_column);
- } while (((cmd = egetch()) != EOF) || refscreen);
+ } while (((cmd = igetch()) != EOF) || refscreen);
abort_bbs(0);
}
diff --git a/mbbsd/more.c b/mbbsd/more.c
index 5e3c993a..d8fb9306 100644
--- a/mbbsd/more.c
+++ b/mbbsd/more.c
@@ -329,7 +329,7 @@ more(char *fpath, int promptend)
while (line == b_lines || (line > 0 && viewed == fsize)) {
- switch ((ch = egetch())) {
+ switch ((ch = igetch())) {
case ':':
{
char buf[10];
diff --git a/mbbsd/read.c b/mbbsd/read.c
index 59eae987..7fcc9f1e 100644
--- a/mbbsd/read.c
+++ b/mbbsd/read.c
@@ -95,7 +95,7 @@ AskTag(char *msg)
num = TagNum;
snprintf(buf, sizeof(buf), "◆ %s A)文章 T)標記 Q)uit?", msg);
- switch (rget(b_lines - 1, buf)) {
+ switch (getans(buf)) {
case 'q':
num = -1;
break;
@@ -579,7 +579,7 @@ i_read_key(onekey_t * rcmdlist, char default_ch, keeploc_t * locmem,
{
if((mode=cursor_pos(locmem, new_ln, 10))!=DONOTHING)
return mode;
- ch = egetch();
+ ch = igetch();
}
switch (ch) {
case '0':
@@ -598,58 +598,60 @@ i_read_key(onekey_t * rcmdlist, char default_ch, keeploc_t * locmem,
case 'q':
case 'e':
case KEY_LEFT:
- if(currmode & MODE_SELECT){
- char genbuf[256];
- fileheader_t *fhdr = &headers[locmem->crs_ln - locmem->top_ln];
- board_select();
- setbdir(genbuf, currboard);
- locmem = getkeep(genbuf, 0, 1);
- locmem->crs_ln =
- getindex(genbuf, fhdr->filename, sizeof(fileheader_t));
- num = locmem->crs_ln - p_lines + 1;
- locmem->top_ln = num < 1 ? 1 : num;
-
- return NEWDIRECT;
- }
- return (currmode & MODE_ETC) ? board_etc() :
- (currmode & MODE_DIGEST) ? board_digest() : DOQUIT;
- case Ctrl('L'):
- redoscr();
- break;
+ if(currmode & MODE_SELECT){
+ char genbuf[256];
+ fileheader_t *fhdr = &headers[locmem->crs_ln - locmem->top_ln];
+ board_select();
+ setbdir(genbuf, currboard);
+ locmem = getkeep(genbuf, 0, 1);
+ locmem->crs_ln =
+ getindex(genbuf, fhdr->filename, sizeof(fileheader_t));
+ num = locmem->crs_ln - p_lines + 1;
+ locmem->top_ln = num < 1 ? 1 : num;
+
+ mode = NEWDIRECT;
+ }
+ else
+ mode = (currmode & MODE_ETC) ? board_etc() :
+ (currmode & MODE_DIGEST) ? board_digest() : DOQUIT;
+ break;
+ case Ctrl('L'):
+ redoscr();
+ break;
- case Ctrl('H'):
+ case Ctrl('H'):
mode = select_read_mode(RS_NEWPOST);
break;
- case 'a':
- case 'A':
+ case 'a':
+ case 'A':
mode = select_read_mode(RS_AUTHOR);
break;
- case 'G':
+ case 'G':
mode = select_read_mode(RS_THREAD);
break;
- case '/':
- case '?':
+ case '/':
+ case '?':
mode = select_read_mode(RS_RELATED);
break;
- case 'S':
+ case 'S':
mode = select_read_mode(RS_TITLE);
break;
- case '=':
+ case '=':
mode = thread(locmem, RELATE_FIRST, &new_ln);
break;
- case '\\':
+ case '\\':
mode = thread(locmem, CURSOR_FIRST, &new_ln);
break;
- case ']':
+ case ']':
mode = thread(locmem, RELATE_NEXT, &new_ln);
break;
- case '+':
+ case '+':
mode = thread(locmem, CURSOR_NEXT, &new_ln);
break;
- case '[':
+ case '[':
mode = thread(locmem, RELATE_PREV, &new_ln);
break;
- case '-':
+ case '-':
mode = thread(locmem, CURSOR_PREV, &new_ln);
break;
case '<':
@@ -732,7 +734,8 @@ i_read_key(onekey_t * rcmdlist, char default_ch, keeploc_t * locmem,
(currmode & MODE_SELECT) ?
(headers[locmem->crs_ln - locmem->top_ln].money & ~FHR_REFERENCE) :
locmem->crs_ln, TAG_TOGGLE))
- new_ln = locmem->crs_ln + 1;
+ locmem->crs_ln = locmem->crs_ln + 1;
+ mode = PART_REDRAW;
break;
case Ctrl('C'):
diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c
index e088b116..ba29c84e 100644
--- a/mbbsd/stuff.c
+++ b/mbbsd/stuff.c
@@ -401,47 +401,19 @@ capture_screen()
}
}
-void
-pressanykey()
-{
- int ch;
-
- outmsg("\033[37;45;1m "
- "● 請按 \033[33m(Space/Return)\033[37m 繼續 ●"
- " \033[33m(^T)\033[37m 存暫存檔 \033[m");
- do {
- ch = igetkey();
-
- if (ch == Ctrl('T')) {
- capture_screen();
- break;
- }
- } while ((ch != ' ') && (ch != KEY_LEFT) && (ch != '\r') && (ch != '\n'));
- move(b_lines, 0);
- clrtoeol();
- refresh();
-}
-
int
-vmsg(const char *fmt,...)
+vmsg_lines(const int lines, const char msg[])
{
- va_list ap;
- char msg[80] = {0};
int ch;
- va_start(ap, fmt);
- vsnprintf(msg, sizeof(msg), fmt, ap);
- va_end(ap);
-
- move(b_lines, 0);
+ move(lines, 0);
clrtoeol();
- if (*msg)
- prints("\033[1;36;44m ◆ %-55.54s \033[33;46m \033[200m\033[1431m\033[506m[請按任意鍵繼續]\033[201m \033[m", msg);
+ if (msg)
+ outs(msg);
else
- outs("\033[46;1m \033[37m"
- "\033[200m\033[1431m\033[506m□ 請按 \033[33m(Space/Return)\033[37m 繼續 □\033[201m"
- " \033[m");
+ outs("\033[46;1m \033[37m"
+ "\033[200m\033[1431m\033[506m□ 請按 \033[33m(Space/Return)\033[37m 繼續 □\033[201m (^T) 收到暫存檔 \033[m");
do {
ch = igetkey();
@@ -453,12 +425,37 @@ vmsg(const char *fmt,...)
} while ((ch != ' ') && (ch != KEY_LEFT) && (ch != '\r') && (ch != '\n'));
- move(b_lines, 0);
+ move(lines, 0);
clrtoeol();
- refresh();
return ch;
}
+int
+getans(const char *fmt,...)
+{
+ char msg[80] = {0};
+ va_list ap;
+ va_start(ap, fmt);
+ vsnprintf(msg, sizeof(msg), fmt, ap);
+ va_end(ap);
+ return vmsg_lines(b_lines, msg);
+}
+
+int
+vmsg(const char *fmt,...)
+{
+ char msg[80] = "\033[1;36;44m ◆ ", i;
+ va_list ap;
+ va_start(ap, fmt);
+ vsnprintf(msg+14, 55, fmt, ap);
+ va_end(ap);
+ for(i=69; i>0 && *(msg+i); i--)
+ *(msg+i) = ' ';
+ strcat(msg+69,"\033[33;46m \033[200m\033[1431m\033[506m[請按任意鍵繼續]\033[201m \033[m");
+ return vmsg_lines(b_lines, msg);
+}
+
+
void
bell()
{
@@ -548,7 +545,7 @@ cursor_key(int row, int column)
int ch;
cursor_show(row, column);
- ch = egetch();
+ ch = igetch();
move(row, column);
outs(STR_UNCUR);
return ch;
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index ca337041..818591dc 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -2616,7 +2616,6 @@ talkreply(void)
char genbuf[200];
int a, sig = currutmp->sig;
- talkrequest = NA;
uip = &SHM->uinfo[currutmp->destuip];
snprintf(page_requestor, sizeof(page_requestor),
"%s (%s)", uip->userid, uip->username);
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 4a531d10..103bd2d7 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -1551,6 +1551,6 @@ u_list()
clrtoeol();
prints("\033[34;46m 已顯示 %d/%d 的使用者(系統容量無上限) "
"\033[31;47m (請按任意鍵繼續) \033[m", usercounter, totalusers);
- egetch();
+ igetch();
return 0;
}
diff --git a/mbbsd/var.c b/mbbsd/var.c
index c9347b20..f559eb6a 100644
--- a/mbbsd/var.c
+++ b/mbbsd/var.c
@@ -382,7 +382,6 @@ char real_name[IDLEN + 1];
int local_article;
/* mbbsd.c */
-int talkrequest = NA;
char fromhost[STRLEN] = "\0";
char water_usies = 0;
FILE *fp_writelog = NULL;