Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nadezhda Ivanova
OpenLDAP
Commits
4d8a2e28
Commit
4d8a2e28
authored
Sep 06, 2002
by
Howard Chu
Browse files
Remove dependencies on HAVE_VSNPRINTF, use replacement in liblutil/stdio.c
if needed. Same check for snprintf.
parent
b623e449
Changes
6
Hide whitespace changes
Inline
Side-by-side
configure.in
View file @
4d8a2e28
...
...
@@ -2420,7 +2420,7 @@ AC_FUNC_VPRINTF
if test $ac_cv_func_vprintf = yes ; then
dnl check for vsnprintf
AC_CHECK_FUNCS(
v
snprintf vsprintf)
AC_CHECK_FUNCS(snprintf vs
n
printf)
fi
AC_CHECK_FUNCS( \
...
...
@@ -2485,6 +2485,16 @@ AC_REPLACE_FUNCS(getopt)
if test "$ac_cv_func_getopt" != yes; then
LIBSRCS="$LIBSRCS getopt.c"
fi
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])
fi
if test "$ac_cv_func_vsnprintf" != yes; then
AC_DEFINE(vsnprintf, lutil_vsnprintf, [define to snprintf routine])
fi
fi
dnl ----------------------------------------------------------------
# Check Configuration
...
...
libraries/liblber/bprint.c
View file @
4d8a2e28
...
...
@@ -87,15 +87,8 @@ int ber_pvt_log_output(
{
int
level
;
ber_get_option
(
NULL
,
LBER_OPT_BER_DEBUG
,
&
level
);
#ifdef HAVE_VSNPRINTF
buf
[
sizeof
(
buf
)
-
1
]
=
'\0'
;
vsnprintf
(
buf
,
sizeof
(
buf
)
-
1
,
fmt
,
vl
);
#elif HAVE_VSPRINTF
vsprintf
(
buf
,
fmt
,
vl
);
/* hope it's not too long */
#else
/* use doprnt() */
#error "vsprintf() required.";
#endif
if
(
ber_log_check
(
LDAP_DEBUG_BER
,
level
)
)
(
*
ber_pvt_log_print
)(
buf
);
}
...
...
@@ -117,15 +110,8 @@ int ber_pvt_log_printf( int errlvl, int loglvl, const char *fmt, ... )
va_start
(
ap
,
fmt
);
#ifdef HAVE_VSNPRINTF
buf
[
sizeof
(
buf
)
-
1
]
=
'\0'
;
vsnprintf
(
buf
,
sizeof
(
buf
)
-
1
,
fmt
,
ap
);
#elif HAVE_VSPRINTF
vsprintf
(
buf
,
fmt
,
ap
);
/* hope it's not too long */
#else
/* use doprnt() */
#error "vsprintf() required."
#endif
va_end
(
ap
);
...
...
libraries/liblber/debug.c
View file @
4d8a2e28
...
...
@@ -311,11 +311,7 @@ void (lutil_debug)( int debug, int level, const char *fmt, ... )
#endif
va_start
(
vl
,
fmt
);
#ifdef HAVE_VSNPRINTF
vsnprintf
(
buffer
,
sizeof
(
buffer
),
fmt
,
vl
);
#else
vsprintf
(
buffer
,
fmt
,
vl
);
#endif
buffer
[
sizeof
(
buffer
)
-
1
]
=
'\0'
;
if
(
log_file
!=
NULL
)
{
...
...
libraries/libldap/print.c
View file @
4d8a2e28
...
...
@@ -43,15 +43,8 @@ int ldap_log_printf( LDAP *ld, int loglvl, const char *fmt, ... )
va_start
(
ap
,
fmt
);
#ifdef HAVE_VSNPRINTF
buf
[
sizeof
(
buf
)
-
1
]
=
'\0'
;
vsnprintf
(
buf
,
sizeof
(
buf
)
-
1
,
fmt
,
ap
);
#elif HAVE_VSPRINTF
vsprintf
(
buf
,
fmt
,
ap
);
/* hope it's not too long */
#else
/* use doprnt() */
chokeme
=
"choke me! I don't have a doprnt manual handy!"
;
#endif
va_end
(
ap
);
...
...
libraries/liblutil/setproctitle.c
View file @
4d8a2e28
...
...
@@ -42,15 +42,8 @@ void setproctitle( const char *fmt, ... )
va_start
(
ap
,
fmt
);
#ifdef HAVE_VSNPRINTF
buf
[
sizeof
(
buf
)
-
1
]
=
'\0'
;
vsnprintf
(
buf
,
sizeof
(
buf
)
-
1
,
fmt
,
ap
);
#elif HAVE_VPRINTF
vsprintf
(
buf
,
fmt
,
ap
);
/* hope it's not too long */
#else
/* use doprnt() */
chokeme
=
"choke me! I don't have a doprnt() manual handy"
;
#endif
va_end
(
ap
);
...
...
libraries/liblutil/stdio.c
View file @
4d8a2e28
...
...
@@ -12,7 +12,7 @@
#include <lutil.h>
#if
n
def
HAVE_VSNPRINTF
#if
!
def
ined(
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
* overflowed.
...
...
@@ -30,13 +30,12 @@
* broken pipe, and the write will be terminated.
* -- hyc, 2002-07-19
*/
#ifndef HAVE_EBCDIC
/* This emulation uses vfprintf; on OS/390 we're also emulating
* that function so it's more efficient just to have a separate
* version of vsnprintf there.
*/
#include <ac/signal.h>
int
vsnprintf
(
char
*
str
,
size_t
n
,
const
char
*
fmt
,
va_list
ap
)
int
lutil_
vsnprintf
(
char
*
str
,
size_t
n
,
const
char
*
fmt
,
va_list
ap
)
{
int
fds
[
2
],
res
;
FILE
*
f
;
...
...
@@ -62,7 +61,8 @@ int vsnprintf( char *str, size_t n, const char *fmt, va_list ap )
}
#endif
int
snprintf
(
char
*
str
,
size_t
n
,
const
char
*
fmt
,
...
)
#ifndef HAVE_SNPRINTF
int
lutil_snprintf
(
char
*
str
,
size_t
n
,
const
char
*
fmt
,
...
)
{
va_list
ap
;
int
res
;
...
...
@@ -116,7 +116,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
vsnprintf
(
char
*
str
,
size_t
n
,
const
char
*
fmt
,
va_list
ap
)
int
lutil_
vsnprintf
(
char
*
str
,
size_t
n
,
const
char
*
fmt
,
va_list
ap
)
{
char
*
ptr
,
*
pct
,
*
s2
,
*
f2
,
*
end
;
char
fm2
[
64
];
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment