1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2003-2021 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library. If not, see
16 <http://www.gnu.org/licenses/>. */
17
18 #ifdef HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21
22 #include <stdlib.h>
23 #include <stdio.h>
24 #include <stdarg.h>
25 #include <sys/time.h>
26 #include <sys/types.h>
27 #include <unistd.h>
28 #include <string.h>
29
30 #include <errno.h>
31 #include <mailutils/sys/pop3.h>
32
33 int
mu_pop3_writeline(mu_pop3_t pop3,const char * format,...)34 mu_pop3_writeline (mu_pop3_t pop3, const char *format, ...)
35 {
36 int status;
37 va_list ap;
38
39 va_start (ap, format);
40 status = mu_stream_vprintf (pop3->carrier, format, ap);
41 va_end(ap);
42 return status;
43 }
44
45 int
mu_pop3_sendline(mu_pop3_t pop3,const char * line)46 mu_pop3_sendline (mu_pop3_t pop3, const char *line)
47 {
48 if (line)
49 return mu_stream_write (pop3->carrier, line, strlen (line), NULL);
50 return mu_stream_flush (pop3->carrier);
51 }
52
53