wlen = (flags & M_FORMAT_ARROWCURSOR && option (OPTARROWCURSOR)) ? 3 : 0;
void mutt_FormatString (char *dest,		/* output buffer */			size_t destlen,		/* output buffer len */			const char *src,	/* template string */			format_t *callback,	/* callback for processing */			unsigned long data,	/* callback data */			format_flag flags)	/* callback flags */{  char prefix[SHORT_STRING], buf[LONG_STRING], *cp, *wptr = dest, ch;  char ifstring[SHORT_STRING], elsestring[SHORT_STRING];  size_t wlen = 0, count, len;  destlen--; /* save room for the terminal \0 */  while (*src && wlen < destlen)  {    if (*src == '%')    {      if (*++src == '%')      {	*wptr++ = '%';	wlen++;	src++;	continue;      }      if (*src == '?')      {	flags |= M_FORMAT_OPTIONAL;	src++;      }      else      {	flags &= ~M_FORMAT_OPTIONAL;	/* eat the format string */	cp = prefix;	count = 0;	while (count < sizeof (prefix) &&	       (isdigit ((unsigned char) *src) || *src == '.' || *src == '-'))	{	  *cp++ = *src++;	  count++;	}	*cp = 0;      }      if (!*src)	break; /* bad format */      ch = *src++; /* save the character to switch on */      if (flags & M_FORMAT_OPTIONAL)      {        if (*src != '?')          break; /* bad format */        src++;        /* eat the `if' part of the string */        cp = ifstring;	count = 0;        while (count < sizeof (ifstring) && *src && *src != '?' && *src != '&')	{          *cp++ = *src++;	  count++;	}        *cp = 0;	/* eat the `else' part of the string (optional) */	if (*src == '&')	  src++; /* skip the & */	cp = elsestring;	count = 0;	while (count < sizeof (elsestring) && *src && *src != '?')	{	  *cp++ = *src++;	  count++;	}	*cp = 0;	if (!*src)	  break; /* bad format */        src++; /* move past the trailing `?' */      }      /* handle generic cases first */      if (ch == '>')      {	/* right justify to EOL */	ch = *src++; /* pad char */	/* calculate space left on line.  if we've already written more data	   than will fit on the line, ignore the rest of the line */	count = (COLS < destlen ? COLS : destlen);	if (count > wlen)	{	  count -= wlen; /* how many chars left on this line */	  mutt_FormatString (buf, sizeof (buf), src, callback, data, flags);	  len = strlen (buf);	  if (count > len)	  {	    count -= len; /* how many chars to pad */	    memset (wptr, ch, count);	    wptr += count;	    wlen += count;	  }	  if (len + wlen > destlen)	    len = destlen - wlen;	  memcpy (wptr, buf, len);	  wptr += len;	  wlen += len;	}	break; /* skip rest of input */      }      else if (ch == '|')      {	/* pad to EOL */	ch = *src++;	if (destlen > COLS)	  destlen = COLS;	if (destlen > wlen)	{	  count = destlen - wlen;	  memset (wptr, ch, count);	  wptr += count;	}	break; /* skip rest of input */      }      else      {	/* use callback function to handle this case */	src = callback (buf, sizeof (buf), ch, src, prefix, ifstring, elsestring, data, flags);	if ((len = strlen (buf)) + wlen > destlen)	  len = (destlen - wlen > 0) ? (destlen - wlen) : 0;	memcpy (wptr, buf, len);	wptr += len;	wlen += len;      }    }    else if (*src == '\\')    {      if (!*++src)	break;      switch (*src)      {	case 'n':	  *wptr = '\n';	  break;	case 't':	  *wptr = '\t';	  break;	case 'r':	  *wptr = '\r';	  break;	case 'f':	  *wptr = '\f';	  break;	case 'v':	  *wptr = '\v';	  break;	default:	  *wptr = *src;	  break;      }      src++;      wptr++;      wlen++;    }    else    {      *wptr++ = *src++;      wlen++;    }  }  *wptr = 0;  if (flags & M_FORMAT_MAKEPRINT)  {    /* Make sure that the string is printable by changing all non-printable       chars to dots, or spaces for non-printable whitespace */    for (cp = dest ; *cp ; cp++)      if (!IsPrint (*cp) &&	  !((flags & M_FORMAT_TREE) && (*cp <= M_TREE_MAX)))	*cp = isspace ((unsigned char) *cp) ? ' ' : '.';  }}