Added ldif_countlines()

This commit is contained in:
Howard Chu 2005-01-24 03:40:29 +00:00
parent 8fd686ada0
commit 67583f45eb
2 changed files with 18 additions and 0 deletions

View File

@ -75,6 +75,9 @@ ldif_fetch_url LDAP_P((
LDAP_LDIF_F( char * )
ldif_getline LDAP_P(( char **next ));
LDAP_LDIF_F( int )
ldif_countlines LDAP_P(( LDAP_CONST char *line ));
LDAP_LDIF_F( int )
ldif_read_record LDAP_P((
FILE *fp,

View File

@ -308,6 +308,21 @@ ldif_parse_line2(
* which it updates and must be supplied on subsequent calls.
*/
int
ldif_countlines( LDAP_CONST char *buf )
{
char *nl;
int ret = 0;
if ( !buf ) return ret;
for ( nl = strchr(buf, '\n'); nl; nl = strchr(nl, '\n') ) {
nl++;
if ( *nl != ' ' ) ret++;
}
return ret;
}
char *
ldif_getline( char **next )
{