snprintf (buf2, sizeof (buf2), "%s%s", hdr->tree, hdr->env->subject ? hdr->env->subject : "");
snprintf (buf2, sizeof (buf2), "%s%s", hdr->tree, NONULL (hdr->env->subject));
hdr_format_str (char *dest,		size_t destlen,		char op,		const char *src,		const char *prefix,		const char *ifstring,		const char *elsestring,		unsigned long data,		format_flag flags){  struct hdr_format_info *hfi = (struct hdr_format_info *) data;  HEADER *hdr;  CONTEXT *ctx;  char fmt[SHORT_STRING], buf2[SHORT_STRING], ch, *p;  int do_locales, i;  int optional = (flags & M_FORMAT_OPTIONAL);  size_t len;  hdr = hfi->hdr;  ctx = hfi->ctx;  dest[0] = 0;  switch (op)  {    case 'a':      if(hdr->env->from && hdr->env->from->mailbox)      {	snprintf (fmt, sizeof (fmt), "%%%ss", prefix);	snprintf (dest, destlen, fmt, hdr->env->from->mailbox);      }      else        dest[0] = '\0';      break;    case 'B':      if (!first_mailing_list (dest, destlen, hdr->env->to) &&	  !first_mailing_list (dest, destlen, hdr->env->cc))	dest[0] = 0;      break;    case 'b':      if(ctx)      {	if ((p = strrchr (ctx->path, '/')))	  strfcpy (dest, p + 1, destlen);	else	  strfcpy (dest, ctx->path, destlen);      }      else 	strfcpy(dest, "(null)", destlen);      break;        case 'c':      mutt_pretty_size (buf2, sizeof (buf2), (long) hdr->content->length);      snprintf (fmt, sizeof (fmt), "%%%ss", prefix);      snprintf (dest, destlen, fmt, buf2);      break;    case 'C':      snprintf (fmt, sizeof (fmt), "%%%sd", prefix);      snprintf (dest, destlen, fmt, hdr->msgno + 1);      break;    case 'd':    case '{':    case '[':    case '(':    case '<':      /* preprocess $date_format to handle %Z */      {	const char *cp;	struct tm *tm; 	time_t T;	p = dest;	cp = (op == 'd') ? (NONULL (DateFmt)) : src;	if (*cp == '!')	{	  do_locales = 0;	  cp++;	}	else	  do_locales = 1;	len = destlen - 1;	while (len > 0 && ((op == 'd' && *cp) ||			   (op == '{' && *cp != '}') || 			   (op == '[' && *cp != ']') ||			   (op == '(' && *cp != ')') ||			   (op == '<' && *cp != '>')))	{	  if (*cp == '%')	  {	    cp++;	    if (*cp == 'Z' && (op == 'd' || op == '{'))	    {	      if (len >= 5)	      {		sprintf (p, "%c%02u%02u", hdr->zoccident ? '-' : '+',			 hdr->zhours, hdr->zminutes);		p += 5;		len -= 5;	      }	      else		break; /* not enough space left */	    }	    else	    {	      if (len >= 2)	      {		*p++ = '%';		*p++ = *cp;		len -= 2;	      }	      else		break; /* not enough space */	    }	    cp++;	  }	  else	  {	    *p++ = *cp++;	    len--;	  }	}	*p = 0;	if (do_locales && Locale)	  setlocale (LC_TIME, Locale);	if (op == '[')	  tm = localtime (&hdr->date_sent);	else if (op == '(')	  tm = localtime (&hdr->received);	else if (op == '<')	{	  T = time (NULL);	  tm = localtime (&T);	}	else	{	  /* restore sender's time zone */	  T = hdr->date_sent;	  if (hdr->zoccident)	    T -= (hdr->zhours * 3600 + hdr->zminutes * 60);	  else	    T += (hdr->zhours * 3600 + hdr->zminutes * 60);	  tm = gmtime (&T);	}	strftime (buf2, sizeof (buf2), dest, tm);	if (do_locales)	  setlocale (LC_TIME, "C");	snprintf (fmt, sizeof (fmt), "%%%ss", prefix);	snprintf (dest, destlen, fmt, buf2);	if (len > 0 && op != 'd')	  src = cp + 1;      }      break;    case 'f':      buf2[0] = 0;      rfc822_write_address (buf2, sizeof (buf2), hdr->env->from);      snprintf (fmt, sizeof (fmt), "%%%ss", prefix);      snprintf (dest, destlen, fmt, buf2);      break;    case 'F':      snprintf (fmt, sizeof (fmt), "%%%ss", prefix);      make_from (hdr->env, buf2, sizeof (buf2), 0);      snprintf (dest, destlen, fmt, buf2);      break;    case 'i':      snprintf (fmt, sizeof (fmt), "%%%ss", prefix);      snprintf (dest, destlen, fmt, hdr->env->message_id ? hdr->env->message_id : "<no.id>");      break;    case 'l':      snprintf (fmt, sizeof (fmt), "%%%sd", prefix);      snprintf (dest, destlen, fmt, (int) hdr->lines);      break;    case 'L':      if (!optional)      {	make_from (hdr->env, buf2, sizeof (buf2), 1);	snprintf (fmt, sizeof (fmt), "%%%ss", prefix);	snprintf (dest, destlen, fmt, buf2);      }      else if (!check_for_mailing_list (hdr->env->to, NULL, NULL, 0) &&	       !check_for_mailing_list (hdr->env->cc, NULL, NULL, 0))      {	optional = 0;      }      break;    case 'm':      if(ctx)      {	snprintf (fmt, sizeof (fmt), "%%%sd", prefix);	snprintf (dest, destlen, fmt, ctx->msgcount);      }      else	strfcpy(dest, "(null)", destlen);      break;    case 'n':      snprintf (fmt, sizeof (fmt), "%%%ss", prefix);      snprintf (dest, destlen, fmt, mutt_get_name (hdr->env->from));      break;    case 'N':      snprintf (fmt, sizeof (fmt), "%%%sd", prefix);      snprintf (dest, destlen, fmt, hdr->score);      break;    case 'O':      if (!optional)      {	make_from_addr (hdr->env, buf2, sizeof (buf2), 1);	if (!option (OPTSAVEADDRESS) && (p = strpbrk (buf2, "%@")))	  *p = 0;	snprintf (fmt, sizeof (fmt), "%%%ss", prefix);	snprintf (dest, destlen, fmt, buf2);      }      else if (!check_for_mailing_list_addr (hdr->env->to, NULL, 0) &&	       !check_for_mailing_list_addr (hdr->env->cc, NULL, 0))      {	optional = 0;      }      break;    case 's':      snprintf (fmt, sizeof (fmt), "%%%ss", prefix);      if (flags & M_FORMAT_TREE)      {	if (flags & M_FORMAT_FORCESUBJ)	{	  snprintf (buf2, sizeof (buf2), "%s%s", hdr->tree,		    hdr->env->subject ? hdr->env->subject : "");	  snprintf (dest, destlen, fmt, buf2);	}	else	  snprintf (dest, destlen, fmt, hdr->tree);      }      else      {	snprintf (dest, destlen, fmt, hdr->env->subject ? hdr->env->subject : "");      }      break;    case 'S':      if (hdr->deleted)	ch = 'D';      else if (hdr->attach_del)	ch = 'd';      else if (hdr->tagged)	ch = '*';      else if (hdr->flagged)	ch = '!';      else if (hdr->replied)	ch = 'r';      else if (hdr->read && (ctx && ctx->msgnotreadyet != hdr->msgno))	ch = '-';      else if (hdr->old)	ch = 'O';      else	ch = 'N';      /* FOO - this is probably unsafe, but we are not likely to have such	 a short string passed into this routine */      *dest = ch;      *(dest + 1) = 0;      break;    case 't':      buf2[0] = 0;      if (!check_for_mailing_list (hdr->env->to, "To ", buf2, sizeof (buf2)) &&	  !check_for_mailing_list (hdr->env->cc, "Cc ", buf2, sizeof (buf2)))      {	if (hdr->env->to)	  snprintf (buf2, sizeof (buf2), "To %s", mutt_get_name (hdr->env->to));	else if (hdr->env->cc)	  snprintf (buf2, sizeof (buf2), "Cc %s", mutt_get_name (hdr->env->cc));      }      snprintf (fmt, sizeof (fmt), "%%%ss", prefix);      snprintf (dest, destlen, fmt, buf2);      break;    case 'T':      snprintf (fmt, sizeof (fmt), "%%%sc", prefix);      snprintf (dest, destlen, fmt,		(Tochars && ((i = user_is_recipient (hdr->env))) < strlen (Tochars)) ? Tochars[i] : ' ');      break;    case 'u':      if (hdr->env->from && hdr->env->from->mailbox)      {	strfcpy (buf2, hdr->env->from->mailbox, sizeof (buf2));	if ((p = strpbrk (buf2, "%@")))	  *p = 0;      }      else	buf2[0] = 0;      snprintf (fmt, sizeof (fmt), "%%%ss", prefix);      snprintf (dest, destlen, fmt, buf2);      break;    case 'Z':      if (hdr->mailcap)	ch = 'M';#ifdef _PGPPATH      else if (hdr->pgp & PGPENCRYPT)      	ch = 'P';      else if (hdr->pgp & PGPSIGN)        ch = 'S';      else if (hdr->pgp & PGPKEY)        ch = 'K';#endif      else	ch = ' ';      snprintf (fmt, sizeof (fmt), "%%%ss", prefix);      snprintf (buf2, sizeof (buf2),		"%c%c%c",		(hdr->read && (ctx && ctx->msgnotreadyet != hdr->msgno))		? (hdr->replied ? 'r' : ' ') : (hdr->old ? 'O' : 'N'),		hdr->deleted ? 'D' : (hdr->attach_del ? 'd' : ch),		hdr->tagged ? '*' :		(hdr->flagged ? '!' :		 (Tochars && ((i = user_is_recipient (hdr->env)) < strlen (Tochars)) ? Tochars[user_is_recipient (hdr->env)] : ' ')));      snprintf (dest, destlen, fmt, buf2);      break;    default:      snprintf (dest, destlen, "%%%s%c", prefix, op);      break;  }  if (optional)    mutt_FormatString (dest, destlen, ifstring, hdr_format_str, (unsigned long) hfi, flags);  else if (flags & M_FORMAT_OPTIONAL)    mutt_FormatString (dest, destlen, elsestring, hdr_format_str, (unsigned long) hfi, flags);  return (src);}