]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/shell-backends/shellutil.c
Add OpenLDAP RCSid to *.[ch] in clients, libraries, and servers.
[openldap] / servers / slapd / shell-backends / shellutil.c
index 59d43cb7073fe07c7d17ff9a17c421d4bd3780d9..d05ec738959ea8f05eb941cf809f99f9fbb96e28 100644 (file)
@@ -1,3 +1,4 @@
+/* $OpenLDAP$ */
 /*
  shellutil.c - common routines useful when building shell-based backends
                 for the standalone ldap server
@@ -18,7 +19,7 @@
 
 #include <stdio.h>
 
-#include <stdlib.h>
+#include <ac/stdlib.h>
 #include <ac/stdarg.h>
 
 #include <pwd.h>
@@ -198,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;
                        }
                    }
@@ -233,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;
@@ -275,7 +276,7 @@ estrdup( char *s )
 
     if (( p = strdup( s )) == NULL ) {
        debug_printf( "strdup failed\n" );
-       exit( 1 );
+       exit( EXIT_FAILURE );
     }
 
     return( p );
@@ -295,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 );
@@ -309,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 );
@@ -320,26 +321,12 @@ ecalloc( unsigned nelem, unsigned elsize )
 
 /* VARARGS */
 void
-debug_printf
-#ifdef STDC_HEADERS
-       ( char *fmt, ... )
-#else
-       ( va_alist )
-    va_dcl
-#endif
+debug_printf( const char *fmt, ... )
 {
     va_list    ap;
-#ifndef STDC_HEADERS
-    char       *fmt;
-#endif
 
        if ( debugflg ) {
-#ifdef STDC_HEADERS
                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 );