home *** CD-ROM | disk | FTP | other *** search
-
- /* i4bottom.c (c)Copyright Sequiter Software Inc., 1987-1990. All rights reserved.
-
- Moves the index file pointer to the bottom position.
-
- Returns
- Success 0
- EOF 3
- Error -1
- */
-
- #include "d4all.h"
-
- extern BLOCK *v4block ;
- extern INDEX *v4index ;
- extern int v4lock_wait ;
-
- i4bottom( int index_ref )
- {
- int rc, cur_block ;
- BLOCK *block_ptr ;
-
- if ( (rc = i4lock( index_ref, v4lock_wait)) < 0 ) return rc ;
-
- if ( v4index[index_ref].block_ref >= 0 )
- {
- while( (cur_block = b4up( index_ref )) >= 0 ) ;
- b4skip( index_ref, 9999L ) ;
- }
-
- cur_block = 0 ;
- while ( cur_block >= 0 )
- {
- cur_block = b4down( index_ref, 1 ) ;
- if (cur_block <= -2) return( -1 ) ; /* Error */
- }
- block_ptr = v4block+ v4index[index_ref].block_ref ;
- if ( block_ptr->num_keys == 0 )
- {
- return( 3) ;
- }
- else
- {
- block_ptr->key_on = block_ptr->num_keys - 1 ;
- return( 0 ) ;
- }
- }
-