]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/shell-backends/shellutil.c
error message from be_entry_put tool backend function
[openldap] / servers / slapd / shell-backends / shellutil.c
index 5c9e2a267c9eee4238695adbe532f1ea69ad6d59..7a1cb7be852dae957752cee88bdf33d1d1411d43 100644 (file)
@@ -1,3 +1,4 @@
+/* $OpenLDAP$ */
 /*
  shellutil.c - common routines useful when building shell-based backends
                 for the standalone ldap server
@@ -88,7 +89,8 @@ write_entry( struct ldop *op, struct ldentry *entry, FILE *ofp )
 int
 test_filter( struct ldop *op, struct ldentry *entry )
 {
-    return (( random() & 0x07 ) == 0x07 );     /* XXX random for now */
+    return ((random() & 0x07 ) == 0x07) /* XXX random for now */
+               ? LDAP_COMPARE_TRUE : LDAP_COMPARE_FALSE;
 }
 
 
@@ -275,7 +277,7 @@ estrdup( char *s )
 
     if (( p = strdup( s )) == NULL ) {
        debug_printf( "strdup failed\n" );
-       exit( 1 );
+       exit( EXIT_FAILURE );
     }
 
     return( p );
@@ -295,7 +297,7 @@ erealloc( void *s, unsigned size )
 
     if ( p == NULL ) {
        debug_printf( "realloc( p, %d ) failed\n", size );
-       exit( 1 );
+       exit( EXIT_FAILURE );
     }
 
     return( p );
@@ -309,7 +311,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 );
@@ -320,26 +322,12 @@ ecalloc( unsigned nelem, unsigned elsize )
 
 /* VARARGS */
 void
-debug_printf
-#if HAVE_STDARG
-       ( char *fmt, ... )
-#else
-       ( va_alist )
-    va_dcl
-#endif
+debug_printf( const char *fmt, ... )
 {
     va_list    ap;
-#if !HAVE_STDARG
-    char       *fmt;
-#endif
 
        if ( debugflg ) {
-#if HAVE_STDARG
                va_start( ap, fmt );
-#else
-               va_start( ap );
-               fmt = va_arg( ap, char * );
-#endif
                fprintf( stderr, "%s: ", progname );
                vfprintf( stderr, fmt, ap );
                va_end( ap );