const char *p = s; int i = 0;  tmp[i++] = '"'; while (*p && i < sizeof (tmp) - 2) { if (*p == '\\' || *p == '"') tmp[i++] = '\\'; tmp[i++] = *p++; } tmp[i++] = '"'; tmp[i] = 0;
quote_simple (tmp, sizeof(tmp), s);
void mutt_check_simple (char *s, size_t len, const char *simple){  char tmp[LONG_STRING];  if (!strchr (s, '~')) /* yup, so spoof a real request */  {    /* convert old tokens into the new format */    if (strcasecmp ("all", s) == 0 ||	!strcmp ("^", s) || !strcmp (".", s)) /* ~A is more efficient */      strfcpy (s, "~A", len);    else if (strcasecmp ("del", s) == 0)      strfcpy (s, "~D", len);    else if (strcasecmp ("flag", s) == 0)      strfcpy (s, "~F", len);    else if (strcasecmp ("new", s) == 0)      strfcpy (s, "~N", len);    else if (strcasecmp ("old", s) == 0)      strfcpy (s, "~O", len);    else if (strcasecmp ("repl", s) == 0)      strfcpy (s, "~Q", len);    else if (strcasecmp ("read", s) == 0)      strfcpy (s, "~R", len);    else if (strcasecmp ("tag", s) == 0)      strfcpy (s, "~T", len);    else if (strcasecmp ("unread", s) == 0)      strfcpy (s, "~U", len);    else    {      const char *p = s;      int i = 0;      tmp[i++] = '"';      while (*p && i < sizeof (tmp) - 2)      {	if (*p == '\\' || *p == '"')	  tmp[i++] = '\\';	tmp[i++] = *p++;      }      tmp[i++] = '"';      tmp[i] = 0;      mutt_expand_fmt (s, len, simple, tmp);    }  }}