Commit e809fe4f e809fe4f159a6522b7187d9174bfc20e9c54c837 by Sergey Poznyakoff

Use pop3d_outf instead of fprintf

1 parent fdcf0b75
......@@ -256,7 +256,7 @@ pop3d_apop (const char *arg)
username = strdup (pw->pw_name);
if (username == NULL)
pop3d_abquit (ERR_NO_MEM);
fprintf (ofile, "+OK opened mailbox for %s\r\n", username);
pop3d_outf ("+OK opened mailbox for %s\r\n", username);
/* mailbox name */
{
url_t url = NULL;
......
......@@ -35,17 +35,17 @@ pop3d_capa (const char *arg)
if (state != AUTHORIZATION && state != TRANSACTION)
return ERR_WRONG_STATE;
fprintf (ofile, "+OK Capability list follows\r\n");
fprintf (ofile, "TOP\r\n");
fprintf (ofile, "USER\r\n");
fprintf (ofile, "UIDL\r\n");
fprintf (ofile, "RESP-CODES\r\n");
fprintf (ofile, "PIPELINING\r\n");
pop3d_outf ("+OK Capability list follows\r\n");
pop3d_outf ("TOP\r\n");
pop3d_outf ("USER\r\n");
pop3d_outf ("UIDL\r\n");
pop3d_outf ("RESP-CODES\r\n");
pop3d_outf ("PIPELINING\r\n");
/* FIXME: This can be Implemented by setting an header field on the
message. */
/*fprintf (ofile, "EXPIRE NEVER\r\n"); */
/*pop3d_outf ("EXPIRE NEVER\r\n"); */
if (state == TRANSACTION) /* let's not advertise to just anyone */
fprintf (ofile, "IMPLEMENTATION %s %s\r\n", IMPL, VERSION);
fprintf (ofile, ".\r\n");
pop3d_outf ("IMPLEMENTATION %s %s\r\n", IMPL, VERSION);
pop3d_outf (".\r\n");
return OK;
}
......
......@@ -39,6 +39,6 @@ pop3d_dele (const char *arg)
message_get_attribute (msg, &attr);
attribute_set_deleted (attr);
fprintf (ofile, "+OK Message %d marked\r\n", num);
pop3d_outf ("+OK Message %d marked\r\n", num);
return OK;
}
......
......@@ -37,7 +37,7 @@ pop3d_list (const char *arg)
if (strlen (arg) == 0)
{
size_t total = 0;
fprintf (ofile, "+OK\r\n");
pop3d_outf ("+OK\r\n");
mailbox_messages_count (mbox, &total);
for (mesgno = 1; mesgno <= total; mesgno++)
{
......@@ -47,10 +47,10 @@ pop3d_list (const char *arg)
{
message_size (msg, &size);
message_lines (msg, &lines);
fprintf (ofile, "%d %d\r\n", mesgno, size + lines);
pop3d_outf ("%d %d\r\n", mesgno, size + lines);
}
}
fprintf (ofile, ".\r\n");
pop3d_outf (".\r\n");
}
else
{
......@@ -62,7 +62,7 @@ pop3d_list (const char *arg)
return ERR_MESG_DELE;
message_size (msg, &size);
message_lines (msg, &lines);
fprintf (ofile, "+OK %d %d\r\n", mesgno, size + lines);
pop3d_outf ("+OK %d %d\r\n", mesgno, size + lines);
}
return OK;
......
......@@ -26,6 +26,6 @@ pop3d_noop (const char *arg)
return ERR_BAD_ARGS;
if (state != TRANSACTION)
return ERR_WRONG_STATE;
fprintf (ofile, "+OK\r\n");
pop3d_outf ("+OK\r\n");
return OK;
}
......
......@@ -48,6 +48,6 @@ pop3d_quit (const char *arg)
free (md5shared);
if (err == OK)
fprintf (ofile, "+OK\r\n");
pop3d_outf ("+OK\r\n");
return err;
}
......
......@@ -46,7 +46,7 @@ pop3d_retr (const char *arg)
return ERR_MESG_DELE;
message_get_stream (msg, &stream);
fprintf (ofile, "+OK\r\n");
pop3d_outf ("+OK\r\n");
off = n = 0;
buf = malloc (buflen * sizeof (*buf));
......@@ -68,9 +68,9 @@ pop3d_retr (const char *arg)
continue;
}
if (buf[0] == '.')
fprintf (ofile, ".%s\r\n", buf);
pop3d_outf (".%s\r\n", buf);
else
fprintf (ofile, "%s\r\n", buf);
pop3d_outf ("%s\r\n", buf);
off += n;
}
......@@ -78,7 +78,7 @@ pop3d_retr (const char *arg)
attribute_set_read (attr);
free (buf);
fprintf (ofile, ".\r\n");
pop3d_outf (".\r\n");
return OK;
}
......
......@@ -42,6 +42,6 @@ pop3d_rset (const char *arg)
if (attribute_is_deleted (attr))
attribute_unset_deleted (attr);
}
fprintf (ofile, "+OK\r\n");
pop3d_outf ("+OK\r\n");
return OK;
}
......
......@@ -55,7 +55,7 @@ pop3d_stat (const char *arg)
num++;
}
}
fprintf (ofile, "+OK %d %d\r\n", num, tsize);
pop3d_outf ("+OK %d %d\r\n", num, tsize);
return OK;
}
......
......@@ -58,7 +58,7 @@ pop3d_top (const char *arg)
if (attribute_is_deleted (attr))
return ERR_MESG_DELE;
fprintf (ofile, "+OK\r\n");
pop3d_outf ("+OK\r\n");
/* Header. */
message_get_header (msg, &hdr);
......@@ -74,10 +74,10 @@ pop3d_top (const char *arg)
if (buf[n - 1] == '\n')
{
buf[n - 1] = '\0';
fprintf (ofile, "%s\r\n", buf);
pop3d_outf ("%s\r\n", buf);
}
else
fprintf (ofile, "%s", buf);
pop3d_outf ("%s", buf);
off += n;
}
......@@ -102,16 +102,16 @@ pop3d_top (const char *arg)
continue;
}
if (buf[0] == '.')
fprintf (ofile, ".%s\r\n", buf);
pop3d_outf (".%s\r\n", buf);
else
fprintf (ofile, "%s\r\n", buf);
pop3d_outf ("%s\r\n", buf);
lines--;
off += n;
}
}
free (buf);
fprintf (ofile, ".\r\n");
pop3d_outf (".\r\n");
return OK;
}
......
......@@ -34,7 +34,7 @@ pop3d_uidl (const char *arg)
if (strlen (arg) == 0)
{
size_t total = 0;
fprintf (ofile, "+OK\r\n");
pop3d_outf ("+OK\r\n");
mailbox_messages_count (mbox, &total);
for (mesgno = 1; mesgno <= total; mesgno++)
{
......@@ -43,10 +43,10 @@ pop3d_uidl (const char *arg)
if (!attribute_is_deleted (attr))
{
message_get_uidl (msg, uidl, sizeof (uidl), NULL);
fprintf (ofile, "%d %s\r\n", mesgno, uidl);
pop3d_outf ("%d %s\r\n", mesgno, uidl);
}
}
fprintf (ofile, ".\r\n");
pop3d_outf (".\r\n");
}
else
{
......@@ -57,7 +57,7 @@ pop3d_uidl (const char *arg)
if (attribute_is_deleted (attr))
return ERR_MESG_DELE;
message_get_uidl (msg, uidl, sizeof (uidl), NULL);
fprintf (ofile, "+OK %d %s\r\n", mesgno, uidl);
pop3d_outf ("+OK %d %s\r\n", mesgno, uidl);
}
return OK;
......