buf[i-1] = 0;
if (i) buf[i-1] = '\0'; else buf[i] = '\0';
int mutt_socket_read_line (char *buf, size_t buflen, CONNECTION *conn){  char ch;  int i;  for (i = 0; i < buflen; i++)  {    if (mutt_socket_readchar (conn, &ch) != 1)      return (-1);    if (ch == '\n')      break;    buf[i] = ch;  }  buf[i-1] = 0;  return (i + 1);}