home *** CD-ROM | disk | FTP | other *** search
-
- /* i4top.c (c)Copyright Sequiter Software Inc., 1987, 1988, 1989. All rights reserved.
-
- Moves the index file pointer to the top position.
-
- Error -1
- Success 0
- EOF 3
- */
-
- #include "d4base.h"
-
- extern BLOCK *v4block ;
- extern INDEX *v4index ;
-
-
- i4top( index_ref )
- int index_ref ;
- {
- int cur_block ;
-
- if ( i4lock( index_ref, 1 ) < 0 ) return -1 ;
-
- 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 */
- }
-
- /* cur_block is the current block reference number */
- if ( v4block[ v4index[index_ref].block_ref ].num_keys == 0 )
- return( 3) ;
-
- return( 0 ) ;
- }