int			i, foundListControl, errcode;
int			i, foundListControl; long		errcode;
ldap_parse_virtuallist_control(     LDAP *ld,     LDAPControl **ctrls,    unsigned long *target_posp,     unsigned long *list_sizep,     int *errcodep){    BerElement		*ber;    int			i, foundListControl, errcode;    LDAPControl		*listCtrlp;    unsigned long	target_pos, list_size;    if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) {        return( LDAP_PARAM_ERROR );    }    /* only ldapv3 or higher can do virtual lists. */    if ( NSLDAPI_LDAP_VERSION( ld ) < LDAP_VERSION3 ) {        LDAP_SET_LDERRNO( ld, LDAP_NOT_SUPPORTED, NULL, NULL );        return( LDAP_NOT_SUPPORTED );    }    /* find the listControl in the list of controls if it exists */    if ( ctrls == NULL ) {        LDAP_SET_LDERRNO( ld, LDAP_CONTROL_NOT_FOUND, NULL, NULL );        return ( LDAP_CONTROL_NOT_FOUND );    }         foundListControl = 0;    for ( i = 0; (( ctrls[i] != NULL ) && ( !foundListControl )); i++ ) {        foundListControl = !strcmp( ctrls[i]->ldctl_oid,                                     LDAP_CONTROL_VLVRESPONSE );    }    if ( !foundListControl ) {        LDAP_SET_LDERRNO( ld, LDAP_CONTROL_NOT_FOUND, NULL, NULL );        return ( LDAP_CONTROL_NOT_FOUND );    } else {        /* let local var point to the listControl */        listCtrlp = ctrls[i-1];                     }    /*  allocate a Ber element with the contents of the list_control's struct berval */    if ( ( ber = ber_init( &listCtrlp->ldctl_value ) ) == NULL ) {        LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL );        return( LDAP_NO_MEMORY );    }               /* decode the result from the Berelement */    if (  LBER_ERROR == ber_scanf( ber, "{iie}", &target_pos, &list_size,	    &errcode ) ) {        LDAP_SET_LDERRNO( ld, LDAP_DECODING_ERROR, NULL, NULL );        ber_free( ber, 1 );        return( LDAP_DECODING_ERROR );    }    if ( target_posp != NULL ) {	*target_posp = target_pos;    }    if ( list_sizep != NULL ) {	*list_sizep = list_size;    }    if ( errcodep != NULL ) {	*errcodep = errcode;    }    /* the ber encoding is no longer needed */    ber_free(ber,1);    return(LDAP_SUCCESS);}