home *** CD-ROM | disk | FTP | other *** search
-
- /* d4bottom.c (c)Copyright Sequiter Software Inc., 1987-1990. All rights reserved.
-
- Reads the top bottom record of the database.
- Sets the current record to the bottom record.
-
- Returns
- 0 Success
- 3 EOF
- -1 Error
-
- */
-
- #include "d4all.h"
- #include "u4error.h"
-
- extern BASE *v4base ;
- extern INDEX *v4index ;
- extern int v4cur_base ;
-
-
- d4bottom()
- {
- BASE *base_ptr ;
- int rc ;
-
- if ( v4cur_base < 0 )
- {
- u4error( E_D_MISSING, (char *) 0 ) ;
- return( -1 ) ;
- }
-
- base_ptr = v4base + v4cur_base ;
- base_ptr->eof = base_ptr->bof = 0 ;
-
- if ( base_ptr->current_index >= 0)
- {
- rc = i4bottom( base_ptr->current_index ) ;
- if ( rc < 0 ) return rc ;
- if ( rc == 0 )
- {
- rc = d4go( i4key(base_ptr->current_index)->rec_num ) ;
- if ( rc == 1 )
- {
- u4error( E_I_RECORD, v4index[base_ptr->current_index].name, (char *) 0) ;
- return -1 ;
- }
- return( rc ) ;
- }
- }
- else
- if ( d4reccount() > 0)
- return( d4go( d4reccount()) ) ;
-
- d4blank() ;
- base_ptr->rec_num = d4reccount()+1L ;
- base_ptr->bof = base_ptr->eof = 1 ;
-
- return( 3) ;
- }
-
-