mbstate_t mbstate = 0;
mbstate_t mbstate;
size_t iconv (iconv_t _cd, const char **inbuf, size_t *inbytesleft,	      char **outbuf, size_t *outbytesleft){  struct iconv *cd = (struct iconv *)_cd;  const char *ib = *inbuf;  size_t ibl = *inbytesleft;  char *ob = *outbuf;  size_t obl = *outbytesleft;  int n;  if (cd && cd->chm)  {    int i;    n = ibl < obl ? ibl : obl;    for (i = 0; i < n; i++)      ob[i] = mutt_display_char (ib[i], cd->chm);    ib += n, ibl -= n, ob += n, obl -= n;  }  else if (cd && cd->chs_from && !unicode_init ())  {    n = 0;    while (ibl && obl)    {      CHARDESC *d;      unsigned long c = 0xfffd; /* replacement char */      int k;      if ((d = repr2descr ((unsigned char)*ib, cd->chs_from)) &&	  (d = hash_find (Unicode->symb_to_repr, d->symbol)))	c = d->repr;      if (obl < 6 && obl < mutt_wctoutf8 (0, c))	break;      k = mutt_wctoutf8 (ob, c);      ++ib, --ibl;      ob += k, obl -=k;      ++n;    }  }  else if (cd && !cd->chs_from && cd->chs_to && !unicode_init ())  {    mbstate_t mbstate = 0;    unsigned int wc;    int k;    char c;    CHARDESC *d;    n = 0;    while (ibl && obl)    {      k = utf8rtowc (&wc, ib, ibl, &mbstate);      if (k == -1 || k == -2)      {	*inbuf = ib, *inbytesleft = ibl;	*outbuf = ob, *outbytesleft = obl;	errno = (k == -1) ? EILSEQ : EINVAL;	return -1;      }      k = k ? k : 1;      c = '?'; /* replacement char */      if ((d = repr2descr (wc, Unicode)))      {	c = d->symbol[0]; /* approximation */	if ((d = hash_find (cd->chs_to->symb_to_repr, d->symbol)))	  c = d->repr;      }      ib += k, ibl -= k;      *ob++ = c, --obl;      ++n;    }  }  else  {    /* no translation defined - just copy */    n = ibl < obl ? ibl : obl;    memcpy (ob, ib, n);    ib += n, ibl -= n, ob += n, obl -= n;  }  *inbuf = ib, *inbytesleft = ibl;  *outbuf = ob, *outbytesleft = obl;  if (ibl)  {    errno = E2BIG;    return (size_t)-1;  }  else    return n;}