From 21b44b65d225d7dc8c73b9d9152a5be646fd72de Mon Sep 17 00:00:00 2001 From: Ianos Gnatiuc Date: Mon, 31 Oct 2005 22:18:26 +0000 Subject: [PATCH] Changed all toupper, tolower, isupper, islower and isalpha to internal defined function. Case insensitive regexp should work on Win9x now. --- docs/notework.txt | 2 ++ golded3/gcalst.cpp | 4 +-- golded3/gcarea.cpp | 6 ++--- golded3/gccfgg.cpp | 2 +- golded3/gccfgg0.cpp | 4 +-- golded3/gccfgg6.cpp | 4 +-- golded3/gccfgg7.cpp | 2 +- golded3/gckeys.cpp | 4 +-- golded3/gclang.cpp | 4 +-- golded3/gearea.cpp | 4 +-- golded3/gectnr.cpp | 2 +- golded3/geedit.cpp | 20 +++++++-------- golded3/geglob.cpp | 2 +- golded3/geinit.cpp | 12 ++++----- golded3/geline.cpp | 10 ++++---- golded3/gemsgs.cpp | 2 +- golded3/gepost.cpp | 4 +-- golded3/gerand.cpp | 4 +-- golded3/gesrch.cpp | 2 +- golded3/getpls.cpp | 2 +- golded3/geutil.cpp | 2 +- golded3/geview.cpp | 2 +- goldlib/gall/gbmh.cpp | 8 +++--- goldlib/gall/gcrchash.cpp | 2 +- goldlib/gall/gcrckeyv.cpp | 2 +- goldlib/gall/gcrcm16.cpp | 2 +- goldlib/gall/gcrcm32.cpp | 2 +- goldlib/gall/gcrcs16.cpp | 4 +-- goldlib/gall/gcrcs32.cpp | 2 +- goldlib/gall/gctype.h | 51 ++++++++++++++++++++++++++++++------- goldlib/gall/gfilutl1.cpp | 6 ++--- goldlib/gall/gftnnlfu.cpp | 2 +- goldlib/gall/gftnnlge.cpp | 2 +- goldlib/gall/gftnnlv7.cpp | 2 +- goldlib/gall/gfuzzy.cpp | 2 +- goldlib/gall/gkbdbase.cpp | 8 +++--- goldlib/gall/gstrctyp.cpp | 6 ++--- goldlib/gall/gstrutil.cpp | 6 ++--- goldlib/gall/gtimutil.cpp | 12 ++++----- goldlib/gall/gutlmisc.cpp | 8 +++--- goldlib/gall/gutlmisc.h | 2 +- goldlib/gall/gutlos.h | 3 --- goldlib/gall/gwildmat.cpp | 8 +++--- goldlib/gall/gwinmenu.cpp | 2 +- goldlib/gall/gwinpcks.cpp | 6 ++--- goldlib/gall/gwinput2.cpp | 4 +-- goldlib/gcfg/gxcrash.cpp | 4 +-- goldlib/gcfg/gxdb.cpp | 18 ++++++------- goldlib/gcfg/gxfm100.cpp | 2 +- goldlib/gcfg/gxfm116.cpp | 2 +- goldlib/gcfg/gxhpt.cpp | 8 +++--- goldlib/gcfg/gximail4.cpp | 2 +- goldlib/gcfg/gxqecho.cpp | 4 +-- goldlib/gcfg/gxspace.cpp | 4 +-- goldlib/gcfg/gxsquish.cpp | 12 ++++----- goldlib/gcfg/gxtimed.cpp | 2 +- goldlib/gcfg/gxtmail.cpp | 2 +- goldlib/gcfg/gxts.cpp | 2 +- goldlib/glibc/fnmatch.c | 24 ++++++++--------- goldlib/glibc/regex.c | 22 ++++++++-------- goldlib/gmb3/gmoezyc4.cpp | 2 +- goldlib/gmb3/gmopcbd3.cpp | 2 +- goldlib/gmb3/gmoxbbs4.cpp | 2 +- goldlib/msgidlib/fexist.c | 6 ++--- goldlib/msgidlib/genmsgid.c | 2 +- goldlib/msgidlib/typedefs.h | 1 + goldlib/uulib/fptools.c | 17 +++++++------ goldlib/uulib/uucheck.c | 19 +++++++------- goldlib/uulib/uunconc.c | 9 ++++--- 69 files changed, 228 insertions(+), 192 deletions(-) diff --git a/docs/notework.txt b/docs/notework.txt index b1f8eab..e9300e1 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -10,6 +10,8 @@ ______________________________________________________________________ Notes for GoldED+ 1.1.5, /snapshot/ ______________________________________________________________________ +- Case insensitive regexp should work on Win9x now. + + New config file token LatinToLocal. Used to translate latin A-Za-z to local charset if one of neighbours is from local charset too. diff --git a/golded3/gcalst.cpp b/golded3/gcalst.cpp index 41f57da..20f8eac 100644 --- a/golded3/gcalst.cpp +++ b/golded3/gcalst.cpp @@ -281,7 +281,7 @@ void AreaList::WriteAreaDef(const char* file) { maxpath = MaxV(maxpath, tmp); if((*aa)->groupid() & 0x8000u) sprintf(groupid, "#%u", (*aa)->groupid()&0x7FFF); - else if(isupper((*aa)->groupid())) + else if(g_isupper((*aa)->groupid())) *groupid = (char)(*aa)->groupid(), groupid[1] = NUL; else *groupid = '0', groupid[1] = NUL; @@ -301,7 +301,7 @@ void AreaList::WriteAreaDef(const char* file) { sprintf(desc, "\"%s\"", (*aa)->desc()); if((*aa)->groupid() & 0x8000u) sprintf(groupid, "#%u", (*aa)->groupid()&0x7FFF); - else if(isupper((*aa)->groupid())) + else if(g_isupper((*aa)->groupid())) *groupid = (char)(*aa)->groupid(), groupid[1] = NUL; else *groupid = '0', groupid[1] = NUL; diff --git a/golded3/gcarea.cpp b/golded3/gcarea.cpp index ccb6bcc..de9e55a 100644 --- a/golded3/gcarea.cpp +++ b/golded3/gcarea.cpp @@ -474,7 +474,7 @@ void AreaList::GetArea(char* def) { StripQuotes(desc); // Copy description, stripping quotes ("") aa.setdesc(desc); - switch(toupper(*base)) { // Store area info + switch(g_toupper(*base)) { // Store area info case '-': aa.basetype = "SEPARATOR"; @@ -859,7 +859,7 @@ void AreaList::ReadEcholist(char* val) { continue; } else if(is_dz) { - if(not isalpha(*val) and (*val != ',')) + if(not g_isalpha(*val) and (*val != ',')) continue; tok(&key, &val); } @@ -877,7 +877,7 @@ void AreaList::ReadEcholist(char* val) { } for(area_iterator ap = idx.begin(); ap != idx.end(); ap++) { if(strieql(key, (*ap)->echoid())) { - (*ap)->set_groupid(toupper(*grp)); + (*ap)->set_groupid(g_toupper(*grp)); if(desc) (*ap)->set_desc(desc); break; diff --git a/golded3/gccfgg.cpp b/golded3/gccfgg.cpp index 41d83f3..32692ed 100644 --- a/golded3/gccfgg.cpp +++ b/golded3/gccfgg.cpp @@ -42,7 +42,7 @@ int getgroup(const char *key) if(*key == '#') return atoi(key+1)+0x8000u; else - return (isupper(*key) ? *key : 0); + return (g_isupper(*key) ? *key : 0); } diff --git a/golded3/gccfgg0.cpp b/golded3/gccfgg0.cpp index f03b283..54cd26ae 100644 --- a/golded3/gccfgg0.cpp +++ b/golded3/gccfgg0.cpp @@ -149,7 +149,7 @@ int SwitchCfg(word crc, char k, char* v) { return true; // Switch the first letter of the keyword - switch(toupper(k)) { + switch(g_toupper(k)) { case 'A': goto SwitchA; case 'B': goto SwitchB; case 'C': goto SwitchC; @@ -742,7 +742,7 @@ int ReadCfg(const char* cfgfile, int ignoreunknown) { val = strskip_wht(val); - if(isalpha(*val)) { + if(g_isalpha(*val)) { // Extract key and val crc = getkeyvalcrc(&key, &val); diff --git a/golded3/gccfgg6.cpp b/golded3/gccfgg6.cpp index 43741b9..d9b0e78 100644 --- a/golded3/gccfgg6.cpp +++ b/golded3/gccfgg6.cpp @@ -137,7 +137,7 @@ void CfgNodev7flags() { char* flagstring = t.First(val); char* flagvals = t.Next(); uint flagval; - if(tolower(*flagvals) == 'b') + if(g_tolower(*flagvals) == 'b') flagval = atoi(flagvals+1); else { flagval = atoi(flagvals); @@ -168,7 +168,7 @@ void CfgNodev7modem() { char* modemstring = t.First(val); char* modemvals = t.Next(); int modemval; - if(tolower(*modemvals) == 'b') + if(g_tolower(*modemvals) == 'b') modemval = atoi(modemvals+1); else { modemval = atoi(modemvals); diff --git a/golded3/gccfgg7.cpp b/golded3/gccfgg7.cpp index ae31b00..67a32fe 100644 --- a/golded3/gccfgg7.cpp +++ b/golded3/gccfgg7.cpp @@ -407,7 +407,7 @@ void CfgSeqOutRun() { CfgSeqOutRun_Error(); return; } - switch(tolower(*p)) { + switch(g_tolower(*p)) { case 'y': s *= 365; case 'd': diff --git a/golded3/gckeys.cpp b/golded3/gckeys.cpp index d6c5bec..ef4ccdc 100644 --- a/golded3/gckeys.cpp +++ b/golded3/gckeys.cpp @@ -966,7 +966,7 @@ static void SetKeybDefaults() { int k = 0; while(k < keys) { if(tmp->key <= 0xFF) - tmp->key = (gkey)tolower(tmp->key); + tmp->key = (gkey)g_tolower(tmp->key); KeyCmdAdd(tmp->cmd, tmp->key, tmp->type); tmp++; k++; @@ -1037,7 +1037,7 @@ int ReadKeysCfg(int force) { keyval = (gkey)_keyval; } else if(strlen(ptr2) == 1) - keyval = (gkey)tolower(*ptr2); // Always convert to lowercase internally + keyval = (gkey)g_tolower(*ptr2); // Always convert to lowercase internally else { keycmd = SwitchKeyDefs(strCrc16(strupr(ptr2)), &keytype); if(not keycmd or keytype) { diff --git a/golded3/gclang.cpp b/golded3/gclang.cpp index 2086beb..583b571 100644 --- a/golded3/gclang.cpp +++ b/golded3/gclang.cpp @@ -658,7 +658,7 @@ void LoadLanguage(const char* file) { while(fgets((ptr=buf), sizeof(buf), fp)) { line++; ptr = strskip_wht(ptr); - if(isalpha(*ptr)) { + if(g_isalpha(*ptr)) { str = ptr; strtrim(str); str = strskip_txt(str); @@ -715,7 +715,7 @@ bool ReadLangCfg(int force) { while(fgets((ptr=buf), sizeof(buf), fpi)) { line++; ptr = strskip_wht(ptr); - if(isalpha(*ptr)) { + if(g_isalpha(*ptr)) { str = ptr; strtrim(str); str = strskip_txt(str); diff --git a/golded3/gearea.cpp b/golded3/gearea.cpp index 6c12473..870bf9c 100644 --- a/golded3/gearea.cpp +++ b/golded3/gearea.cpp @@ -193,7 +193,7 @@ void GPickArealist::dispbuf(char* buf, int areano) { if(groupid_width > 2) sprintf(groupidbuf, "%u", area->groupid()&0x7FFF); } - else if(isupper(area->groupid())) + else if(g_isupper(area->groupid())) sprintf(groupidbuf, "%c", (char)area->groupid()); } int groupidwidth = strlen(groupidbuf); @@ -748,7 +748,7 @@ bool GPickArealist::handle_key() { default: if(key < KK_Macro) { - n = toupper(key & 0xFF); + n = g_toupper(key & 0xFF); if((area_fuzidx < area_maxfuz) or (key == Key_BS)) { // Incremental search in the echoids diff --git a/golded3/gectnr.cpp b/golded3/gectnr.cpp index 28dc3a6..12c91d3 100644 --- a/golded3/gectnr.cpp +++ b/golded3/gectnr.cpp @@ -43,7 +43,7 @@ static bool strncont(const char *beginword, const char *stylestopchars, int n) static bool in_ftn_domained_address(const char *ptr, const char *txt) { - while((ptr != txt) and (not isspace(*ptr) and not isalpha(*ptr))) { + while((ptr != txt) and (not isspace(*ptr) and not g_isalpha(*ptr))) { if(isdigit(ptr[0]) and ((ptr[1] == ':') or (ptr[1] == '/')) and isdigit(ptr[2])) return true; --ptr; diff --git a/golded3/geedit.cpp b/golded3/geedit.cpp index a01be93..3e66de3 100644 --- a/golded3/geedit.cpp +++ b/golded3/geedit.cpp @@ -1998,7 +1998,7 @@ void IEclass::ToUpper() { if(col < currline->txt.length()) { Undo->PushItem(EDIT_UNDO_OVR_CHAR); - currline->txt[col] = toupper(currline->txt[col]); + currline->txt[col] = g_toupper(currline->txt[col]); } GFTRK(NULL); @@ -2013,7 +2013,7 @@ void IEclass::ToLower() { if(col < currline->txt.length()) { Undo->PushItem(EDIT_UNDO_OVR_CHAR); - currline->txt[col] = tolower(currline->txt[col]); + currline->txt[col] = g_tolower(currline->txt[col]); } GFTRK(NULL); @@ -2028,10 +2028,10 @@ void IEclass::ToggleCase() { if(col < currline->txt.length()) { Undo->PushItem(EDIT_UNDO_OVR_CHAR); - if(toupper(currline->txt[col]) == currline->txt[col]) - currline->txt[col] = tolower(currline->txt[col]); + if(g_toupper(currline->txt[col]) == currline->txt[col]) + currline->txt[col] = g_tolower(currline->txt[col]); else - currline->txt[col] = toupper(currline->txt[col]); + currline->txt[col] = g_toupper(currline->txt[col]); } GFTRK(NULL); @@ -2050,18 +2050,18 @@ void IEclass::ToggleCaseChar(gkey key, switch (key) { case KK_EditToLower: - newchar = tolower(*it); + newchar = g_tolower(*it); break; case KK_EditToUpper: - newchar = toupper(*it); + newchar = g_toupper(*it); break; case KK_EditToggleCase: - if (toupper(*it) == oldchar) - newchar = tolower(*it); + if (g_toupper(*it) == oldchar) + newchar = g_tolower(*it); else - newchar = toupper(*it); + newchar = g_toupper(*it); break; } diff --git a/golded3/geglob.cpp b/golded3/geglob.cpp index 59238fe..84b2d71 100644 --- a/golded3/geglob.cpp +++ b/golded3/geglob.cpp @@ -259,7 +259,7 @@ bool inline samekey(gkey key1, gkey key2) { return true; if((key1 > 0xFF) or (key2 > 0xFF)) return false; - return (tolower(key1) == key2) or (tolower(key2) == key1); + return (g_tolower(key1) == key2) or (g_tolower(key2) == key1); } diff --git a/golded3/geinit.cpp b/golded3/geinit.cpp index e242bef..773da03 100644 --- a/golded3/geinit.cpp +++ b/golded3/geinit.cpp @@ -76,7 +76,7 @@ static void InitCmdline(char* val) { trueval = val; if(*val == NUL) val = key+1; - switch(toupper(*key)) { + switch(g_toupper(*key)) { case 'C': // Use another Configfile if(*val) strcpy(cmdlinecfg, val); @@ -94,7 +94,7 @@ static void InitCmdline(char* val) { break; case 'F': cmdlineforce = make_bool_not(*val == '-'); - if(toupper(key[1]) == 'F') + if(g_toupper(key[1]) == 'F') cmdlineforce++; break; case '?': @@ -134,7 +134,7 @@ static void InitCmdline(char* val) { break; case 'V': quiet = false; - veryverbose = (toupper(key[1]) == 'V'); + veryverbose = (g_toupper(key[1]) == 'V'); break; case 'W': cmdlinewriteareas = make_bool_not(*val == '-'); @@ -318,7 +318,7 @@ static void kbputstr(const char* buf) { break; case '~': case '^': - xkey = (gkey)(toupper(buf[++n]) - '@'); + xkey = (gkey)(g_toupper(buf[++n]) - '@'); if(xkey) kbput(xkey); break; @@ -974,13 +974,13 @@ void Initialize(int argc, char* argv[]) { int pos = 0; char* p = CFG->arealistformat; while(*p) { - char c = (char)toupper(*p); + char c = (char)g_toupper(*p); char d = *(++p); int w = atoi(p); while(isdigit(*p)) p++; if(pass == 1) { - if(isalpha(c)) { + if(g_isalpha(c)) { switch(c) { case 'A': area_found = true; if(isdigit(d)) area_width = w; break; case 'M': marked_found = true; if(isdigit(d)) marked_width = w; break; diff --git a/golded3/geline.cpp b/golded3/geline.cpp index daf0f15..46998db 100644 --- a/golded3/geline.cpp +++ b/golded3/geline.cpp @@ -756,7 +756,7 @@ void KludgeDATE(GMsg* msg, const char* ptr) { if(isdigit(*ptr)) { day = atoi(ptr); ptr = strskip_wht(strskip_txt(ptr)); - if(isalpha(*ptr)) { + if(g_isalpha(*ptr)) { month = str2mon(ptr); if(month) { ptr = strskip_wht(strskip_txt(ptr)); @@ -1383,7 +1383,7 @@ int ScanLine(GMsg* msg, Line* line, const char* ptr, int getvalue, int mask) { // Skip past "RFC" string, if any if(strnieql(kludge1, "RFC", 3) and (kludge1[3] != ':')) { kludge1 += 3; - if(not isalpha(*kludge1)) + if(not g_isalpha(*kludge1)) kludge1++; } @@ -1696,8 +1696,8 @@ void Latin2Local(char *str) byte left = i ? str[i-1] : 0; byte right = str[i+1]; - if (((left >= 0x80) && (toupper(left) != tolower(left))) || - ((right >= 0x80) && (toupper(right) != tolower(right)))) + if (((left >= 0x80) && (g_toupper(left) != g_tolower(left))) || + ((right >= 0x80) && (g_toupper(right) != g_tolower(right)))) { str[i] = xch; @@ -2101,7 +2101,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool getvalue, bool header_recode) { char* kludge = ptr + (*ptr == CTRL_A ? 1 : 0); if(strnieql(kludge, "RFC", 3)) { kludge += 3; - if(not isalpha(*kludge)) + if(not g_isalpha(*kludge)) kludge++; } while((*ptr != ' ') and (*ptr != ':') and *ptr) diff --git a/golded3/gemsgs.cpp b/golded3/gemsgs.cpp index e676804..d1bfb10 100644 --- a/golded3/gemsgs.cpp +++ b/golded3/gemsgs.cpp @@ -430,7 +430,7 @@ char* TokenXlat(int mode, char* input, GMsg* msg, GMsg* oldmsg, int __origarea) char buff[1024]; char token[1024]; char fill = dst[5]; - char align = toupper(dst[6]); + char align = g_toupper(dst[6]); int size = atoi(dst+7); if (strchr("CLR", align)) diff --git a/golded3/gepost.cpp b/golded3/gepost.cpp index 82462ec..f11ed1a 100644 --- a/golded3/gepost.cpp +++ b/golded3/gepost.cpp @@ -56,7 +56,7 @@ std::string &strtrimline(std::string &p) { const char* get_subject_re_info(const char* s, uint32_t& n) { - if(toupper(*s) == 'R' and tolower(s[1]) == 'e') { + if(g_toupper(*s) == 'R' and g_tolower(s[1]) == 'e') { if(s[2] == ':') { n = 1; @@ -99,7 +99,7 @@ void CheckSubject(GMsg* msg, char* subj) { #ifdef __UNIX__ if((*ptr == '/') and not strchr(ptr, ':')) { /* } */ #else - if((in_range((char)tolower(*ptr), (char)'c', (char)'z') and (ptr[1] == ':')) or ((*ptr == '\\') and (ptr[1] == '\\'))) { + if((in_range((char)g_tolower(*ptr), (char)'c', (char)'z') and (ptr[1] == ':')) or ((*ptr == '\\') and (ptr[1] == '\\'))) { #endif // Autoattach msg->attr.att1(); diff --git a/golded3/gerand.cpp b/golded3/gerand.cpp index 58c1210..2b59c61 100644 --- a/golded3/gerand.cpp +++ b/golded3/gerand.cpp @@ -199,7 +199,7 @@ void Area::InitData() { if(groupid() & 0x8000u) sprintf(_groupid, "#%u", groupid() & 0x7FFF); else { - _groupid[0] = (char)(isalpha(groupid()) ? groupid() : NUL); + _groupid[0] = (char)(g_isalpha(groupid()) ? groupid() : NUL); _groupid[1] = NUL; } } @@ -244,7 +244,7 @@ void Area::RandomizeData(int mode) { if(groupid() & 0x8000u) sprintf(_groupid, "#%u", groupid() & 0x7FFF); else { - _groupid[0] = (char)(isalpha(groupid()) ? groupid() : NUL); + _groupid[0] = (char)(g_isalpha(groupid()) ? groupid() : NUL); _groupid[1] = NUL; } } diff --git a/golded3/gesrch.cpp b/golded3/gesrch.cpp index 701ddce..667d3d0 100644 --- a/golded3/gesrch.cpp +++ b/golded3/gesrch.cpp @@ -74,7 +74,7 @@ const char* search_item_set(search_item& item, const char* s) { case '=': search_item_option(item.case_sensitive, s); break; case '?': s++; - switch(tolower(*s)) { + switch(g_tolower(*s)) { case 'r': item.type = gsearch::regex; break; case 'w': item.type = gsearch::wildcard; break; case 'p': item.type = gsearch::plain; break; diff --git a/golded3/getpls.cpp b/golded3/getpls.cpp index 3cb9b13..154e9c5 100644 --- a/golded3/getpls.cpp +++ b/golded3/getpls.cpp @@ -63,7 +63,7 @@ bool is_user(const char* name) { inline int IsInitial(char c) { - return isalpha(c) or (c > 127); + return g_isalpha(c) or (c > 127); } diff --git a/golded3/geutil.cpp b/golded3/geutil.cpp index 6344d86..7f9be47 100644 --- a/golded3/geutil.cpp +++ b/golded3/geutil.cpp @@ -411,7 +411,7 @@ bool is_quote2(Line* line, const char* ptr) int nr = 0; for (char *tmp = head; tmp < ptr; tmp++) { - char ch = toupper(*tmp); + char ch = g_toupper(*tmp); if ((ch >= 'A') && (ch <= 'Z')) nr++; } diff --git a/golded3/geview.cpp b/golded3/geview.cpp index 0b51b2b..b77c90e 100644 --- a/golded3/geview.cpp +++ b/golded3/geview.cpp @@ -297,7 +297,7 @@ void GMsgHeaderView::Paint() { while(ptr) { if(*ptr == '^') ptr++; - if((isalpha(*ptr) and (ptr[1] == ':')) or (ptr[0] == '\\') or (ptr[0] == '/')) + if((g_isalpha(*ptr) and (ptr[1] == ':')) or (ptr[0] == '\\') or (ptr[0] == '/')) strcpy(buf2, ptr); else sprintf(buf2, "%s%s", CFG->inboundpath, ptr); diff --git a/goldlib/gall/gbmh.cpp b/goldlib/gall/gbmh.cpp index b4196a2..2f79a33 100644 --- a/goldlib/gall/gbmh.cpp +++ b/goldlib/gall/gbmh.cpp @@ -69,7 +69,7 @@ void gbmh::init(const char* pattern, bool ignorecase) { strupr(pat); #else /* strupr() is wrong on windows 9x (patch from Ianos Gnatiuc 2:469/335.155) */ for(char *ptr = pat; *ptr; ptr++) - *ptr = toupper(*ptr); + *ptr = g_toupper(*ptr); #endif } @@ -80,12 +80,12 @@ void gbmh::init(const char* pattern, bool ignorecase) { for(i=0; i= 0 and toupper((uint8_t)s[j]) == pat[j]) + while(--j >= 0 and g_toupper((uint8_t)s[j]) == pat[j]) ; } else { diff --git a/goldlib/gall/gcrchash.cpp b/goldlib/gall/gcrchash.cpp index c2e761e..48d81e1 100644 --- a/goldlib/gall/gcrchash.cpp +++ b/goldlib/gall/gcrchash.cpp @@ -46,7 +46,7 @@ dword strHash32(const char* s, bool __case) { while(*p) { - hash = (hash << 4) + (__case ? tolower(*p) : *p); + hash = (hash << 4) + (__case ? g_tolower(*p) : *p); g = hash & 0xF0000000UL; if(g) { diff --git a/goldlib/gall/gcrckeyv.cpp b/goldlib/gall/gcrckeyv.cpp index 206166a..84ea491 100644 --- a/goldlib/gall/gcrckeyv.cpp +++ b/goldlib/gall/gcrckeyv.cpp @@ -145,7 +145,7 @@ word getkeyvalcrc(char** key, char** val) { // Calculate CRC16 of keyword while(*p) - c = updCrc16((byte)toupper(*p++), c); + c = updCrc16((byte)g_toupper(*p++), c); // Return keyword CRC return c; diff --git a/goldlib/gall/gcrcm16.cpp b/goldlib/gall/gcrcm16.cpp index 8077d66..147fbcf 100644 --- a/goldlib/gall/gcrcm16.cpp +++ b/goldlib/gall/gcrcm16.cpp @@ -39,7 +39,7 @@ word memCrc16(const void* _m, long l, bool __case, word mask) { if(__case) { for(n=0; n #if defined(__EMX__) #include -#define tolower(c) _nls_tolower((uint8_t)(c)) -#define toupper(c) _nls_toupper((uint8_t)(c)) +#define g_tolower(c) _nls_tolower((uint8_t)(c)) +#define g_toupper(c) _nls_toupper((uint8_t)(c)) #elif defined(__WIN32__) #ifdef __cplusplus extern "C" { extern char tl[256], tu[256]; -__inline__ int tolower(int c) { return tl[c]; } -__inline__ int toupper(int c) { return tu[c]; } +__inline__ int g_tolower(int c) { return tl[c]; } +__inline__ int g_toupper(int c) { return tu[c]; } } #else extern char tl[256], tu[256]; -#define tolower(c) tl[(int)(uint8_t)(c)] -#define toupper(c) tu[(int)(uint8_t)(c)] +#define g_tolower(c) tl[(int)(uint8_t)(c)] +#define g_toupper(c) tu[(int)(uint8_t)(c)] #endif #endif @@ -64,14 +64,47 @@ extern char tl[256], tu[256]; * they don't match they treated as characters */ +#if defined(__WIN32__) + #ifdef __cplusplus extern "C" { -#endif -extern __inline__ int isxalnum(char c) { - return isascii(c) ? isalnum(c) : (c != tolower(c)) || (c != toupper(c)); +__inline__ int g_islower(int c) +{ + return isascii(c) ? islower(c) : (c == g_tolower(c)) && (c != g_toupper(c)); } + +__inline__ int g_isupper(int c) +{ + return isascii(c) ? isupper(c) : (c != g_tolower(c)) && (c == g_toupper(c)); +} + +__inline__ int g_isalpha(int c) +{ + return isascii(c) ? isalpha(c) : (c != g_tolower(c)) || (c != g_toupper(c)); +} +} +#else +#define g_islower(c) (isascii(c) ? islower(c) : ((c) == g_tolower(c)) && ((c) != g_toupper(c))) +#define g_isupper(c) (isascii(c) ? isupper(c) : ((c) != g_tolower(c)) && ((c) == g_toupper(c))) +#define g_isalpha(c) (isascii(c) ? isalpha(c) : ((c) != g_tolower(c)) || ((c) != g_toupper(c))) +#endif //#ifdef __cplusplus + +#else +#define g_islower islower +#define g_isupper isupper +#define g_isalpha isalpha +#endif //#if defined(__WIN32__) + + #ifdef __cplusplus +extern "C" { +__inline__ int isxalnum(int c) +{ + return isascii(c) ? isalnum(c) : (c != g_tolower(c)) || (c != g_toupper(c)); } +} +#else +#define isxalnum(c) (isascii(c) ? isalnum(c) : ((c) != g_tolower(c)) || ((c) != g_toupper(c))) #endif #ifdef __BEOS__ diff --git a/goldlib/gall/gfilutl1.cpp b/goldlib/gall/gfilutl1.cpp index 9140c2d..16c32e2 100644 --- a/goldlib/gall/gfilutl1.cpp +++ b/goldlib/gall/gfilutl1.cpp @@ -168,7 +168,7 @@ int is_dir(const char* path) { // Check if it's a root path (X:\) #if defined(__HAVE_DRIVES__) - if(isalpha(path[0]) and (path[1] == ':') and isslash(path[2]) and (path[3] == NUL)) + if(g_isalpha(path[0]) and (path[1] == ':') and isslash(path[2]) and (path[3] == NUL)) return true; // The root is a directory #endif @@ -226,7 +226,7 @@ void MakePathname(char* pathname, const char* path, const char* name) { have_path = true; #if defined(__HAVE_DRIVES__) // Check if it's a root path (X:\) - else if(isalpha(tmpname[0]) and (tmpname[1] == ':') and isslash(tmpname[2])) + else if(g_isalpha(tmpname[0]) and (tmpname[1] == ':') and isslash(tmpname[2])) have_path = true; // The root is a directory #endif @@ -416,7 +416,7 @@ int gchdir(const char* dir) { _chdrive(*dir); #else uint drives; - _dos_setdrive(toupper(*dir)-'@', &drives); + _dos_setdrive(g_toupper(*dir)-'@', &drives); #endif } #endif diff --git a/goldlib/gall/gftnnlfu.cpp b/goldlib/gall/gftnnlfu.cpp index f5e91e5..0b84fc2 100644 --- a/goldlib/gall/gftnnlfu.cpp +++ b/goldlib/gall/gftnnlfu.cpp @@ -75,7 +75,7 @@ int ftn_fidouser_nodelist_index::namecmp() const { int n = 1; int d; while(1) { - d = tolower(*a) - tolower(*b); + d = g_tolower(*a) - g_tolower(*b); if((d != 0) or (*a == NUL) or (*b == NUL)) break; a++; diff --git a/goldlib/gall/gftnnlge.cpp b/goldlib/gall/gftnnlge.cpp index f9ea4ba..ae77a51 100644 --- a/goldlib/gall/gftnnlge.cpp +++ b/goldlib/gall/gftnnlge.cpp @@ -172,7 +172,7 @@ int ftn_golded_nodelist_index::namecmp() const { int n = 1; int d; while(1) { - d = tolower(*a) - tolower(*b); + d = g_tolower(*a) - g_tolower(*b); if((d != 0) or (*a == NUL) or (*b == NUL)) break; a++; diff --git a/goldlib/gall/gftnnlv7.cpp b/goldlib/gall/gftnnlv7.cpp index 386e93f..3ae4fc2 100644 --- a/goldlib/gall/gftnnlv7.cpp +++ b/goldlib/gall/gftnnlv7.cpp @@ -141,7 +141,7 @@ int ftn_version7_nodelist_index::namecmp() const { int n = 1; int d; while(1) { - d = tolower((uint8_t)*a) - tolower((uint8_t)*b); + d = g_tolower((uint8_t)*a) - g_tolower((uint8_t)*b); if((d != 0) or (*a == NUL) or (*b == NUL)) break; a++; diff --git a/goldlib/gall/gfuzzy.cpp b/goldlib/gall/gfuzzy.cpp index 990e318..2d8553e 100644 --- a/goldlib/gall/gfuzzy.cpp +++ b/goldlib/gall/gfuzzy.cpp @@ -140,7 +140,7 @@ bool gfuzzy::findnext() { if(casing) charmatch = pattern[i] == text[textloc]; else - charmatch = toupper(pattern[i]) == toupper(text[textloc]); + charmatch = g_toupper(pattern[i]) == g_toupper(text[textloc]); int a = ldiff[i] + (charmatch ? 0 : 1); int b = ldiff[i+1] + 1; int c = rdiff[i] + 1; diff --git a/goldlib/gall/gkbdbase.cpp b/goldlib/gall/gkbdbase.cpp index bd70396..990bb53 100644 --- a/goldlib/gall/gkbdbase.cpp +++ b/goldlib/gall/gkbdbase.cpp @@ -940,7 +940,7 @@ int gkbd_nt2bios(INPUT_RECORD& inp) { else { // If it is a letter key, use the ASCII value supplied // by NT to take into account the CapsLock state. - if(isupper(keycode) or (k->normal == -1)) + if(g_isupper(keycode) or (k->normal == -1)) c = ascii; else c = k->normal; @@ -1087,7 +1087,7 @@ gkey kbxget_raw(int mode) { k = 0x7800 + ((key2 - '1') << 8); else if(key2 == '0') k = 0x8100; - else if(isalpha(key2)) + else if(g_isalpha(key2)) k = (scancode_table[key2]); else if(key2 == '\010') k = Key_A_BS; @@ -1807,8 +1807,8 @@ int setonkey(gkey keycode, VfvCP func, gkey pass) { gkey key_tolower(gkey __keycode) { byte &ascii = KCodAsc(__keycode); - if(isupper(ascii)) - ascii = tolower(ascii); + if(g_isupper(ascii)) + ascii = g_tolower(ascii); return __keycode; } diff --git a/goldlib/gall/gstrctyp.cpp b/goldlib/gall/gstrctyp.cpp index 2a4a0db..773744e 100644 --- a/goldlib/gall/gstrctyp.cpp +++ b/goldlib/gall/gstrctyp.cpp @@ -37,7 +37,7 @@ static char touplow(char* str, char* pos, char ch) { char i; if(pos == str) - return toupper(ch); + return g_toupper(ch); switch(*(pos-1)) { // check previous character case ' ': // see if it is a separator @@ -46,10 +46,10 @@ static char touplow(char* str, char* pos, char ch) { case ',': case '.': case '/': - i = (char)toupper(ch); // if it is, convert to upper + i = (char)g_toupper(ch); // if it is, convert to upper break; default: - i = (char)tolower(ch); // otherwise, convert to lower + i = (char)g_tolower(ch); // otherwise, convert to lower break; } diff --git a/goldlib/gall/gstrutil.cpp b/goldlib/gall/gstrutil.cpp index 7870fe2..3f88679 100644 --- a/goldlib/gall/gstrutil.cpp +++ b/goldlib/gall/gstrutil.cpp @@ -127,7 +127,7 @@ int strnicmpw(const char* str1, const char* str2, int len) { else if(str1[n] == '*') return 0; // Compare chars - else if((cmp = compare_two(toupper(str1[n]), toupper(str2[n]))) != 0) + else if((cmp = compare_two(g_toupper(str1[n]), g_toupper(str2[n]))) != 0) return cmp; } @@ -605,7 +605,7 @@ char* strupr(char* s) { char* p = s; while(*p) { - *p = toupper(*p); + *p = g_toupper(*p); p++; } return s; @@ -615,7 +615,7 @@ char* strlwr(char* s) { char* p = s; while(*p) { - *p = tolower(*p); + *p = g_tolower(*p); p++; } return s; diff --git a/goldlib/gall/gtimutil.cpp b/goldlib/gall/gtimutil.cpp index eaa21f5..04b2cb8 100644 --- a/goldlib/gall/gtimutil.cpp +++ b/goldlib/gall/gtimutil.cpp @@ -283,9 +283,9 @@ int str2mon(const char* ptr) { int mon; - switch(toupper(*ptr)) { + switch(g_toupper(*ptr)) { case 'A': - if(toupper(ptr[1]) == 'P') + if(g_toupper(ptr[1]) == 'P') mon = 4; else mon = 8; @@ -297,15 +297,15 @@ int str2mon(const char* ptr) { mon = 2; break; case 'J': - if(toupper(ptr[1]) == 'A') + if(g_toupper(ptr[1]) == 'A') mon = 1; - else if(toupper(ptr[2]) == 'L') + else if(g_toupper(ptr[2]) == 'L') mon = 7; else mon = 6; break; case 'M': - if(toupper(ptr[2]) == 'R') + if(g_toupper(ptr[2]) == 'R') mon = 3; else mon = 5; @@ -405,7 +405,7 @@ time32_t FidoTimeToUnix(char* ptr) { if(isdigit(*ptr)) { day = atoi(ptr); ptr = strskip_wht(strskip_txt(ptr)); - if(isalpha(*ptr)) { + if(g_isalpha(*ptr)) { month = str2mon(ptr); if(month) { ptr = strskip_wht(strskip_txt(ptr)); diff --git a/goldlib/gall/gutlmisc.cpp b/goldlib/gall/gutlmisc.cpp index f293c3e..52b7503 100644 --- a/goldlib/gall/gutlmisc.cpp +++ b/goldlib/gall/gutlmisc.cpp @@ -38,7 +38,7 @@ int GetYesno(const char* value) { if(isdigit(*value)) return atoi(value); - switch(toupper(*value)) { + switch(g_toupper(*value)) { case NUL: // Blank case 'T': // True @@ -50,15 +50,15 @@ int GetYesno(const char* value) { return NO; case 'O': // On or Off - if(toupper(value[1]) == 'N') + if(g_toupper(value[1]) == 'N') return YES; else return NO; case 'A': // Always, Ask or Auto - if(toupper(value[1]) == 'L') + if(g_toupper(value[1]) == 'L') return ALWAYS; - else if(toupper(value[1]) == 'S') + else if(g_toupper(value[1]) == 'S') return ASK; else return GAUTO; diff --git a/goldlib/gall/gutlmisc.h b/goldlib/gall/gutlmisc.h index f248c35..7c09cd0 100644 --- a/goldlib/gall/gutlmisc.h +++ b/goldlib/gall/gutlmisc.h @@ -42,7 +42,7 @@ uint32_t atoulx(const char* s); inline word atow(const char* p) { return (word)atoi(p); } -inline int xtoi(char c) { return isdigit(c) ? (c - '0') : (toupper(c) - ('A' - 10)); } +inline int xtoi(char c) { return isdigit(c) ? (c - '0') : (g_toupper(c) - ('A' - 10)); } inline int atox(const char* s) { return (int)atoulx(s); } char* ltob(char* dst, uint32_t value, int fill=32); diff --git a/goldlib/gall/gutlos.h b/goldlib/gall/gutlos.h index f70f288..e308639 100644 --- a/goldlib/gall/gutlos.h +++ b/goldlib/gall/gutlos.h @@ -64,9 +64,6 @@ int g_put_clip_text(const char *cd); void g_get_ostitle_name(char *); void g_set_ostitle_name(char *, int); -char g_tolower(char); -char g_toupper(char); - #ifdef __cplusplus } #endif diff --git a/goldlib/gall/gwildmat.cpp b/goldlib/gall/gwildmat.cpp index 46a70b9..f8ba3b8 100644 --- a/goldlib/gall/gwildmat.cpp +++ b/goldlib/gall/gwildmat.cpp @@ -105,7 +105,7 @@ int gwildmatch::match_internal(const char* text, const char* pattern, bool ignor matched = false; if(p[1] == ']' or p[1] == '-') { if(ignorecase) { - if(tolower(*++p) == tolower(*text)) + if(g_tolower(*++p) == g_tolower(*text)) matched = true; } else { @@ -116,7 +116,7 @@ int gwildmatch::match_internal(const char* text, const char* pattern, bool ignor for(last = *p; *++p and *p != ']'; last = *p) { // This next line requires a good C compiler if(ignorecase) { - if(*p == '-' and p[1] != ']' ? tolower(*text) <= tolower(*++p) and tolower(*text) >= tolower(last) : tolower(*text) == tolower(*p)) + if(*p == '-' and p[1] != ']' ? g_tolower(*text) <= g_tolower(*++p) and g_tolower(*text) >= g_tolower(last) : g_tolower(*text) == g_tolower(*p)) matched = true; } else { @@ -133,7 +133,7 @@ int gwildmatch::match_internal(const char* text, const char* pattern, bool ignor // FALLTHROUGH default: if(ignorecase) { - if(tolower(*text) != tolower(*p)) + if(g_tolower(*text) != g_tolower(*p)) return false; } else { @@ -186,7 +186,7 @@ bool strwild(const char* str, const char* wild) { break; } } - else if(toupper(*str) == toupper(*wild) or *wild == '?') { + else if(g_toupper(*str) == g_toupper(*wild) or *wild == '?') { wild++; str++; } diff --git a/goldlib/gall/gwinmenu.cpp b/goldlib/gall/gwinmenu.cpp index c3cf39f..e22c60f 100644 --- a/goldlib/gall/gwinmenu.cpp +++ b/goldlib/gall/gwinmenu.cpp @@ -1216,7 +1216,7 @@ int wmenuget() { item=citem->next; for(;;) { while(item!=NULL) { - if ((toupper(ch)==toupper(item->schar)) && !(item->fmask & M_NOSEL)) + if ((g_toupper(ch)==g_toupper(item->schar)) && !(item->fmask & M_NOSEL)) { if (!gwin.menu->hotkey) _overtagid = item->tagid; goto FARBREAK; diff --git a/goldlib/gall/gwinpcks.cpp b/goldlib/gall/gwinpcks.cpp index a96fd61..ab88eab 100644 --- a/goldlib/gall/gwinpcks.cpp +++ b/goldlib/gall/gwinpcks.cpp @@ -678,15 +678,15 @@ int wpickstr(int srow, int scol, int erow, int ecol, int btype, int bordattr, in // position for the item that begins with the same ASCII // character as the keypress. If not found after current // position, search from the beginning for a match - ch = (char)toupper((char)xch); + ch = (char)g_toupper((char)xch); if(!ch) break; for(i=r.curr+1; iallocated and strchr("QFqf", ADF->msgbase)) { aa.reset(); - switch(toupper(ADF->msgbase)) { + switch(g_toupper(ADF->msgbase)) { case 'Q': aa.basetype = "HUDSON"; aa.board = ADF->board; @@ -137,7 +137,7 @@ void gareafile::ReadDB1046(char* file, char* tag) { aa.setpath(STRNP2C(ADF->path)); break; } - switch(toupper(ADF->kind)) { + switch(g_toupper(ADF->kind)) { case 'N': aa.type = GMB_NET; aa.attr = attribsnet; @@ -190,7 +190,7 @@ void gareafile::ReadDB1047A22(char* file, int reclen, char* tag) { while(fread(ADF, reclen, 1, fp) == 1) { if(ADF->allocated and strchr("QFqf", ADF->msgbase)) { aa.reset(); - switch(toupper(ADF->msgbase)) { + switch(g_toupper(ADF->msgbase)) { case 'Q': aa.basetype = "HUDSON"; aa.board = ADF->board; @@ -200,7 +200,7 @@ void gareafile::ReadDB1047A22(char* file, int reclen, char* tag) { aa.setpath(STRNP2C(ADF->path)); break; } - switch(toupper(ADF->kind)) { + switch(g_toupper(ADF->kind)) { case 'N': aa.type = GMB_NET; aa.attr = attribsnet; @@ -254,7 +254,7 @@ void gareafile::ReadDB2011(char* file, int reclen, char* tag) { while(fread(ADF, reclen, 1, fp) == 1) { if(ADF->allocated and strchr("QFqf", ADF->msgbase)) { aa.reset(); - switch(toupper(ADF->msgbase)) { + switch(g_toupper(ADF->msgbase)) { case 'Q': if(ADF->board < 1 or ADF->board > 200) continue; // Bad area number @@ -266,7 +266,7 @@ void gareafile::ReadDB2011(char* file, int reclen, char* tag) { aa.setpath(STRNP2C(ADF->path)); break; } - switch(toupper(ADF->kind)) { + switch(g_toupper(ADF->kind)) { case 'N': aa.type = GMB_NET; aa.attr = attribsnet; @@ -342,7 +342,7 @@ void gareafile::ReadDBridge(char* tag) { // Read netmail storage method etc for(line=1; line <= 2; line++) fgets(buf, 255, fp); - type = (char)toupper(*buf); + type = (char)g_toupper(*buf); // Fido-style netmail path line++; diff --git a/goldlib/gcfg/gxfm100.cpp b/goldlib/gcfg/gxfm100.cpp index e74768c..85d2267 100644 --- a/goldlib/gcfg/gxfm100.cpp +++ b/goldlib/gcfg/gxfm100.cpp @@ -185,7 +185,7 @@ void gareafile::ReadFMail098(FILE* fp, char* path, char* file, char* options) { grp >>= 1; } - //aa.groupid = (char)toupper((char)ar->group); + //aa.groupid = (char)g_toupper((char)ar->group); aa.aka = cfg->akaList[ar->address].nodeNum; if(ar->options.local) { aa.type = GMB_LOCAL; diff --git a/goldlib/gcfg/gxfm116.cpp b/goldlib/gcfg/gxfm116.cpp index 890d290..6fc0225 100644 --- a/goldlib/gcfg/gxfm116.cpp +++ b/goldlib/gcfg/gxfm116.cpp @@ -189,7 +189,7 @@ void gareafile::ReadFMail116(FILE* fp, char* path, char* file, char* options) { grp >>= 1; } - //aa.groupid = (char)toupper((char)ar->group); + //aa.groupid = (char)g_toupper((char)ar->group); aa.aka = cfg->akaList[ar->address].nodeNum; if(ar->options.local) { aa.type = GMB_LOCAL; diff --git a/goldlib/gcfg/gxhpt.cpp b/goldlib/gcfg/gxhpt.cpp index 730f24c..d274e43 100644 --- a/goldlib/gcfg/gxhpt.cpp +++ b/goldlib/gcfg/gxhpt.cpp @@ -318,8 +318,8 @@ void gareafile::ReadHPTFile(char* path, char* file, char* origin, int group) { if(isdigit(*key)) aa.groupid = 0x8000+atoi(key); - else if(isalpha(*key)) - aa.groupid = toupper(*key); + else if(g_isalpha(*key)) + aa.groupid = g_toupper(*key); } else if (strieql(opt, "d")) { @@ -395,13 +395,13 @@ void gareafile::ReadHPT(char* tag) { if(*ptr != '-') strcpy(file, ptr); else { - if(toupper(*(++ptr)) == 'G') { + if(g_toupper(*(++ptr)) == 'G') { if(*(++ptr) == '=') ptr++; if(*ptr == '#') defaultgroup = (word)(atoi(ptr+1)+0x8000u); else - defaultgroup = (word)(isupper(*ptr) ? *ptr : 0); + defaultgroup = (word)(g_isupper(*ptr) ? *ptr : 0); } } ptr = strtok(NULL, " \t"); diff --git a/goldlib/gcfg/gximail4.cpp b/goldlib/gcfg/gximail4.cpp index fa328cf..a2b3d9e 100644 --- a/goldlib/gcfg/gximail4.cpp +++ b/goldlib/gcfg/gximail4.cpp @@ -137,7 +137,7 @@ void gareafile::ReadIMail160(char* options, char* file, char* impath) { if(AR.o_addr) aa.aka = CAST(ftn_addr, CF->aka[AR.o_addr-1]); - aa.groupid = (char)toupper(AR.group); + aa.groupid = (char)g_toupper(AR.group); aa.setdesc(AR.comment); aa.setechoid(AR.aname); diff --git a/goldlib/gcfg/gxqecho.cpp b/goldlib/gcfg/gxqecho.cpp index 466227d..83da5a7 100644 --- a/goldlib/gcfg/gxqecho.cpp +++ b/goldlib/gcfg/gxqecho.cpp @@ -52,8 +52,8 @@ void gareafile::ReadQEchoFile(char* file, char* options, char* origin) { if(isdigit(*ptr)) aa.groupid = 0x8000+atoi(ptr); - else if(isalpha(*ptr)) - aa.groupid = toupper(*ptr); + else if(g_isalpha(*ptr)) + aa.groupid = g_toupper(*ptr); if((ptr = strtok(NULL, " \t")) != NULL) { if(*ptr == '*') { diff --git a/goldlib/gcfg/gxspace.cpp b/goldlib/gcfg/gxspace.cpp index f1bfa1c..6adf0c3 100644 --- a/goldlib/gcfg/gxspace.cpp +++ b/goldlib/gcfg/gxspace.cpp @@ -141,8 +141,8 @@ void gareafile::ReadSpaceAr(const char* file) { case CRC_GROUP: if(isdigit(*val)) aa.groupid = 0x8000+atoi(val); - else if(isalpha(*val)) - aa.groupid = toupper(*val); + else if(g_isalpha(*val)) + aa.groupid = g_toupper(*val); break; case CRC_ENDAREA: if(aa.basetype[0] != '\0') diff --git a/goldlib/gcfg/gxsquish.cpp b/goldlib/gcfg/gxsquish.cpp index 15d1891..421d99e 100644 --- a/goldlib/gcfg/gxsquish.cpp +++ b/goldlib/gcfg/gxsquish.cpp @@ -118,13 +118,13 @@ void gareafile::ReadSquishFile(char* path, char* file, char* options, char* orig if(strnieql(p, "-$", 2)) { aa.basetype = "SQUISH"; p += 2; - if((tolower(*p) == 'g') and isalpha(p[1])) { + if((g_tolower(*p) == 'g') and g_isalpha(p[1])) { if(isdigit(p[1])) aa.groupid = 0x8000+atoi(p+1); - else if(isalpha(p[1])) - aa.groupid = toupper(p[1]); + else if(g_isalpha(p[1])) + aa.groupid = g_toupper(p[1]); } - else if(tolower(*p) == 'n') { + else if(g_tolower(*p) == 'n') { key = ++p; getkeyval(&key, &p); aa.setdesc(key); @@ -190,13 +190,13 @@ void gareafile::ReadSquish(char* tag) { } } else { - if(toupper(*(++ptr)) == 'G') { + if(g_toupper(*(++ptr)) == 'G') { if(*(++ptr) == '=') ptr++; if(*ptr == '#') defaultgroup = (word)(atoi(ptr+1)+0x8000u); else - defaultgroup = (word)(isupper(*ptr) ? *ptr : 0); + defaultgroup = (word)(g_isupper(*ptr) ? *ptr : 0); } } ptr = strtok(NULL, " \t"); diff --git a/goldlib/gcfg/gxtimed.cpp b/goldlib/gcfg/gxtimed.cpp index 00d0655..a6ddcce 100644 --- a/goldlib/gcfg/gxtimed.cpp +++ b/goldlib/gcfg/gxtimed.cpp @@ -234,7 +234,7 @@ void gareafile::ReadTimed(char* tag) { AddBackslash(strcpy(path, ptr)); } else { - if(toupper(*(++ptr)) == 'C') { + if(g_toupper(*(++ptr)) == 'C') { if(*(++ptr) == '=') ptr++; strcpy(timedcfg, ptr); diff --git a/goldlib/gcfg/gxtmail.cpp b/goldlib/gcfg/gxtmail.cpp index 51d47e7..bd15584 100644 --- a/goldlib/gcfg/gxtmail.cpp +++ b/goldlib/gcfg/gxtmail.cpp @@ -130,7 +130,7 @@ void gareafile::ReadTmail(char* tag) { AddBackslash(strcpy(path, ptr)); } else { - if(toupper(*(++ptr)) == 'C') { + if(g_toupper(*(++ptr)) == 'C') { if(*(++ptr) == ':') ptr++; strcpy(tmailcfg, ptr); diff --git a/goldlib/gcfg/gxts.cpp b/goldlib/gcfg/gxts.cpp index ca0774d..33ab859 100644 --- a/goldlib/gcfg/gxts.cpp +++ b/goldlib/gcfg/gxts.cpp @@ -122,7 +122,7 @@ void gareafile::ReadTosScan(char* tag) { while(fread(areafile, sizeof(TS_Areafile), 1, fp) == 1) { if(not (areafile->deleted or areafile->passthru) and not strblank(areafile->echoname) and (areafile->board ? areafile->board < 201 : 1)) { aa.reset(); - aa.groupid = (char)toupper(areafile->groupid); + aa.groupid = (char)g_toupper(areafile->groupid); aa.aka = shared->aka[areafile->akano]; aa.type = GMB_ECHO; aa.attr = attribsecho; diff --git a/goldlib/glibc/fnmatch.c b/goldlib/glibc/fnmatch.c index e401760..d6e3616 100644 --- a/goldlib/glibc/fnmatch.c +++ b/goldlib/glibc/fnmatch.c @@ -75,16 +75,16 @@ # define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c)) #endif -#define ISPRINT(c) (ISASCII (c) && isprint (c)) -#define ISDIGIT(c) (ISASCII (c) && isdigit (c)) -#define ISALNUM(c) (ISASCII (c) && isalnum (c)) -#define ISALPHA(c) (ISASCII (c) && isalpha (c)) -#define ISCNTRL(c) (ISASCII (c) && iscntrl (c)) -#define ISLOWER(c) (ISASCII (c) && islower (c)) -#define ISPUNCT(c) (ISASCII (c) && ispunct (c)) -#define ISSPACE(c) (ISASCII (c) && isspace (c)) -#define ISUPPER(c) (ISASCII (c) && isupper (c)) -#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c)) +#define ISPRINT(c) (ISASCII (c) && isprint (c)) +#define ISDIGIT(c) (ISASCII (c) && isdigit (c)) +#define ISALNUM(c) (ISASCII (c) && isxalnum (c)) +#define ISALPHA(c) (ISASCII (c) && g_isalpha (c)) +#define ISCNTRL(c) (ISASCII (c) && iscntrl (c)) +#define ISLOWER(c) (ISASCII (c) && g_islower (c)) +#define ISPUNCT(c) (ISASCII (c) && ispunct (c)) +#define ISSPACE(c) (ISASCII (c) && isspace (c)) +#define ISUPPER(c) (ISASCII (c) && g_isupper (c)) +#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c)) # define STREQ(s1, s2) ((strcmp (s1, s2) == 0)) @@ -140,9 +140,9 @@ fnmatch (pattern, string, flags) /* Note that this evaluates C many times. */ # ifdef _LIBC -# define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c)) +# define FOLD(c) ((flags & FNM_CASEFOLD) ? g_tolower (c) : (c)) # else -# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c)) +# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? g_tolower (c) : (c)) # endif while ((c = *p++) != '\0') diff --git a/goldlib/glibc/regex.c b/goldlib/glibc/regex.c index d4fd2f0..c76bb71 100644 --- a/goldlib/glibc/regex.c +++ b/goldlib/glibc/regex.c @@ -243,16 +243,16 @@ init_syntax_once () #endif #undef ISPRINT -#define ISPRINT(c) (ISASCII (c) && isprint (c)) -#define ISDIGIT(c) (ISASCII (c) && isdigit (c)) -#define ISALNUM(c) (ISASCII (c) && isalnum (c)) -#define ISALPHA(c) (ISASCII (c) && isalpha (c)) -#define ISCNTRL(c) (ISASCII (c) && iscntrl (c)) -#define ISLOWER(c) (ISASCII (c) && islower (c)) -#define ISPUNCT(c) (ISASCII (c) && ispunct (c)) -#define ISSPACE(c) (ISASCII (c) && isspace (c)) -#define ISUPPER(c) (ISASCII (c) && isupper (c)) -#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c)) +#define ISPRINT(c) (ISASCII (c) && isprint (c)) +#define ISDIGIT(c) (ISASCII (c) && isdigit (c)) +#define ISALNUM(c) (ISASCII (c) && isxalnum (c)) +#define ISALPHA(c) (ISASCII (c) && g_isalpha (c)) +#define ISCNTRL(c) (ISASCII (c) && iscntrl (c)) +#define ISLOWER(c) (ISASCII (c) && g_islower (c)) +#define ISPUNCT(c) (ISASCII (c) && ispunct (c)) +#define ISSPACE(c) (ISASCII (c) && isspace (c)) +#define ISUPPER(c) (ISASCII (c) && g_isupper (c)) +#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c)) #ifndef NULL # define NULL (void *)0 @@ -5631,7 +5631,7 @@ regcomp (preg, pattern, cflags) /* Map uppercase characters to corresponding lowercase ones. */ for (i = 0; i < CHAR_SET_SIZE; i++) - preg->translate[i] = ISUPPER (i) ? tolower (i) : i; + preg->translate[i] = ISUPPER (i) ? g_tolower (i) : i; } else preg->translate = NULL; diff --git a/goldlib/gmb3/gmoezyc4.cpp b/goldlib/gmb3/gmoezyc4.cpp index 6b2bd93..52226d9 100644 --- a/goldlib/gmb3/gmoezyc4.cpp +++ b/goldlib/gmb3/gmoezyc4.cpp @@ -174,7 +174,7 @@ void EzycomArea::save_message(int __mode, gmsg* __msg, EzycHdr& __hdr) { _msgfast.whoto = CRC32_MASK_CCITT; char* _ptr = __msg->to; while(*_ptr) { - _msgfast.whoto = updCrc32((char)toupper(*_ptr), _msgfast.whoto); + _msgfast.whoto = updCrc32((char)g_toupper(*_ptr), _msgfast.whoto); _ptr++; } _fh = test_open(AddPath(wide->msgbasepath, "MSGFAST.BBS"), O_WRONLY|O_CREAT|O_BINARY, SH_DENYWR); diff --git a/goldlib/gmb3/gmopcbd3.cpp b/goldlib/gmb3/gmopcbd3.cpp index 452ccae..6540735 100644 --- a/goldlib/gmb3/gmopcbd3.cpp +++ b/goldlib/gmb3/gmopcbd3.cpp @@ -197,7 +197,7 @@ int PcbArea::load_message(int __mode, gmsg* __msg, PcbHdr& __hdr) { while(*ptr2) { if(*ptr2 == '+') { // get flags - switch(toupper(*(++ptr2))) { + switch(g_toupper(*(++ptr2))) { case 'C': __msg->attr.cra1(); break; case 'D': __msg->attr.dir1(); break; } diff --git a/goldlib/gmb3/gmoxbbs4.cpp b/goldlib/gmb3/gmoxbbs4.cpp index c2c60f1..7fbe130 100644 --- a/goldlib/gmb3/gmoxbbs4.cpp +++ b/goldlib/gmb3/gmoxbbs4.cpp @@ -106,7 +106,7 @@ uint16_t XbbsCheckSum(char* str) { uint16_t checksum = 0; while(*str) { - checksum ^= (uint16_t)toupper(*str++); + checksum ^= (uint16_t)g_toupper(*str++); if(checksum & 1) checksum = (uint16_t)((checksum >> 1) ^ 0xA000); else diff --git a/goldlib/msgidlib/fexist.c b/goldlib/msgidlib/fexist.c index 252087a..cdba62a 100755 --- a/goldlib/msgidlib/fexist.c +++ b/goldlib/msgidlib/fexist.c @@ -90,7 +90,7 @@ int direxist(const char *directory) /* Root directory of any drive always exists! */ - if ((isalpha((int)tempstr[0]) && tempstr[1] == ':' && (tempstr[2] == '\\' || tempstr[2] == '/') && + if ((g_isalpha((int)tempstr[0]) && tempstr[1] == ':' && (tempstr[2] == '\\' || tempstr[2] == '/') && !tempstr[3]) || eqstr(tempstr, "\\")) { free(tempstr); return TRUE; @@ -186,7 +186,7 @@ int direxist(const char *directory) /* Root directory of any drive always exists! */ - if ((isalpha(tempstr[0]) && tempstr[1] == ':' && ((tempstr[2] == '\0') || ((tempstr[2] == '\\' || + if ((g_isalpha(tempstr[0]) && tempstr[1] == ':' && ((tempstr[2] == '\0') || ((tempstr[2] == '\\' || tempstr[2] == '/') && tempstr[3] == '\0'))) || eqstri(tempstr, "\\")) { ret = TRUE; @@ -244,7 +244,7 @@ int _fast direxist(const char *directory) /* Root directory of any drive always exists! */ - if ((isalpha((int)tempstr[0]) && tempstr[1] == ':' && (tempstr[2] == '\\' || tempstr[2] == '/') && + if ((g_isalpha((int)tempstr[0]) && tempstr[1] == ':' && (tempstr[2] == '\\' || tempstr[2] == '/') && !tempstr[3]) || eqstr(tempstr, "\\")) { free(tempstr); diff --git a/goldlib/msgidlib/genmsgid.c b/goldlib/msgidlib/genmsgid.c index 2d21c76..89fdd48 100755 --- a/goldlib/msgidlib/genmsgid.c +++ b/goldlib/msgidlib/genmsgid.c @@ -86,7 +86,7 @@ dword GenMsgIdEx(char *seqdir, unsigned long max_outrun, dword (*altGenMsgId)(vo p = getenv("SEQOUT"); if ( p && isdigit((int)(*p)) ) { max_outrun = (unsigned long)atol(p); - switch (tolower(p[strlen(p) - 1])) { + switch (g_tolower(p[strlen(p) - 1])) { case 'y': max_outrun *= 365; case 'd': max_outrun *= 24; case 'h': max_outrun *= 60*60; diff --git a/goldlib/msgidlib/typedefs.h b/goldlib/msgidlib/typedefs.h index bd08b2f..a683a55 100755 --- a/goldlib/msgidlib/typedefs.h +++ b/goldlib/msgidlib/typedefs.h @@ -4,5 +4,6 @@ #define __TYPEDEFS_H__ #include +#include #endif //#ifndef __TYPEDEFS_H__ diff --git a/goldlib/uulib/fptools.c b/goldlib/uulib/fptools.c index dd50599..e2e8708 100644 --- a/goldlib/uulib/fptools.c +++ b/goldlib/uulib/fptools.c @@ -34,7 +34,6 @@ */ #include -#include #ifdef STDC_HEADERS #include @@ -50,6 +49,8 @@ #include #endif +#include +#include #include #if 0 @@ -147,12 +148,12 @@ _FP_stricmp (char *str1, char *str2) return -1; while (*str1) { - if (tolower(*str1) != tolower(*str2)) + if (g_tolower(*str1) != g_tolower(*str2)) break; str1++; str2++; } - return (tolower (*str1) - tolower (*str2)); + return (g_tolower (*str1) - g_tolower (*str2)); } int TOOLEXPORT @@ -162,13 +163,13 @@ _FP_strnicmp (char *str1, char *str2, int count) return -1; while (*str1 && count) { - if (tolower(*str1) != tolower(*str2)) + if (g_tolower(*str1) != g_tolower(*str2)) break; str1++; str2++; count--; } - return count ? (tolower (*str1) - tolower (*str2)) : 0; + return count ? (g_tolower (*str1) - g_tolower (*str2)) : 0; } /* @@ -269,7 +270,7 @@ _FP_stristr (char *str1, char *str2) while (*(ptr1=str1)) { for (ptr2=str2; - *ptr1 && *ptr2 && tolower(*ptr1)==tolower(*ptr2); + *ptr1 && *ptr2 && g_tolower(*ptr1)==g_tolower(*ptr2); ptr1++, ptr2++) /* empty loop */ ; @@ -332,7 +333,7 @@ _FP_stoupper (char *input) return NULL; while (*iter) { - *iter = toupper (*iter); + *iter = g_toupper (*iter); iter++; } return input; @@ -347,7 +348,7 @@ _FP_stolower (char *input) return NULL; while (*iter) { - *iter = tolower (*iter); + *iter = g_tolower (*iter); iter++; } return input; diff --git a/goldlib/uulib/uucheck.c b/goldlib/uulib/uucheck.c index af6de74..aac34f9 100644 --- a/goldlib/uulib/uucheck.c +++ b/goldlib/uulib/uucheck.c @@ -32,7 +32,6 @@ **/ #include -#include #ifdef STDC_HEADERS #include @@ -48,6 +47,8 @@ #include #endif +#include +#include #include #include #include @@ -165,7 +166,7 @@ UUGetFileName (char *subject, char *ptonum, char *ptonend) count = length = alflag = 0; while (iter[count] && (isalnum (iter[count]) || strchr (uufnchars, iter[count])!=NULL)) { - if (isalpha (iter[count])) + if (g_isalpha(iter[count])) alflag++; count++; } @@ -224,14 +225,14 @@ UUGetFileName (char *subject, char *ptonum, char *ptonend) if (_FP_strnicmp (ptr, "ftp", 3) == 0) { /* hey, that's an ftp address */ - while (isalpha (*ptr) || isdigit (*ptr) || *ptr == '.') + while (g_isalpha(*ptr) || isdigit (*ptr) || *ptr == '.') ptr++; continue; } while ((isalnum(*iter)||strchr(uufnchars, *iter)!=NULL|| *iter=='/') && *iter && iter != ptonum && *iter != '.') { - if (isalpha (*iter)) + if (g_isalpha(*iter)) alflag = 1; count++; iter++; @@ -253,7 +254,7 @@ UUGetFileName (char *subject, char *ptonum, char *ptonend) if (_FP_strnicmp (iter, "edu", 3) == 0 || _FP_strnicmp (iter, "gov", 3) == 0) { /* hey, that's an ftp address */ - while (isalpha (*iter) || isdigit (*iter) || *iter == '.') + while (g_isalpha(*iter) || isdigit (*iter) || *iter == '.') iter++; ptr = iter; length = 0; @@ -310,7 +311,7 @@ UUGetFileName (char *subject, char *ptonum, char *ptonend) if (length == 0) { /* No filename found, use subject line for ident */ ptr = subject; - while (*ptr && !isalpha (*ptr)) + while (*ptr && !g_isalpha(*ptr)) ptr++; while ((isalnum(ptr[length])||strchr(uufnchars,ptr[length])!=NULL|| @@ -541,7 +542,7 @@ UUGetPartNo (char *subject, char **where, char **whend) if (isdigit(*(iter-1))) { while (iter>subject && isdigit (*(iter-1))) iter--; - if (!isdigit (*iter) && !isalpha (*iter) && *iter != '.') + if (!isdigit (*iter) && !g_isalpha(*iter) && *iter != '.') iter++; ptr = iter; @@ -595,7 +596,7 @@ UUGetPartNo (char *subject, char **where, char **whend) ptr = subject; while (count > 0) { - if (!isdigit(ptr[count])||isalpha(ptr[count+1])||ptr[count+1] == '.') { + if (!isdigit(ptr[count])||g_isalpha(ptr[count+1])||ptr[count+1] == '.') { count--; continue; } @@ -604,7 +605,7 @@ UUGetPartNo (char *subject, char **where, char **whend) while (count >= 0 && isdigit (ptr[count])) { count--; length++; } - if (count>=0 && ((isalpha (ptr[count]) && + if (count>=0 && ((g_isalpha(ptr[count]) && (ptr[count] != 's' || ptr[count+1] != 't') && (ptr[count] != 'n' || ptr[count+1] != 'd')) || ptr[count] == '/' || ptr[count] == '.' || diff --git a/goldlib/uulib/uunconc.c b/goldlib/uulib/uunconc.c index b98cc92..daf9d2e 100644 --- a/goldlib/uulib/uunconc.c +++ b/goldlib/uulib/uunconc.c @@ -36,7 +36,6 @@ #endif #include -#include #ifdef STDC_HEADERS #include @@ -52,6 +51,8 @@ #include #endif +#include +#include #include #include #include @@ -465,7 +466,7 @@ UUValidData (char *ptr, int encoding, int *bhflag) goto _t_XX; /* bad length */ } - if (len != j || islower (*ptr)) { + if (len != j || g_islower (*ptr)) { /* * if we are not in a 'uuencoded' state, don't allow the line to have * space characters at all. if we know we _are_ decoding uuencoded @@ -788,8 +789,8 @@ UUDecodeQP (FILE *datain, FILE *dataout, int *state, p1 = ++p2; if (isxdigit (*p2) && isxdigit (*(p2+1))) { - val = ((isdigit(*p2)) ? (*p2-'0') : (tolower(*p2)-'a'+10)) << 4; - val |= ((isdigit(*(p2+1)))?(*(p2+1)-'0') : (tolower(*(p2+1))-'a'+10)); + val = ((isdigit(*p2)) ? (*p2-'0') : (g_tolower(*p2)-'a'+10)) << 4; + val |= ((isdigit(*(p2+1)))?(*(p2+1)-'0') : (g_tolower(*(p2+1))-'a'+10)); fputc (val, dataout); p2 += 2;