Moved stdio replacements from liblutil lutil_* to liblber ber_pvt_*.

This commit is contained in:
Howard Chu 2002-09-10 00:47:32 +00:00
parent e6fdfd4cee
commit 890d4b9449
6 changed files with 33 additions and 32 deletions

View File

@ -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"

4
configure vendored
View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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 \

View File

@ -10,8 +10,6 @@
#include <ac/stdarg.h>
#include <ac/string.h>
#include <lutil.h>
#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 <ac/signal.h>
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;
}