Commit 519305fe authored by Werner Koch's avatar Werner Koch

Switch to the libgpg-error provided estream.

* configure.ac (NEED_GPG_ERROR_VERSION): Reguire 1.14.
(GPGRT_ENABLE_ES_MACROS): Define.
(estream_INIT): Remove.
* m4/estream.m4: Remove.
* common/estream-printf.c, common/estream-printf.h: Remove.
* common/estream.c, common/estream.h: Remove.
* common/init.c (_init_common_subsystems): Call gpgrt initialization.
parent a731c229
......@@ -59,7 +59,6 @@ endif
common_sources = \
common-defs.h \
util.h i18n.c i18n.h \
estream.c estream.h estream-printf.c estream-printf.h \
status.c status.h\
shareddefs.h \
openpgpdefs.h \
......
......@@ -47,7 +47,7 @@ vprint_assuan_status (assuan_context_t ctx,
int rc;
char *buf;
rc = estream_vasprintf (&buf, format, arg_ptr);
rc = gpgrt_vasprintf (&buf, format, arg_ptr);
if (rc < 0)
return gpg_err_make (default_errsource, gpg_err_code_from_syserror ());
rc = assuan_write_status (ctx, keyword, buf);
......
......@@ -381,7 +381,7 @@ writeout_v (audit_ctx_t ctx, const char *format, va_list arg_ptr)
{
char *buf;
estream_vasprintf (&buf, format, arg_ptr);
gpgrt_vasprintf (&buf, format, arg_ptr);
if (buf)
{
writeout (ctx, buf);
......
......@@ -22,8 +22,6 @@
#include <ksba.h>
#include "../common/estream.h"
struct audit_ctx_s;
typedef struct audit_ctx_s *audit_ctx_t;
......
This diff is collapsed.
/* estream-printf.h - Versatile mostly C-99 compliant printf formatting.
* Copyright (C) 2007, 2010, 2012 g10 Code GmbH
*
* This file is part of Libestream.
*
* Libestream is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* Libestream is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libestream; if not, see <http://www.gnu.org/licenses/>.
*
* ALTERNATIVELY, Libestream may be distributed under the terms of the
* following license, in which case the provisions of this license are
* required INSTEAD OF the GNU General Public License. If you wish to
* allow use of your version of this file only under the terms of the
* GNU General Public License, and not to allow others to use your
* version of this file under the terms of the following license,
* indicate your decision by deleting this paragraph and the license
* below.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, and the entire permission notice in its entirety,
* including the disclaimer of warranties.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ESTREAM_PRINTF_H
#define ESTREAM_PRINTF_H
#include <stdarg.h>
#include <stdio.h>
/* To use this file with libraries the following macro is useful:
#define _ESTREAM_EXT_SYM_PREFIX _foo_
This prefixes all external symbols with "_foo_".
For the implementation of the code (estream-printf.c) the following
macros may be used to tune the implementation for certain systems:
#define _ESTREAM_PRINTF_REALLOC foo_realloc
Make estream_asprintf and estream_vasprintf use foo_realloc
instead of the standard realloc to allocate memory returned to
the caller. Note that foo_realloc needs to be C-90 compliant:
foo_realloc (NULL,n) is the same as a call to malloc(n) and
foo_realloc (a, 0) is the same as a call to free (a).
#define _ESTREAM_PRINTF_EXTRA_INCLUDE "foo.h"
This includes the file "foo.h" which may provide prototypes for
the custom memory allocation functions.
*/
#ifdef _ESTREAM_EXT_SYM_PREFIX
#ifndef _ESTREAM_PREFIX
#define _ESTREAM_PREFIX1(x,y) x ## y
#define _ESTREAM_PREFIX2(x,y) _ESTREAM_PREFIX1(x,y)
#define _ESTREAM_PREFIX(x) _ESTREAM_PREFIX2(_ESTREAM_EXT_SYM_PREFIX,x)
#endif /*_ESTREAM_PREFIX*/
#define estream_printf_out_t _ESTREAM_PREFIX(estream_printf_out_t)
#define estream_format _ESTREAM_PREFIX(estream_format)
#define estream_printf _ESTREAM_PREFIX(estream_printf)
#define estream_fprintf _ESTREAM_PREFIX(estream_fprintf)
#define estream_vfprintf _ESTREAM_PREFIX(estream_vfprintf)
#define estream_snprintf _ESTREAM_PREFIX(estream_snprintf)
#define estream_vsnprintf _ESTREAM_PREFIX(estream_vsnprintf)
#define estream_asprintf _ESTREAM_PREFIX(estream_asprintf)
#define estream_vasprintf _ESTREAM_PREFIX(estream_vasprintf)
#endif /*_ESTREAM_EXT_SYM_PREFIX*/
#ifndef _ESTREAM_GCC_A_PRINTF
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4 )
# define _ESTREAM_GCC_A_PRINTF( f, a ) \
__attribute__ ((format (__gnu_printf__,f,a)))
# elif __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )
# define _ESTREAM_GCC_A_PRINTF( f, a ) \
__attribute__ ((format (printf,f,a)))
# else
# define _ESTREAM_GCC_A_PRINTF( f, a )
# endif
#endif /*_ESTREAM_GCC_A_PRINTF*/
#ifdef __cplusplus
extern "C"
{
#if 0
}
#endif
#endif
typedef int (*estream_printf_out_t)
(void *outfncarg, const char *buf, size_t buflen);
int estream_format (estream_printf_out_t outfnc, void *outfncarg,
const char *format, va_list vaargs)
_ESTREAM_GCC_A_PRINTF(3,0);
int estream_printf (const char *format, ...)
_ESTREAM_GCC_A_PRINTF(1,2);
int estream_fprintf (FILE *fp, const char *format, ... )
_ESTREAM_GCC_A_PRINTF(2,3);
int estream_vfprintf (FILE *fp, const char *format, va_list arg_ptr)
_ESTREAM_GCC_A_PRINTF(2,0);
int estream_snprintf (char *buf, size_t bufsize, const char *format, ...)
_ESTREAM_GCC_A_PRINTF(3,4);
int estream_vsnprintf (char *buf,size_t bufsize,
const char *format, va_list arg_ptr)
_ESTREAM_GCC_A_PRINTF(3,0);
int estream_asprintf (char **bufp, const char *format, ...)
_ESTREAM_GCC_A_PRINTF(2,3);
int estream_vasprintf (char **bufp, const char *format, va_list arg_ptr)
_ESTREAM_GCC_A_PRINTF(2,0);
#ifdef __cplusplus
}
#endif
#endif /*ESTREAM_PRINTF_H*/
This diff is collapsed.
This diff is collapsed.
......@@ -30,8 +30,6 @@
#ifndef GNUPG_COMMON_EXECHELP_H
#define GNUPG_COMMON_EXECHELP_H
#include "../common/estream.h"
/* Return the maximum number of currently allowed file descriptors.
Only useful on POSIX systems. */
......
......@@ -1565,7 +1565,7 @@ send_request (http_t hd, const char *httphost, const char *auth,
if (http_proxy && *http_proxy)
{
request = es_asprintf
request = es_bsprintf
("%s %s://%s:%hu%s%s HTTP/1.0\r\n%s%s",
hd->req_type == HTTP_REQ_GET ? "GET" :
hd->req_type == HTTP_REQ_HEAD ? "HEAD" :
......@@ -1585,7 +1585,7 @@ send_request (http_t hd, const char *httphost, const char *auth,
else
snprintf (portstr, sizeof portstr, ":%u", port);
request = es_asprintf
request = es_bsprintf
("%s %s%s HTTP/1.0\r\nHost: %s%s\r\n%s",
hd->req_type == HTTP_REQ_GET ? "GET" :
hd->req_type == HTTP_REQ_HEAD ? "HEAD" :
......
......@@ -31,7 +31,6 @@
#define GNUPG_COMMON_HTTP_H
#include <gpg-error.h>
#include "../common/estream.h"
struct uri_tuple_s
{
......
......@@ -173,7 +173,11 @@ _init_common_subsystems (gpg_err_source_t errsource, int *argcp, char ***argvp)
#endif
/* Initialize the Estream library. */
es_init ();
gpgrt_init ();
gpgrt_set_alloc_func (gcry_realloc);
#ifdef USE_NPTH
gpgrt_set_syscall_clamp (npth_unprotect, npth_protect);
#endif
/* Special hack for Windows CE: We extract some options from arg
to setup the standard handles. */
......@@ -191,7 +195,7 @@ _init_common_subsystems (gpg_err_source_t errsource, int *argcp, char ***argvp)
{
int i;
for (i=0; i < 3; i++)
(void)_es_get_std_stream (i);
(void)_gpgrt_get_std_stream (i);
}
/* --version et al shall use estream as well. */
......
......@@ -33,7 +33,6 @@
#include "../common/types.h"
#include "../common/sysutils.h"
#include "../common/estream.h"
#define DBG_IOBUF iobuf_debug_mode
......
......@@ -33,7 +33,6 @@
#define LIBJNLIB_LOGGING_H
#include <stdio.h>
#include "estream.h"
#include "mischelp.h"
#include "w32help.h"
......
......@@ -132,7 +132,7 @@ put_membuf_printf (membuf_t *mb, const char *format, ...)
char *buf;
va_start (arg_ptr, format);
rc = estream_vasprintf (&buf, format, arg_ptr);
rc = gpgrt_vasprintf (&buf, format, arg_ptr);
if (rc < 0)
mb->out_of_core = errno ? errno : ENOMEM;
va_end (arg_ptr);
......
......@@ -145,6 +145,47 @@ print_fname_stdin (const char *s)
}
static int
do_print_utf8_buffer (estream_t stream,
const void *buffer, size_t length,
const char *delimiters, size_t *bytes_written)
{
const char *p = buffer;
size_t i;
/* We can handle plain ascii simpler, so check for it first. */
for (i=0; i < length; i++ )
{
if ( (p[i] & 0x80) )
break;
}
if (i < length)
{
int delim = delimiters? *delimiters : 0;
char *buf;
int ret;
/*(utf8 conversion already does the control character quoting). */
buf = utf8_to_native (p, length, delim);
if (bytes_written)
*bytes_written = strlen (buf);
ret = es_fputs (buf, stream);
xfree (buf);
return ret == EOF? ret : (int)i;
}
else
return es_write_sanitized (stream, p, length, delimiters, bytes_written);
}
void
print_utf8_buffer3 (estream_t stream, const void *p, size_t n,
const char *delim)
{
do_print_utf8_buffer (stream, p, n, delim, NULL);
}
void
print_utf8_buffer2 (estream_t stream, const void *p, size_t n, int delim)
{
......@@ -152,14 +193,14 @@ print_utf8_buffer2 (estream_t stream, const void *p, size_t n, int delim)
tmp[0] = delim;
tmp[1] = 0;
es_write_sanitized_utf8_buffer (stream, p, n, tmp, NULL);
do_print_utf8_buffer (stream, p, n, tmp, NULL);
}
void
print_utf8_buffer (estream_t stream, const void *p, size_t n)
{
es_write_sanitized_utf8_buffer (stream, p, n, NULL, NULL);
do_print_utf8_buffer (stream, p, n, NULL, NULL);
}
/* Write LENGTH bytes of BUFFER to FP as a hex encoded string.
......
......@@ -148,7 +148,7 @@ main (int argc, char **argv)
const char *cafile = NULL;
http_session_t session = NULL;
es_init ();
gpgrt_init ();
log_set_prefix (PGM, 1 | 4);
if (argc)
{ argc--; argv++; }
......
......@@ -648,7 +648,7 @@ tty_getf (const char *promptfmt, ... )
char *answer;
va_start (arg_ptr, promptfmt);
if (estream_vasprintf (&prompt, promptfmt, arg_ptr) < 0)
if (gpgrt_vasprintf (&prompt, promptfmt, arg_ptr) < 0)
log_fatal ("estream_vasprintf failed: %s\n", strerror (errno));
va_end (arg_ptr);
answer = tty_get (prompt);
......
......@@ -33,16 +33,12 @@
#include <gcrypt.h> /* We need this for the memory function protos. */
#include <errno.h> /* We need errno. */
#include <gpg-error.h> /* We need gpg_error_t. */
#include <gpg-error.h> /* We need gpg_error_t and estream. */
/* Hash function used with libksba. */
#define HASH_FNC ((void (*)(void *, const void*,size_t))gcry_md_write)
/* Estream replaces most uses of stdio. */
#include "../common/estream.h"
#include "../common/estream-printf.h"
/* Get all the stuff from jnlib. */
#include "../common/logging.h"
#include "../common/argparse.h"
......@@ -57,13 +53,13 @@
/* Redefine asprintf by our estream version which uses our own memory
allocator.. */
#define asprintf estream_asprintf
#define vasprintf estream_vasprintf
#define asprintf gpgrt_asprintf
#define vasprintf gpgrt_vasprintf
/* Due to a bug in mingw32's snprintf related to the 'l' modifier and
for increased portability we use our snprintf on all systems. */
#undef snprintf
#define snprintf estream_snprintf
#define snprintf gpgrt_snprintf
/* GCC attributes. */
......@@ -278,6 +274,8 @@ const char *gnupg_cipher_algo_name (int algo);
const char *print_fname_stdout (const char *s);
const char *print_fname_stdin (const char *s);
void print_utf8_buffer3 (estream_t fp, const void *p, size_t n,
const char *delim);
void print_utf8_buffer2 (estream_t fp, const void *p, size_t n, int delim);
void print_utf8_buffer (estream_t fp, const void *p, size_t n);
void print_hexstring (FILE *fp, const void *buffer, size_t length,
......
......@@ -32,15 +32,14 @@
#include <errno.h>
#include "util.h"
#include "iobuf.h"
#if !defined(_ESTREAM_PRINTF_REALLOC)
#error Need to define _ESTREAM_PRINTF_REALLOC
#endif
/* Same as asprintf but return an allocated buffer suitable to be
freed using xfree. This function simply dies on memory failure,
thus no extra check is required. */
thus no extra check is required.
FIXME: We should remove these functions in favor of gpgrt_bsprintf
and a xgpgrt_bsprintf or rename them to xbsprintf and
xtrybsprintf. */
char *
xasprintf (const char *fmt, ...)
{
......@@ -48,7 +47,7 @@ xasprintf (const char *fmt, ...)
char *buf;
va_start (ap, fmt);
if (estream_vasprintf (&buf, fmt, ap) < 0)
if (gpgrt_vasprintf (&buf, fmt, ap) < 0)
log_fatal ("estream_asprintf failed: %s\n", strerror (errno));
va_end (ap);
return buf;
......@@ -63,7 +62,7 @@ xtryasprintf (const char *fmt, ...)
char *buf;
va_start (ap, fmt);
rc = estream_vasprintf (&buf, fmt, ap);
rc = gpgrt_vasprintf (&buf, fmt, ap);
va_end (ap);
if (rc < 0)
return NULL;
......
......@@ -50,7 +50,7 @@ m4_define([mym4_revision_dec], m4_argn(8, mym4_verslist))
m4_esyscmd([echo ]mym4_version[>VERSION])
AC_INIT([mym4_package],[mym4_version], [http://bugs.gnupg.org])
NEED_GPG_ERROR_VERSION=1.13
NEED_GPG_ERROR_VERSION=1.14
NEED_LIBGCRYPT_API=1
NEED_LIBGCRYPT_VERSION=1.6.0
......@@ -497,6 +497,8 @@ AH_BOTTOM([
# endif
#endif
/* Provide the es_ macro for estream. */
#define GPGRT_ENABLE_ES_MACROS 1
/* Tell libgcrypt not to use its own libgpg-error implementation. */
#define USE_LIBGPG_ERROR 1
......@@ -515,11 +517,6 @@ AH_BOTTOM([
handler. */
#define HTTP_NO_WSASTARTUP
/* We want to use the libgcrypt provided memory allocation for
asprintf. */
#define _ESTREAM_PRINTF_REALLOC gcry_realloc
#define _ESTREAM_PRINTF_EXTRA_INCLUDE "../common/util.h"
/* Under Windows we use the gettext code from libgpg-error. */
#define GPG_ERR_ENABLE_GETTEXT_MACROS
......@@ -1495,14 +1492,6 @@ if test "$GCC" = yes; then
if test x"$_gcc_psign" = xyes ; then
CFLAGS="$CFLAGS -Wpointer-arith"
fi
# The undocumented option -Wno-psabi suppresses the annoying
# "the ABI of passing union with long double has changed in GCC 4.4"
# which is emitted in estream-printf.c but entirely irrelvant
# because that union is local to the file.
if test x"$_gcc_silent_wno" = xyes ; then
CFLAGS="$CFLAGS -Wno-psabi"
fi
fi
......@@ -1517,12 +1506,6 @@ AC_ARG_ENABLE(optimization,
CFLAGS=`echo $CFLAGS | sed s/-O[[1-9]]\ /-O0\ /g`
fi])
#
# Prepare building of estream
#
estream_INIT
#
# Decide what to build
#
......
......@@ -113,7 +113,6 @@
#include "crlfetch.h"
#include "misc.h"
#include "cdb.h"
#include "estream-printf.h"
/* Change this whenever the format changes */
#define DBDIR_D (opt.system_daemon? "crls.d" : "dirmngr-cache.d")
......@@ -818,7 +817,7 @@ update_dir (crl_cache_t cache)
nodename = utsbuf.nodename;
#endif
estream_asprintf (&tmpbuf, "DIR-tmp-%s-%u-%p.txt.tmp",
gpgrt_asprintf (&tmpbuf, "DIR-tmp-%s-%u-%p.txt.tmp",
nodename, (unsigned int)getpid (), &tmpbuf);
if (!tmpbuf)
{
......@@ -2022,7 +2021,7 @@ crl_cache_insert (ctrl_t ctrl, const char *url, ksba_reader_t reader)
nodename = utsbuf.nodename;
#endif
estream_asprintf (&tmpfname, "crl-tmp-%s-%u-%p.db.tmp",
gpgrt_asprintf (&tmpfname, "crl-tmp-%s-%u-%p.db.tmp",
nodename, (unsigned int)getpid (), &tmpfname);
if (!tmpfname)
{
......
......@@ -29,7 +29,6 @@
#include "misc.h"
#include "http.h"
#include "estream.h"
#include "ldap-wrapper.h"
......
......@@ -50,6 +50,7 @@
#define JNLIB_NEED_LOG_LOGV
#include <gpg-error.h>
#include "../common/logging.h"
#include "../common/argparse.h"
#include "../common/stringhelp.h"
......
......@@ -67,7 +67,7 @@ ks_printf_help (ctrl_t ctrl, const char *format, ...)
char *buf;
va_start (arg_ptr, format);
buf = es_vasprintf (format, arg_ptr);
buf = es_vbsprintf (format, arg_ptr);
err = buf? 0 : gpg_error_from_syserror ();
va_end (arg_ptr);
if (!err)
......
......@@ -20,13 +20,12 @@
#ifndef DIRMNGR_KS_ENGINE_H
#define DIRMNGR_KS_ENGINE_H 1
#include "../common/estream.h"
#include "../common/http.h"
/*-- ks-action.c --*/
gpg_error_t ks_print_help (ctrl_t ctrl, const char *text);
gpg_error_t ks_printf_help (ctrl_t ctrl, const char *format,
...) _ESTREAM_GCC_A_PRINTF(2,3);
...) JNLIB_GCC_A_PRINTF(2,3);
/*-- ks-engine-hkp.c --*/
gpg_error_t ks_hkp_resolve (ctrl_t ctrl, parsed_uri_t uri);
......
......@@ -30,7 +30,6 @@
#include "validate.h"
#include "certcache.h"
#include "ocsp.h"
#include "estream.h"
/* The maximum size we allow as a response from an OCSP reponder. */
#define MAX_RESPONSE_SIZE 65536
......
......@@ -34,7 +34,6 @@
#include "backend.h"
#include "utils.h"
#include "call-gpg.h"
#include "estream.h"
/* Create a new blob with all the session keys and other meta
information which are to be stored encrypted in the crypto
......
......@@ -28,7 +28,6 @@
#include "../common/util.h"
#include "../common/status.h"
#include "../common/estream.h"
#include "../common/session-env.h"
/* A large struct named "opt" to keep global flags. */
......
......@@ -34,7 +34,6 @@
#include "backend.h"
#include "utils.h"
#include "call-gpg.h"
#include "estream.h"
#include "mountinfo.h"
#include "runner.h"
......
......@@ -29,6 +29,7 @@
#include <assert.h>
#define JNLIB_NEED_LOG_LOGV
#include <gpg-error.h>
#include "../common/logging.h"
#include "../common/argparse.h"
#include "../common/stringhelp.h"
......
......@@ -8,8 +8,6 @@ EXTRA_DIST += gpg-error.m4 libgcrypt.m4 libassuan.m4 ksba.m4
EXTRA_DIST += autobuild.m4
EXTRA_DIST += estream.m4
EXTRA_DIST += sys_socket_h.m4 socklen.m4
EXTRA_DIST += ChangeLog-2011
dnl Autoconf macros for libestream
dnl Copyright (C) 2007 g10 Code GmbH
dnl
dnl This file is free software; as a special exception the author gives
dnl unlimited permission to copy and/or distribute it, with or without
dnl modifications, as long as this notice is preserved.
dnl
dnl This file is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
dnl estream_PRINTF_INIT
dnl Prepare build of source included estream-printf.c
dnl
AC_DEFUN([estream_PRINTF_INIT],
[
AC_MSG_NOTICE([checking system features for estream-printf])
AC_CHECK_HEADERS(stdint.h)
AC_TYPE_LONG_LONG_INT
AC_TYPE_LONG_DOUBLE
AC_TYPE_INTMAX_T
AC_TYPE_UINTMAX_T
AC_CHECK_TYPES([ptrdiff_t])
AC_CHECK_SIZEOF([unsigned long])
AC_CHECK_SIZEOF([void *])
AC_CACHE_CHECK([for nl_langinfo and THOUSANDS_SEP],
estream_cv_langinfo_thousands_sep,
[AC_TRY_LINK([#include <langinfo.h>],
[char* cs = nl_langinfo(THOUSANDS_SEP); return !cs;],
estream_cv_langinfo_thousands_sep=yes,
estream_cv_langinfo_thousands_sep=no)
])
if test $estream_cv_langinfo_thousands_sep = yes; then
AC_DEFINE(HAVE_LANGINFO_THOUSANDS_SEP, 1,
[Define if you have <langinfo.h> and nl_langinfo(THOUSANDS_SEP).])
fi
])
dnl estream_INIT
dnl Prepare build of source included estream.c
dnl
AC_DEFUN([estream_INIT],
[
AC_REQUIRE([estream_PRINTF_INIT])
AC_MSG_NOTICE([checking system features for estream])
])
......@@ -1448,9 +1448,8 @@ get_public_key (app_t app, int keyno)
}
hexkeyid = fpr + 24;
ret = estream_asprintf (&command,
"gpg --list-keys --with-colons --with-key-data '%s'",
fpr);
ret = gpgrt_asprintf
(&command, "gpg --list-keys --with-colons --with-key-data '%s'", fpr);
if (ret < 0)
{
err = gpg_error_from_syserror ();
......
......@@ -24,7 +24,7 @@
#include <string.h>
#include <assert.h>
#include "../common/estream.h"
#include <gpg-error.h>
#include "../common/logging.h"
#include "atr.h"
......
......@@ -686,7 +686,7 @@ cmd_learn (assuan_context_t ctx, char *line)
{
char *command;
rc = estream_asprintf (&command, "KNOWNCARDP %s %lu",
rc = gpgrt_asprintf (&command, "KNOWNCARDP %s %lu",
serial, (unsigned long)stamp);
if (rc < 0)
{
......@@ -915,7 +915,7 @@ pin_cb (void *opaque, const char *info, char **retstr)
if (info)
{
log_debug ("prompting for pinpad entry '%s'\n", info);
rc = estream_asprintf (&command, "POPUPPINPADPROMPT %s", info);
rc = gpgrt_asprintf (&command, "POPUPPINPADPROMPT %s", info);
if (rc < 0)
return gpg_error (gpg_err_code_from_errno (errno));
rc = assuan_inquire (ctx, command, &value, &valuelen, MAXLEN_PIN);
......@@ -935,7 +935,7 @@ pin_cb (void *opaque, const char *info, char **retstr)
*retstr = NULL;
log_debug ("asking for PIN '%s'\n", info);
rc = estream_asprintf (&command, "NEEDPIN %s", info);
rc = gpgrt_asprintf (&command, "NEEDPIN %s", info);
if (rc < 0)
return gpg_error (gpg_err_code_from_errno (errno));
......@@ -2340,7 +2340,7 @@ update_reader_status_file (int set_card_removed_flag)
gpg_error_t err;
homestr = make_filename (opt.homedir, NULL);
if (estream_asprintf (&envstr, "GNUPGHOME=%s", homestr) < 0)
if (gpgrt_asprintf (&envstr, "GNUPGHOME=%s", homestr) < 0)
log_error ("out of core while building environment\n");
else
{
......
......@@ -826,7 +826,7 @@ main (int argc, char **argv )
close (fd);
/* create the info string: <name>:<pid>:<protocol_version> */
if (estream_asprintf (&infostr, "SCDAEMON_INFO=%s:%lu:1",
if (gpgrt_asprintf (&infostr, "SCDAEMON_INFO=%s:%lu:1",
socket_name, (ulong) pid) < 0)
{
log_error ("out of core\n");
......
......@@ -504,9 +504,8 @@ print_dn_part (FILE *fp, estream_t stream,
{
es_fprintf (stream, "/%s=", dn->key);
if (translate)
es_write_sanitized_utf8_buffer (stream, dn->value,
strlen (dn->value),
"/", NULL);
print_utf8_buffer3 (stream, dn->value, strlen (dn->value),
"/");
else
es_write_sanitized (stream, dn->value, strlen (dn->value),
"/", NULL);
......@@ -716,8 +715,7 @@ gpgsm_es_print_name2 (estream_t fp, const char *name, int translate)
if (s2)