diff --git a/src/sbbs3/ansiterm.cpp b/src/sbbs3/ansiterm.cpp index 5a2d492faea2765297c9dd8cd619aed9ed52efd5..b17dec387f37dfe4e06b582b734309ee0d12868f 100644 --- a/src/sbbs3/ansiterm.cpp +++ b/src/sbbs3/ansiterm.cpp @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2009 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -98,14 +98,14 @@ const char *sbbs_t::ansi(int atr) } /* insure str is at least 14 bytes in size! */ -char* sbbs_t::ansi(int atr, int curatr, char* str) +extern "C" char* ansi_attr(int atr, int curatr, char* str, BOOL color) { - if(!term_supports(COLOR)) { /* eliminate colors if user doesn't have them */ + if(!color) { /* eliminate colors if terminal doesn't support them */ if(atr&LIGHTGRAY) /* if any foreground bits set, set all */ atr|=LIGHTGRAY; if(atr&BG_LIGHTGRAY) /* if any background bits set, set all */ atr|=BG_LIGHTGRAY; - if(atr&LIGHTGRAY && atr&BG_LIGHTGRAY) + if((atr&LIGHTGRAY) && (atr&BG_LIGHTGRAY)) atr&=~LIGHTGRAY; /* if background is solid, foreground is black */ if(!atr) atr|=LIGHTGRAY; /* don't allow black on black */ @@ -193,6 +193,11 @@ char* sbbs_t::ansi(int atr, int curatr, char* str) return str; } +char* sbbs_t::ansi(int atr, int curatr, char* str) +{ + return ::ansi_attr(atr, curatr, str, term_supports(COLOR) ? TRUE:FALSE); +} + void sbbs_t::ansi_getlines() { if(sys_status&SS_USERON && useron.misc&ANSI && !useron.rows /* Auto-detect rows */ diff --git a/src/sbbs3/sbbs.h b/src/sbbs3/sbbs.h index 457c3d4b73e944799c39cc3ee50d81fafb50b5b1..20badbde39d27e88f4b581a57fd2f868a8869a45 100644 --- a/src/sbbs3/sbbs.h +++ b/src/sbbs3/sbbs.h @@ -982,6 +982,8 @@ public: #ifdef __cplusplus extern "C" { #endif + /* ansiterm.cpp */ + DLLEXPORT char* DLLCALL ansi_attr(int attr, int curattr, char* str, BOOL color); /* main.cpp */ DLLEXPORT int DLLCALL sbbs_random(int);