Skip to content
Snippets Groups Projects
Commit b8a3a153 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Axe <varargs.h> support. Assume STDC C translator is available

to build OpenLDAP.
parent fb3a6ee7
No related branches found
No related tags found
No related merge requests found
......@@ -65,6 +65,11 @@
@BOTTOM@
/* begin of postamble */
#ifndef __NEEDS_PROTOTYPES
/* force LDAP_P to always include prototypes */
#define __NEEDS_PROTOTYPES 1
#endif
#ifdef HAVE_STDDEF_H
# include <stddef.h>
#endif
......
This diff is collapsed.
......@@ -599,7 +599,6 @@ AC_CHECK_HEADERS( \
resolv.h \
sgtty.h \
shadow.h \
stdarg.h \
stddef.h \
string.h \
strings.h \
......
......@@ -12,17 +12,12 @@
#ifndef _AC_STDARG_H
#define _AC_STDARG_H 1
#if defined( HAVE_STDARG ) || \
( defined( HAVE_STDARG_H ) && defined( __STDC__ ) )
/* require STDC variable argument support */
# include <stdarg.h>
#include <stdarg.h>
# ifndef HAVE_STDARG
# define HAVE_STDARG 1
# endif
#else
# include <varargs.h>
#ifndef HAVE_STDARG
# define HAVE_STDARG 1
#endif
#endif /* _AC_STDARG_H */
......@@ -465,9 +465,6 @@
/* Define if you have the <ssl.h> header file. */
#undef HAVE_SSL_H
/* Define if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H
/* Define if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
......@@ -848,6 +845,11 @@
/* begin of postamble */
#ifndef __NEEDS_PROTOTYPES
/* force LDAP_P to always include prototypes */
#define __NEEDS_PROTOTYPES 1
#endif
#ifdef HAVE_STDDEF_H
# include <stddef.h>
#endif
......
......@@ -40,10 +40,6 @@
#define LDAP_DEBUG 1
#endif
/* MSVC5 doesn't define _STDC_ but supports _STDC_ features */
#define __NEED_PROTOTYPES 1
#define HAVE_STDARG 1
/* we installed Henry Spencer's REGEX */
#define HAVE_REGEX_H 1
......@@ -738,6 +734,11 @@ typedef char * caddr_t;
/* begin of postamble */
#ifndef __NEEDS_PROTOTYPES
/* force LDAP_P to always include prototypes */
#define __NEEDS_PROTOTYPES 1
#endif
#ifdef HAVE_STDDEF_H
# include <stddef.h>
#endif
......
......@@ -39,36 +39,19 @@ static int ber_log_check( int errlvl, int loglvl )
return errlvl & loglvl ? 1 : 0;
}
int ber_pvt_log_printf
#ifdef HAVE_STDARG
(int errlvl, int loglvl, const char *fmt, ...)
#else
( va_alist )
va_dcl
#endif
int ber_pvt_log_printf( int errlvl, int loglvl, const char *fmt, ... )
{
char buf[ 1024 ];
va_list ap;
#ifdef HAVE_STDARG
va_start( ap, fmt );
#else
int errlvl, loglvl;
char *fmt;
va_start( ap );
errlvl = va_arg( ap, int );
loglvl = va_arg( ap, int );
fmt = va_arg( ap, char * );
#endif
assert( fmt != NULL );
if ( !ber_log_check( errlvl, loglvl )) {
return 0;
}
va_start( ap, fmt );
#ifdef HAVE_VSNPRINTF
buf[sizeof(buf) - 1] = '\0';
vsnprintf( buf, sizeof(buf)-1, fmt, ap );
......
......@@ -486,21 +486,11 @@ ber_next_element(
/* VARARGS */
ber_tag_t
ber_scanf
#if HAVE_STDARG
( BerElement *ber,
ber_scanf ( BerElement *ber,
LDAP_CONST char *fmt,
... )
#else
( va_alist )
va_dcl
#endif
{
va_list ap;
#ifndef HAVE_STDARG
BerElement *ber;
char *fmt;
#endif
LDAP_CONST char *fmt_reset;
char *last;
char *s, **ss, ***sss;
......@@ -512,13 +502,7 @@ va_dcl
ber_tag_t rc, tag;
ber_len_t len;
#ifdef HAVE_STDARG
va_start( ap, fmt );
#else
va_start( ap );
ber = va_arg( ap, BerElement * );
fmt = va_arg( ap, char * );
#endif
assert( ber != NULL );
assert( fmt != NULL );
......@@ -672,13 +656,7 @@ va_dcl
* Error. Reclaim malloced memory that was given to the caller.
* Set allocated pointers to NULL, "data length" outvalues to 0.
*/
#ifdef HAVE_STDARG
va_start( ap, fmt );
#else
va_start( ap );
(void) va_arg( ap, BerElement * );
(void) va_arg( ap, char * );
#endif
for ( ; fmt_reset < fmt; fmt_reset++ ) {
switch ( *fmt_reset ) {
......
......@@ -619,40 +619,22 @@ ber_put_set( BerElement *ber )
/* VARARGS */
int
ber_printf
#ifdef HAVE_STDARG
( BerElement *ber,
LDAP_CONST char *fmt,
... )
#else
( va_alist )
va_dcl
#endif
ber_printf( BerElement *ber, LDAP_CONST char *fmt, ... )
{
va_list ap;
#ifndef HAVE_STDARG
BerElement *ber;
char *fmt;
#endif
char *s, **ss;
struct berval *bv, **bvp;
int rc;
ber_int_t i;
ber_len_t len;
#ifdef HAVE_STDARG
va_start( ap, fmt );
#else
va_start( ap );
ber = va_arg( ap, BerElement * );
fmt = va_arg( ap, char * );
#endif
assert( ber != NULL );
assert( fmt != NULL );
assert( BER_VALID( ber ) );
va_start( ap, fmt );
for ( rc = 0; *fmt && rc != -1; fmt++ ) {
switch ( *fmt ) {
case '!': { /* hook */
......
......@@ -31,35 +31,17 @@ static int ldap_log_check( LDAP *ld, int loglvl )
return errlvl & loglvl ? 1 : 0;
}
int ldap_log_printf
#ifdef HAVE_STDARG
( LDAP *ld, int loglvl, const char *fmt, ... )
#else
( va_alist )
va_dcl
#endif
int ldap_log_printf( LDAP *ld, int loglvl, const char *fmt, ... )
{
char buf[ 1024 ];
va_list ap;
#ifdef HAVE_STDARG
va_start( ap, fmt );
#else
LDAP *ld;
int loglvl;
char *fmt;
va_start( ap );
ld = va_arg( ap, LDAP * );
loglvl = va_arg( ap, int );
fmt = va_arg( ap, char * );
#endif
if ( !ldap_log_check( ld, loglvl )) {
return 0;
}
va_start( ap, fmt );
#ifdef HAVE_VSNPRINTF
buf[sizeof(buf) - 1] = '\0';
vsnprintf( buf, sizeof(buf)-1, fmt, ap );
......
......@@ -31,13 +31,7 @@ int Argc; /* original argc */
*/
/* VARARGS */
void setproctitle
#if defined( HAVE_STDARG )
( const char *fmt, ... )
#else
( va_alist )
va_dcl
#endif
void setproctitle( const char *fmt, ... )
{
static char *endargv = (char *)0;
char *s;
......@@ -45,14 +39,7 @@ va_dcl
char buf[ 1024 ];
va_list ap;
#if defined( HAVE_STDARG )
va_start(ap, fmt);
#else
const char *fmt;
va_start(ap);
fmt = va_arg(ap, const char *);
#endif
#ifdef HAVE_VSNPRINTF
buf[sizeof(buf) - 1] = '\0';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment