+/* $OpenLDAP$ */
/*
- * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
/* Portions
#include "portable.h"
#include <stdio.h>
-#include <stdlib.h>
+#include <ac/stdlib.h>
-#include <ac/ctype.h>
#include <ac/string.h>
#include <ac/time.h>
#include "ldap-int.h"
-static int next_line LDAP_P(( char **bufp, long *blenp, char **linep ));
+static int next_line LDAP_P(( char **bufp, ber_len_t *blenp, char **linep ));
static char *next_token LDAP_P(( char ** sp ));
-
int
-next_line_tokens( char **bufp, long *blenp, char ***toksp )
+ldap_int_next_line_tokens( char **bufp, ber_len_t *blenp, char ***toksp )
{
char *p, *line, *token, **toks;
int rc, tokcnt;
if ( tokcnt == 1 && strcasecmp( toks[ 0 ], "END" ) == 0 ) {
tokcnt = 0;
- free_strarray( toks );
+ LDAP_VFREE( toks );
toks = NULL;
}
static int
-next_line( char **bufp, long *blenp, char **linep )
+next_line( char **bufp, ber_len_t *blenp, char **linep )
{
char *linestart, *line, *p;
- long plen;
+ ber_slen_t plen;
linestart = *bufp;
p = *bufp;
return( -1 ); /* fatal error */
}
- (void) memcpy( line, linestart, p - linestart );
+ AC_MEMCPY( line, linestart, p - linestart );
line[ p - linestart - 1 ] = '\0';
*linep = line;
return( strlen( line ));
p = *sp;
- while ( isspace( (unsigned char) *p )) { /* skip leading white space */
+ while ( LDAP_SPACE( (unsigned char) *p )) { /* skip leading white space */
++p;
}
t = tokstart = p;
for ( ;; ) {
- if ( *p == '\0' || ( isspace( (unsigned char) *p ) && !in_quote )) {
+ if ( *p == '\0' || ( LDAP_SPACE( (unsigned char) *p ) && !in_quote )) {
if ( *p != '\0' ) {
++p;
}
return( LDAP_STRDUP( tokstart ));
}
-
-
-void
-free_strarray( char **sap )
-{
- int i;
-
- if ( sap != NULL ) {
- for ( i = 0; sap[ i ] != NULL; ++i ) {
- LBER_FREE( sap[ i ] );
- }
- LBER_FREE( (char *)sap );
- }
-}