summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/Makefile2
-rw-r--r--mbbsd/chc.c2
-rw-r--r--mbbsd/chess.c6
-rw-r--r--mbbsd/convert.c15
-rw-r--r--mbbsd/io.c16
-rw-r--r--mbbsd/record.c1
6 files changed, 31 insertions, 11 deletions
diff --git a/mbbsd/Makefile b/mbbsd/Makefile
index f6486530..f5ea4269 100644
--- a/mbbsd/Makefile
+++ b/mbbsd/Makefile
@@ -72,7 +72,7 @@ OBJS+= screen.o
#######################################################################
.if defined(DIET)
-OBJS+= random.o time.o alloc.o
+LDLIBS+= $(SRCROOT)/common/diet/libdiet.a
DIETCC:= diet -Os
.endif
diff --git a/mbbsd/chc.c b/mbbsd/chc.c
index 5c69a9bd..4df8e2d7 100644
--- a/mbbsd/chc.c
+++ b/mbbsd/chc.c
@@ -778,7 +778,7 @@ chc_select(ChessInfo* info, rc_t scrloc, ChessGameResult* result)
return 0;
}
-int round_to_int(double x)
+static int round_to_int(double x)
{
/* assume that double cast to int will drop fraction parts */
if(x>=0)
diff --git a/mbbsd/chess.c b/mbbsd/chess.c
index 3e578a20..03475926 100644
--- a/mbbsd/chess.c
+++ b/mbbsd/chess.c
@@ -48,11 +48,13 @@ static const char * const ChessHintStr[] = {
"Enter 選擇/移動"
};
-static const struct {
+struct ChessReplayMap_t {
const char* name;
int name_len;
ChessInfo* (*func)(FILE* fp);
-} ChessReplayMap[] = {
+};
+
+static const struct ChessReplayMap_t ChessReplayMap[] = {
{ "gomoku", 6, &gomoku_replay },
{ "chc", 3, &chc_replay },
{ "go", 2, &gochess_replay },
diff --git a/mbbsd/convert.c b/mbbsd/convert.c
index e5d0f07b..611e54ac 100644
--- a/mbbsd/convert.c
+++ b/mbbsd/convert.c
@@ -3,6 +3,13 @@
#ifdef CONVERT
+#ifdef CONVERT
+extern void big2gb_init(void*);
+extern void gb2big_init(void*);
+extern void big2uni_init(void*);
+extern void uni2big_init(void*);
+#endif
+
extern unsigned char *gb2big(unsigned char *, int *, int);
extern unsigned char *big2gb(unsigned char *, int *, int);
extern unsigned char *utf8_uni(unsigned char *, int *, int);
@@ -120,4 +127,12 @@ void set_converting_type(int which)
// bbs_convert_type = which;
}
+void init_convert()
+{
+ big2gb_init(NULL);
+ gb2big_init(NULL);
+ big2uni_init(NULL);
+ uni2big_init(NULL);
+}
+
#endif
diff --git a/mbbsd/io.c b/mbbsd/io.c
index c3a7f5e4..375d1a6d 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -31,7 +31,7 @@ static unsigned long szTotalOutput = 0, szLastOutput = 0;
extern unsigned char fakeEscape;
unsigned char fakeEscape = 0;
-unsigned char fakeEscFilter(unsigned char c)
+static unsigned char fakeEscFilter(unsigned char c)
{
if (!fakeEscape) return c;
if (c == ESC_CHR) return '*';
@@ -48,17 +48,15 @@ unsigned char fakeEscFilter(unsigned char c)
/* ----------------------------------------------------- */
#ifdef CONVERT
-extern read_write_type write_type;
-extern read_write_type read_type;
-extern convert_type input_type;
-
inline static ssize_t input_wrapper(void *buf, ssize_t count) {
/* input_wrapper is a special case.
* because we may do nothing,
* a if-branch is better than a function-pointer call.
*/
- if(input_type) return (*input_type)(buf, count);
- else return count;
+ if(input_type)
+ return (*input_type)(buf, count);
+ else
+ return count;
}
inline static int read_wrapper(int fd, void *buf, size_t count) {
@@ -745,6 +743,10 @@ drop_input(void)
icurrchar = ibufsize = 0;
}
+/*
+ * wait user input for f seconds.
+ * return 1 if control key c is available.
+ */
int
peek_input(float f, int c)
{
diff --git a/mbbsd/record.c b/mbbsd/record.c
index ec992b0b..83bafe76 100644
--- a/mbbsd/record.c
+++ b/mbbsd/record.c
@@ -322,6 +322,7 @@ safe_article_delete_range(const char *direct, int from, int to)
#endif
/* mail / post 時,依據時間建立檔案,加上郵戳 */
+/* @param[in,out] fpath input as dirname, output as filename */
int
stampfile_u(char *fpath, fileheader_t * fh)
// Ptt: stampfile_u: won't clear fileheader