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