summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-08 21:25:11 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-08 21:25:11 +0800
commit1ef1fe4d34d71e9488b01f2cd8f9b9d06482392b (patch)
treec5e3b73404f70a6b71d6630150008c07b3862b3a /mbbsd
parentf09589e00925a3d9a03105ca5ff3717120acc853 (diff)
downloadpttbbs-1ef1fe4d34d71e9488b01f2cd8f9b9d06482392b.tar
pttbbs-1ef1fe4d34d71e9488b01f2cd8f9b9d06482392b.tar.gz
pttbbs-1ef1fe4d34d71e9488b01f2cd8f9b9d06482392b.tar.bz2
pttbbs-1ef1fe4d34d71e9488b01f2cd8f9b9d06482392b.tar.lz
pttbbs-1ef1fe4d34d71e9488b01f2cd8f9b9d06482392b.tar.xz
pttbbs-1ef1fe4d34d71e9488b01f2cd8f9b9d06482392b.tar.zst
pttbbs-1ef1fe4d34d71e9488b01f2cd8f9b9d06482392b.zip
- (internal) add some Maple-3 API interface to help porting
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4099 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/io.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/mbbsd/io.c b/mbbsd/io.c
index ae78bbcd..3e1adbaa 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -366,6 +366,14 @@ _debug_check_keyinput()
static int water_which_flag = 0;
+#ifndef vkey
+int
+vkey(void)
+{
+ return igetch();
+}
+#endif
+
int
igetch(void)
{
@@ -777,8 +785,8 @@ int getDBCSstatus(unsigned char *s, int pos)
#endif
#define MAXLASTCMD 12
-int
-oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
+static int
+getdata_raw(int line, int col, const char *prompt, char *buf, int len, int echo)
{
register int ch, i;
int clen, lprompt = 0;
@@ -1027,23 +1035,36 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
int
getdata_buf(int line, int col, const char *prompt, char *buf, int len, int echo)
{
- return oldgetdata(line, col, prompt, buf, len, echo);
+ return getdata_raw(line, col, prompt, buf, len, echo);
}
int
getdata_str(int line, int col, const char *prompt, char *buf, int len, int echo, const char *defaultstr)
{
- strlcpy(buf, defaultstr, len);
+ // if pointer is the same, ignore copy.
+ if (defaultstr != buf)
+ strlcpy(buf, defaultstr, len);
- return oldgetdata(line, col, prompt, buf, len, echo);
+ return getdata_raw(line, col, prompt, buf, len, echo);
}
int
getdata(int line, int col, const char *prompt, char *buf, int len, int echo)
{
buf[0] = 0;
- return oldgetdata(line, col, prompt, buf, len, echo);
+ return getdata_raw(line, col, prompt, buf, len, echo);
+}
+
+int
+vget(int line, int col, const char *prompt, char *buf, int len, int mode)
+{
+ if (mode & GCARRY)
+ return getdata_raw(line, col, prompt, buf, len, (mode & ~GCARRY));
+ else {
+ buf[0] = 0;
+ return getdata_raw(line, col, prompt, buf, len, mode);
+ }
}
/* vim:sw=4