コード例 #1
0
static int
pop_retr (popserver server, int msgno, FILE *arg)
{
  char *line;
  int ret;

  if (pop_retrieve_first (server, msgno, &line))
    {
      snprintf (Errmsg, sizeof Errmsg, "Error from POP server: %s", pop_error);
      return (NOTOK);
    }

  while ((ret = pop_retrieve_next (server, &line)) >= 0)
    {
      if (! line)
	break;

      if (mbx_write (line, ret, arg) != OK)
	{
	  strcpy (Errmsg, strerror (errno));
	  pop_close (server);
	  return (NOTOK);
	}
    }

  if (ret)
    {
      snprintf (Errmsg, sizeof Errmsg, "Error from POP server: %s", pop_error);
      return (NOTOK);
    }

  return (OK);
}
コード例 #2
0
ファイル: movemail.c プロジェクト: EwanDawson/emacs
static int
pop_retr (popserver server, int msgno, FILE *arg)
{
  char *line;
  int ret;

  if (pop_retrieve_first (server, msgno, &line))
    {
      char *msg = concat ("Error from POP server: ", pop_error, "");
      strncpy (Errmsg, msg, sizeof (Errmsg));
      Errmsg[sizeof (Errmsg)-1] = '\0';
      free (msg);
      return (NOTOK);
    }

  while ((ret = pop_retrieve_next (server, &line)) >= 0)
    {
      if (! line)
	break;

      if (mbx_write (line, ret, arg) != OK)
	{
	  strcpy (Errmsg, strerror (errno));
	  pop_close (server);
	  return (NOTOK);
	}
    }

  if (ret)
    {
      char *msg = concat ("Error from POP server: ", pop_error, "");
      strncpy (Errmsg, msg, sizeof (Errmsg));
      Errmsg[sizeof (Errmsg)-1] = '\0';
      free (msg);
      return (NOTOK);
    }

  return (OK);
}