From a718070f551df52347cadf83eaa09c2f4e1bbe29 Mon Sep 17 00:00:00 2001 From: piaip Date: Fri, 10 Jun 2005 11:19:43 +0000 Subject: pmore: isspace fix git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2820 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/pmore.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/pmore.c b/mbbsd/pmore.c index 13f4edc3..ea3a11b1 100644 --- a/mbbsd/pmore.c +++ b/mbbsd/pmore.c @@ -666,6 +666,9 @@ mf_search(int direction) * maybe you already have your string processors (or not). * whether yes or no, here we provides some. */ + +#define ISSPACE(x) (x <= ' ') + MFPROTO void pmore_str_strip_ansi(unsigned char *p) // warning: p is NULL terminated { @@ -699,12 +702,12 @@ pmore_str_chomp(unsigned char *p) unsigned char *pb = p + strlen(p)-1; while (pb >= p) - if(*pb <= ' ') + if(ISSPACE(*pb)) *pb-- = 0; else break; pb = p; - while (*pb && *pb <= ' ') + while (*pb && ISSPACE(*pb)) pb++; if(pb != p) @@ -813,7 +816,7 @@ mf_parseHeaders() pmore_str_chomp(np); // remove quote and traverse back *pb-- = 0; - while (pb > p && *pb != ',' && *pb <= ' ') + while (pb > p && *pb != ',' && !(ISSPACE(*pb))) pb--; if (pb > p) { -- cgit v1.2.3