Implement mu_imapio_reply_string function.
* include/mailutils/imapio.h (mu_imapio_reply_string): New proto. * libmailutils/imapio/replstr.c: New file. * libmailutils/imapio/Makefile.am: Add replstr.c
Showing
4 changed files
with
44 additions
and
1 deletions
... | @@ -43,6 +43,8 @@ int mu_imapio_trace_disable (mu_imapio_t io); | ... | @@ -43,6 +43,8 @@ int mu_imapio_trace_disable (mu_imapio_t io); |
43 | int mu_imapio_get_trace (mu_imapio_t io); | 43 | int mu_imapio_get_trace (mu_imapio_t io); |
44 | 44 | ||
45 | int mu_imapio_getbuf (mu_imapio_t io, char **pptr, size_t *psize); | 45 | int mu_imapio_getbuf (mu_imapio_t io, char **pptr, size_t *psize); |
46 | |||
47 | int mu_imapio_reply_string (struct _mu_imapio *io, size_t start, char **pbuf); | ||
46 | 48 | ||
47 | #ifdef __cplusplus | 49 | #ifdef __cplusplus |
48 | } | 50 | } | ... | ... |
... | @@ -30,7 +30,7 @@ mu_imapio_getline (struct _mu_imapio *io) | ... | @@ -30,7 +30,7 @@ mu_imapio_getline (struct _mu_imapio *io) |
30 | { | 30 | { |
31 | int rc; | 31 | int rc; |
32 | char *last_arg; | 32 | char *last_arg; |
33 | 33 | ||
34 | io->_imap_ws_flags &= ~MU_WRDSF_APPEND; | 34 | io->_imap_ws_flags &= ~MU_WRDSF_APPEND; |
35 | 35 | ||
36 | if (io->_imap_reply_ready) | 36 | if (io->_imap_reply_ready) | ... | ... |
libmailutils/imapio/replstr.c
0 → 100644
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | ||
2 | Copyright (C) 2011 Free Software Foundation, Inc. | ||
3 | |||
4 | GNU Mailutils is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 3, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | GNU Mailutils 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 | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. */ | ||
16 | |||
17 | #include <config.h> | ||
18 | #include <mailutils/types.h> | ||
19 | #include <mailutils/imapio.h> | ||
20 | #include <mailutils/errno.h> | ||
21 | #include <mailutils/argcv.h> | ||
22 | #include <mailutils/sys/imapio.h> | ||
23 | |||
24 | /* FIXME: It would be good to have a `, size_t *psize' argument, to allow | ||
25 | for passing an already allocated buffer. This implies similar changes | ||
26 | to mu_argcv_join. */ | ||
27 | int | ||
28 | mu_imapio_reply_string (struct _mu_imapio *io, size_t start, char **pbuf) | ||
29 | { | ||
30 | if (!io->_imap_reply_ready) | ||
31 | return MU_ERR_NOENT; | ||
32 | |||
33 | if (start >= io->_imap_ws.ws_wordc) | ||
34 | return EINVAL; | ||
35 | |||
36 | return mu_argcv_join (io->_imap_ws.ws_wordc - start, | ||
37 | io->_imap_ws.ws_wordv + start, " ", | ||
38 | mu_argcv_escape_no, | ||
39 | pbuf); | ||
40 | } |
-
Please register or sign in to post a comment