NAME true_strlen - Calculates the true length of a string even if colour codes (^) have been added. SYNOPSIS int true_strlen(char *s); DESCRIPTION The true_strlen() function calculates the length of a string taking into account colour codes which are present. A string of "hello" would return 5 with strlen() and 5 with true_strlen(), but a string of "^Rhello^N" would return 9 with strlen() rather than, the correct, 5 with true_strlen (the ^R and ^N are converted into colour codes which do not take up any extra characters on output) The terminating '\0' character is not included in the count as with strlen(). RETURN VALUE true_strlen returns the number of visible characters that will be shown to the person on the talker. SEE ALSO strlen, string(3). BUGS No known bugs but there is some code repetition which could be cleaned up. AUTHOR Silver - 1st September 1998 CODE int true_strlen(char *str) { int l = 0; while (*str) { if (*str == '^') { if (*(str+1) == '^') l++; str++; } else l++; str++; } return l; }