X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fshell-backends%2Fshellutil.c;h=d05ec738959ea8f05eb941cf809f99f9fbb96e28;hb=403f4479bc9f9a864122d4aeecf7284408918302;hp=82eea1665b8d879664c61c833e4e9f89d088b5f1;hpb=42e0d83cb3a1a1c5b25183f1ab74ce7edbe25de7;p=openldap diff --git a/servers/slapd/shell-backends/shellutil.c b/servers/slapd/shell-backends/shellutil.c index 82eea1665b..d05ec73895 100644 --- a/servers/slapd/shell-backends/shellutil.c +++ b/servers/slapd/shell-backends/shellutil.c @@ -1,3 +1,4 @@ +/* $OpenLDAP$ */ /* shellutil.c - common routines useful when building shell-based backends for the standalone ldap server @@ -14,12 +15,18 @@ */ -#include +#include "portable.h" + #include -#include -#include + +#include +#include + #include -#include + +#include +#include + #include #include #include "shellutil.h" @@ -192,7 +199,7 @@ parse_input( FILE *ifp, FILE *ofp, struct ldop *op ) while ( args != NULL ) { if (( p = strchr( args, ' ' )) != NULL ) { *p++ = '\0'; - while ( isspace( *p )) { + while ( isspace( (unsigned char) *p )) { ++p; } } @@ -227,7 +234,7 @@ find_input_tag( char **linep ) /* linep is set to start of args */ for ( i = 0; ips[ i ].ip_type != 0; ++i ) { if ( strncasecmp( *linep, ips[ i ].ip_tag, p - *linep ) == 0 ) { - while ( isspace( *(++p) )) { + while ( isspace( (unsigned char) *(++p) )) { ; } *linep = p; @@ -269,7 +276,7 @@ estrdup( char *s ) if (( p = strdup( s )) == NULL ) { debug_printf( "strdup failed\n" ); - exit( 1 ); + exit( EXIT_FAILURE ); } return( p ); @@ -289,7 +296,7 @@ erealloc( void *s, unsigned size ) if ( p == NULL ) { debug_printf( "realloc( p, %d ) failed\n", size ); - exit( 1 ); + exit( EXIT_FAILURE ); } return( p ); @@ -303,7 +310,7 @@ ecalloc( unsigned nelem, unsigned elsize ) if (( p = calloc( nelem, elsize )) == NULL ) { debug_printf( "calloc( %d, %d ) failed\n", nelem, elsize ); - exit( 1 ); + exit( EXIT_FAILURE ); } return( p ); @@ -314,19 +321,16 @@ ecalloc( unsigned nelem, unsigned elsize ) /* VARARGS */ void -debug_printf( va_alist /* char *fmt, args... */ ) - va_dcl +debug_printf( const char *fmt, ... ) { - char *fmt; va_list ap; - if ( debugflg ) { - va_start( ap ); - fmt = va_arg( ap, char * ); - fprintf( stderr, "%s: ", progname ); - vfprintf( stderr, fmt, ap ); - va_end( ap ); - } + if ( debugflg ) { + va_start( ap, fmt ); + fprintf( stderr, "%s: ", progname ); + vfprintf( stderr, fmt, ap ); + va_end( ap ); + } }