summaryrefslogtreecommitdiffstats
path: root/mbbsd/pmore.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-11 02:46:52 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-11 02:46:52 +0800
commitf787c8fdfd24555801e2be483d13baaf610298c2 (patch)
tree4934e52fa6f4f5d2ddf5eb428f1abd022874b836 /mbbsd/pmore.c
parentdda5af373350d4b6649335e4ec8600a0baf2afe7 (diff)
downloadpttbbs-f787c8fdfd24555801e2be483d13baaf610298c2.tar
pttbbs-f787c8fdfd24555801e2be483d13baaf610298c2.tar.gz
pttbbs-f787c8fdfd24555801e2be483d13baaf610298c2.tar.bz2
pttbbs-f787c8fdfd24555801e2be483d13baaf610298c2.tar.lz
pttbbs-f787c8fdfd24555801e2be483d13baaf610298c2.tar.xz
pttbbs-f787c8fdfd24555801e2be483d13baaf610298c2.tar.zst
pttbbs-f787c8fdfd24555801e2be483d13baaf610298c2.zip
update ansi escape scanner
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2824 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/pmore.c')
-rw-r--r--mbbsd/pmore.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/mbbsd/pmore.c b/mbbsd/pmore.c
index 2412eb39..3816a82b 100644
--- a/mbbsd/pmore.c
+++ b/mbbsd/pmore.c
@@ -134,8 +134,6 @@ int debug = 0;
// --------------------------- <Display>
/* ANSI COMMAND SYSTEM */
-#define STR_ANSICODE "[0123456789;,"
-
/* On some systems with pmore style ANSI system applied,
* we don't have to define these again.
*/
@@ -153,6 +151,9 @@ int debug = 0;
#define ANSI_MOVETO(y,x) ESC_STR "[" #y ";" #x "H"
#define ANSI_CLRTOEND ESC_STR "[K"
+#define ANSI_IN_ESCAPE(x) (((x) >= '0' && (x) <= '9') || \
+ (x) == ';' || (x) == ',' || (x) == '[')
+
#endif /* PMORE_STYLE_ANSI */
// Poor BBS terminal system Workarounds
@@ -679,7 +680,8 @@ pmore_str_strip_ansi(unsigned char *p) // warning: p is NULL terminated
{
// ansi code sequence, ignore them.
pb = p++;
- while (*p && strchr(STR_ANSICODE, *p++));
+ while (ANSI_IN_ESCAPE(*p))
+ p++;
memmove(pb, p, strlen(p)+1);
p = pb;
}
@@ -855,7 +857,7 @@ MFDISP_PREDICT_LINEWIDTH(unsigned char *p)
{
if(inAnsi)
{
- if(!strchr(STR_ANSICODE, *p))
+ if(!ANSI_IN_ESCAPE(*p))
inAnsi = 0;
} else {
if(*p == ESC_CHR)
@@ -1139,7 +1141,7 @@ mf_display()
{
if(inAnsi)
{
- if (!strchr(STR_ANSICODE, c))
+ if (!ANSI_IN_ESCAPE(c))
inAnsi = 0;
/* whatever this is, output! */
mf.dispe ++;