summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/proto.h4
-rw-r--r--mbbsd/guess.c10
-rw-r--r--mbbsd/indict.c19
-rw-r--r--mbbsd/kaede.c7
-rw-r--r--mbbsd/mbbsd.c5
5 files changed, 16 insertions, 29 deletions
diff --git a/include/proto.h b/include/proto.h
index 7d847285..a844e483 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -1,4 +1,4 @@
-/* $Id: proto.h,v 1.33 2003/01/16 13:28:48 kcwu Exp $ */
+/* $Id: proto.h,v 1.34 2003/01/16 14:38:35 kcwu Exp $ */
#ifndef INCLUDE_PROTO_H
#define INCLUDE_PROTO_H
@@ -251,7 +251,7 @@ char getans(char *prompt);
int Rename(char* src, char* dst);
int Link(char* src, char* dst);
char *Ptt_prints(char *str, int mode);
-char *my_ctime(const time_t *t);
+char *my_ctime(const time_t *t, char *ans, int len);
/* lovepaper */
int x_love();
diff --git a/mbbsd/guess.c b/mbbsd/guess.c
index c2203942..539388e2 100644
--- a/mbbsd/guess.c
+++ b/mbbsd/guess.c
@@ -1,4 +1,4 @@
-/* $Id: guess.c,v 1.10 2003/01/16 11:58:04 kcwu Exp $ */
+/* $Id: guess.c,v 1.11 2003/01/16 14:37:32 kcwu Exp $ */
#include "bbs.h"
#define LOGPASS BBSHOME "/etc/winguess.log"
@@ -75,11 +75,10 @@ check_data(char *str)
}
static char *
-get_data(int count)
+get_data(char data[5], int count)
{
- static char data[5];
while (1) {
- getdata(6, 0, "輸入四位數字(不重複): ", data, sizeof(data), LCECHO);
+ getdata(6, 0, "輸入四位數字(不重複): ", data, 5, LCECHO);
if (check_data(data) == 1)
break;
}
@@ -215,6 +214,7 @@ Diff_Random(char *answer)
int
guess_main()
{
+ char data[5];
unsigned long int money;
char computerwin = 0, youwin = 0;
int count = 0, c_count = 0;
@@ -281,7 +281,7 @@ guess_main()
prints("第 %d 次機會 ", count + 1);
if (!youwin) {
++count;
- if (guess_play(get_data(count), answer, count))
+ if (guess_play(get_data(data, count), answer, count))
youwin = 1;
}
}
diff --git a/mbbsd/indict.c b/mbbsd/indict.c
index 14650fea..93d955a1 100644
--- a/mbbsd/indict.c
+++ b/mbbsd/indict.c
@@ -1,4 +1,4 @@
-/* $Id: indict.c,v 1.10 2002/07/27 13:50:57 kcwu Exp $ */
+/* $Id: indict.c,v 1.11 2003/01/16 14:37:31 kcwu Exp $ */
#include "bbs.h"
#define REFER "etc/dicts"
@@ -67,19 +67,6 @@ choose_dict(void)
return 0;
}
-static char *
-lower(char str[])
-{
- int c;
- static char temp[200];
-
- strcpy(temp, str);
- for (c = 0; temp[c] != 0; c++)
- if (temp[c] >= 'A' && temp[c] <= 'Z')
- temp[c] += 'a' - 'A';
- return temp;
-}
-
int
use_dict()
{
@@ -109,7 +96,7 @@ use_dict()
outs(lang);
getdata(2, 0, ":", word, 18, DOECHO);
outs("資料搜尋中請稍候....");
- strlcpy(word, lower(word), sizeof(word));
+ str_lower(word, word);
if (word[0] == 0)
return 0;
clear();
@@ -145,7 +132,7 @@ use_dict()
f = 1;
} else
f = 0;
- if (strstr(lower(lang), word)) {
+ if (strstr_lower(lang, word)) {
if (f == 1)
lang[65] = '[';
outs(lang);
diff --git a/mbbsd/kaede.c b/mbbsd/kaede.c
index b5c1a25e..0bdc3ef0 100644
--- a/mbbsd/kaede.c
+++ b/mbbsd/kaede.c
@@ -1,4 +1,4 @@
-/* $Id: kaede.c,v 1.12 2002/07/22 19:02:00 in2 Exp $ */
+/* $Id: kaede.c,v 1.13 2003/01/16 14:38:35 kcwu Exp $ */
#include "bbs.h"
char *
@@ -88,13 +88,12 @@ Link(char *src, char *dst)
}
char *
-my_ctime(const time_t * t)
+my_ctime(const time_t * t, char *ans, int len)
{
struct tm *tp;
- static char ans[100];
tp = localtime(t);
- snprintf(ans, sizeof(ans),
+ snprintf(ans, len,
"%02d/%02d/%02d %02d:%02d:%02d", (tp->tm_year % 100),
tp->tm_mon + 1, tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec);
return ans;
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 521673c5..74418777 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1,4 +1,4 @@
-/* $Id: mbbsd.c,v 1.61 2003/01/14 11:19:39 in2 Exp $ */
+/* $Id: mbbsd.c,v 1.62 2003/01/16 14:38:35 kcwu Exp $ */
#include "bbs.h"
#define SOCKET_QLEN 4
@@ -251,11 +251,12 @@ talk_request(int sig)
bell();
if (currutmp->msgcount) {
char buf[200];
+ char timebuf[100];
time_t now = time(0);
snprintf(buf, sizeof(buf),
"\033[33;41m★%s\033[34;47m [%s] %s \033[0m",
- SHM->uinfo[currutmp->destuip].userid, my_ctime(&now),
+ SHM->uinfo[currutmp->destuip].userid, my_ctime(&now,timebuf,sizeof(timebuf)),
(currutmp->sig == 2) ? "重要消息廣播!(請Ctrl-U,l查看熱訊記錄)"
: "呼叫、呼叫,聽到請回答");
move(0, 0);