Re: EZColor and log files

From: Greg Buxton (gbuxton@maple.he.net)
Date: 05/31/03


> Does anyone know an easy way to strip out the color codes
> from your text when it's put to the logs? I mean, an easy way
> you could put it into, say, mudlog()?

Check your utils.c for remove_colorcodes()

#define IS_COLOR_CHAR(c) (c == 'n' || c == 'R' || c == 'r' || c == 'Y'
||\
   c == 'y' || c == 'G' || c == 'g' || c == 'B' || c == 'b' || c == 'f'
||\
   c == 'M' || c == 'm' || c == 'W' || c == 'w' || c == 'D' || c == 'd'
||\
   c == 'C' || c == 'c' || c == '0')

void remove_colorcodes(char *string)
{
  int i, j, stringLen;

  stringLen = (strlen(string) + 1);
  for (i = 0; i < stringLen; i++)
    {
    if ((string[i] == '&') && (string[i-1] != '&') &&
         IS_COLOR_CHAR(string[i+1]))
      {
      j = i;
      while (j < (stringLen - 2)) /* String will be two characters
shorter */
        {
        string[j] = string[j+2];
        j++;
        }
      string[j] = '\0';
      }
    }
  return;
}
#undef IS_COLOR_CHAR(c)

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/26/03 PDT