home *** CD-ROM | disk | FTP | other *** search
-
- /* d4seek_k.c (c)Copyright Sequiter Software Inc., 1987-1990. All rights reserved.
-
- Locates and reads the record.
-
- Returns
-
- 0 Success
- 1 Inexact Find
- 2 On record after
- 3 EOF
- -1 Error
- */
-
- #include "d4all.h"
- #include "u4error.h"
-
- extern BASE *v4base ;
- extern INDEX *v4index ;
- extern int v4cur_base ;
-
- d4seek_key( int index_ref, void *key_ptr )
- {
- int rc, r_rc ;
- BASE *base_ptr ;
-
- base_ptr = d4ptr() ;
- if ( d4changed( base_ptr ) < 0 ) return -1 ;
-
- base_ptr->bof = base_ptr->eof = 0 ;
-
- if ( (rc = i4seek( index_ref, key_ptr)) < 0) return rc ;
-
- if ( rc == 3)
- {
- d4blank() ;
- base_ptr->rec_num = d4reccount()+1L ;
- if ( base_ptr->rec_num == 1L ) base_ptr->bof = 1 ;
- base_ptr->eof = 1 ;
- return( 3 ) ;
- }
-
- r_rc = d4read( i4key(index_ref)->rec_num) ;
- if ( r_rc < 0 ) return r_rc ;
-
- return rc ;
- }
-