From 890d4b9449f9f022505ece7811dde7c36fcc4c68 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 10 Sep 2002 00:47:32 +0000 Subject: [PATCH] Moved stdio replacements from liblutil lutil_* to liblber ber_pvt_*. --- acconfig.h | 12 +++++----- configure | 4 ++-- configure.in | 4 ++-- include/portable.h.in | 12 +++++----- libraries/liblber/Makefile.in | 3 +++ libraries/{liblutil => liblber}/stdio.c | 30 ++++++++++++------------- 6 files changed, 33 insertions(+), 32 deletions(-) rename libraries/{liblutil => liblber}/stdio.c (87%) diff --git a/acconfig.h b/acconfig.h index cdd82b766f..37ec724e6d 100644 --- a/acconfig.h +++ b/acconfig.h @@ -100,12 +100,12 @@ * vsnprintf and snprintf are used too, but they are already * checked by the configure script */ -#define fputs lutil_fputs -#define fgets lutil_fgets -#define printf lutil_printf -#define fprintf lutil_fprintf -#define vfprintf lutil_vfprintf -#define vsprintf lutil_vsprintf +#define fputs ber_pvt_fputs +#define fgets ber_pvt_fgets +#define printf ber_pvt_printf +#define fprintf ber_pvt_fprintf +#define vfprintf ber_pvt_vfprintf +#define vsprintf ber_pvt_vsprintf #endif #include "ldap_cdefs.h" diff --git a/configure b/configure index 7aec0fede0..8b2d460d8b 100755 --- a/configure +++ b/configure @@ -22256,13 +22256,13 @@ if test "$ac_cv_func_snprintf" != yes -o "$ac_cv_func_vsnprintf" != yes; then LIBOBJS="$LIBOBJS stdio.o" if test "$ac_cv_func_snprintf" != yes; then cat >> confdefs.h <<\EOF -#define snprintf lutil_snprintf +#define snprintf ber_pvt_snprintf EOF fi if test "$ac_cv_func_vsnprintf" != yes; then cat >> confdefs.h <<\EOF -#define vsnprintf lutil_vsnprintf +#define vsnprintf ber_pvt_vsnprintf EOF fi diff --git a/configure.in b/configure.in index 899cd51b84..6be54b88d3 100644 --- a/configure.in +++ b/configure.in @@ -2491,10 +2491,10 @@ if test "$ac_cv_func_snprintf" != yes -o "$ac_cv_func_vsnprintf" != yes; then LIBSRCS="$LIBSRCS stdio.c" LIBOBJS="$LIBOBJS stdio.o" if test "$ac_cv_func_snprintf" != yes; then - AC_DEFINE(snprintf, lutil_snprintf, [define to snprintf routine]) + AC_DEFINE(snprintf, ber_pvt_snprintf, [define to snprintf routine]) fi if test "$ac_cv_func_vsnprintf" != yes; then - AC_DEFINE(vsnprintf, lutil_vsnprintf, [define to snprintf routine]) + AC_DEFINE(vsnprintf, ber_pvt_vsnprintf, [define to snprintf routine]) fi fi diff --git a/include/portable.h.in b/include/portable.h.in index 8846242686..b4d2b7ee11 100644 --- a/include/portable.h.in +++ b/include/portable.h.in @@ -1030,12 +1030,12 @@ * vsnprintf and snprintf are used too, but they are already * checked by the configure script */ -#define fputs lutil_fputs -#define fgets lutil_fgets -#define printf lutil_printf -#define fprintf lutil_fprintf -#define vfprintf lutil_vfprintf -#define vsprintf lutil_vsprintf +#define fputs ber_pvt_fputs +#define fgets ber_pvt_fgets +#define printf ber_pvt_printf +#define fprintf ber_pvt_fprintf +#define vfprintf ber_pvt_vfprintf +#define vsprintf ber_pvt_vsprintf #endif #include "ldap_cdefs.h" diff --git a/libraries/liblber/Makefile.in b/libraries/liblber/Makefile.in index 87da85611a..cae30fbc54 100644 --- a/libraries/liblber/Makefile.in +++ b/libraries/liblber/Makefile.in @@ -10,6 +10,9 @@ LIBRARY = liblber.la NT_SRCS = nt_err.c NT_OBJS = nt_err.lo +UNIX_SRCS = stdio.c +UNIX_OBJS = stdio.lo + LIB_DEFS = -DLBER_LIBRARY SRCS= assert.c decode.c encode.c io.c bprint.c debug.c \ diff --git a/libraries/liblutil/stdio.c b/libraries/liblber/stdio.c similarity index 87% rename from libraries/liblutil/stdio.c rename to libraries/liblber/stdio.c index 39d8a37541..0c5205ac80 100644 --- a/libraries/liblutil/stdio.c +++ b/libraries/liblber/stdio.c @@ -10,8 +10,6 @@ #include #include -#include - #if !defined(HAVE_VSNPRINTF) && !defined(HAVE_EBCDIC) /* Write at most n characters to the buffer in str, return the * number of chars written or -1 if the buffer would have been @@ -35,7 +33,7 @@ * version of vsnprintf there. */ #include -int lutil_vsnprintf( char *str, size_t n, const char *fmt, va_list ap ) +int ber_pvt_vsnprintf( char *str, size_t n, const char *fmt, va_list ap ) { int fds[2], res; FILE *f; @@ -62,7 +60,7 @@ int lutil_vsnprintf( char *str, size_t n, const char *fmt, va_list ap ) #endif #ifndef HAVE_SNPRINTF -int lutil_snprintf( char *str, size_t n, const char *fmt, ... ) +int ber_pvt_snprintf( char *str, size_t n, const char *fmt, ... ) { va_list ap; int res; @@ -91,14 +89,14 @@ int lutil_snprintf( char *str, size_t n, const char *fmt, ... ) #undef fputs #undef fgets -char *lutil_fgets( char *s, int n, FILE *fp ) +char *ber_pvt_fgets( char *s, int n, FILE *fp ) { s = (char *)fgets( s, n, fp ); if ( s ) __etoa( s ); return s; } -int lutil_fputs( const char *str, FILE *fp ) +int ber_pvt_fputs( const char *str, FILE *fp ) { char buf[8192]; @@ -116,7 +114,7 @@ int lutil_fputs( const char *str, FILE *fp ) * may need to be extended to recognize other qualifiers but so * far this seems to be enough. */ -int lutil_vsnprintf( char *str, size_t n, const char *fmt, va_list ap ) +int ber_pvt_vsnprintf( char *str, size_t n, const char *fmt, va_list ap ) { char *ptr, *pct, *s2, *f2, *end; char fm2[64]; @@ -137,7 +135,7 @@ int lutil_vsnprintf( char *str, size_t n, const char *fmt, va_list ap ) if (rem < 1) return -1; if (rem < len) len = rem; } - s2 = lutil_strncopy( s2, ptr, len ); + s2 = ber_pvt_strncopy( s2, ptr, len ); /* Did we cheat the length above? If so, bail out */ if (len < pct-ptr) return -1; for (pct++, f2 = fm2+1; isdigit(*pct);) *f2++ = *pct++; @@ -172,17 +170,17 @@ int lutil_vsnprintf( char *str, size_t n, const char *fmt, va_list ap ) rem = end-s2; if (rem > 0) { len = strlen(ptr); - s2 = lutil_strncopy( s2, ptr, rem ); + s2 = ber_pvt_strncopy( s2, ptr, rem ); rem -= len; } if (rem < 0) return -1; } else { - s2 = lutil_strcopy( s2, ptr ); + s2 = ber_pvt_strcopy( s2, ptr ); } return s2 - str; } -int lutil_vsprintf( char *str, const char *fmt, va_list ap ) +int ber_pvt_vsprintf( char *str, const char *fmt, va_list ap ) { return vsnprintf( str, 0, fmt, ap ); } @@ -192,7 +190,7 @@ int lutil_vsprintf( char *str, const char *fmt, va_list ap ) * Hopefully we never try to write something bigger than this * in a log msg... */ -int lutil_vfprintf( FILE *fp, const char *fmt, va_list ap ) +int ber_pvt_vfprintf( FILE *fp, const char *fmt, va_list ap ) { char buf[8192]; int res; @@ -204,24 +202,24 @@ int lutil_vfprintf( FILE *fp, const char *fmt, va_list ap ) return res; } -int lutil_printf( const char *fmt, ... ) +int ber_pvt_printf( const char *fmt, ... ) { va_list ap; int res; va_start( ap, fmt ); - res = lutil_vfprintf( stdout, fmt, ap ); + res = ber_pvt_vfprintf( stdout, fmt, ap ); va_end( ap ); return res; } -int lutil_fprintf( FILE *fp, const char *fmt, ... ) +int ber_pvt_fprintf( FILE *fp, const char *fmt, ... ) { va_list ap; int res; va_start( ap, fmt ); - res = lutil_vfprintf( fp, fmt, ap ); + res = ber_pvt_vfprintf( fp, fmt, ap ); va_end( ap ); return res; } -- 2.39.5