mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
Move copy_stream function to misc.c.
* dirmngr/ks-action.c (copy_stream): Move function from here... * dirmngr/misc.c (copy_stream): ... to here and drop the static qualifier. * dirmngr/misc.h (copy_stream): Add declaration. -- Signed-off-by: Neal H. Walfield <neal@g10code.de>
This commit is contained in:
parent
63552852bf
commit
9e79a15f74
@ -31,25 +31,6 @@
|
|||||||
#include "ks-action.h"
|
#include "ks-action.h"
|
||||||
|
|
||||||
|
|
||||||
/* Copy all data from IN to OUT. */
|
|
||||||
static gpg_error_t
|
|
||||||
copy_stream (estream_t in, estream_t out)
|
|
||||||
{
|
|
||||||
char buffer[512];
|
|
||||||
size_t nread;
|
|
||||||
|
|
||||||
while (!es_read (in, buffer, sizeof buffer, &nread))
|
|
||||||
{
|
|
||||||
if (!nread)
|
|
||||||
return 0; /* EOF */
|
|
||||||
if (es_write (out, buffer, nread, NULL))
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
return gpg_error_from_syserror ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Called by the engine's help functions to print the actual help. */
|
/* Called by the engine's help functions to print the actual help. */
|
||||||
gpg_error_t
|
gpg_error_t
|
||||||
ks_print_help (ctrl_t ctrl, const char *text)
|
ks_print_help (ctrl_t ctrl, const char *text)
|
||||||
|
@ -619,3 +619,21 @@ armor_data (char **r_string, const void *data, size_t datalen)
|
|||||||
*r_string = buffer;
|
*r_string = buffer;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Copy all data from IN to OUT. */
|
||||||
|
gpg_error_t
|
||||||
|
copy_stream (estream_t in, estream_t out)
|
||||||
|
{
|
||||||
|
char buffer[512];
|
||||||
|
size_t nread;
|
||||||
|
|
||||||
|
while (!es_read (in, buffer, sizeof buffer, &nread))
|
||||||
|
{
|
||||||
|
if (!nread)
|
||||||
|
return 0; /* EOF */
|
||||||
|
if (es_write (out, buffer, nread, NULL))
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
return gpg_error_from_syserror ();
|
||||||
|
}
|
||||||
|
@ -85,5 +85,7 @@ gpg_error_t create_estream_ksba_reader (ksba_reader_t *r_reader, estream_t fp);
|
|||||||
responsible for freeing *R_STRING. */
|
responsible for freeing *R_STRING. */
|
||||||
gpg_error_t armor_data (char **r_string, const void *data, size_t datalen);
|
gpg_error_t armor_data (char **r_string, const void *data, size_t datalen);
|
||||||
|
|
||||||
|
/* Copy all data from IN to OUT. */
|
||||||
|
gpg_error_t copy_stream (estream_t in, estream_t out);
|
||||||
|
|
||||||
#endif /* MISC_H */
|
#endif /* MISC_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user