home *** CD-ROM | disk | FTP | other *** search
-
- /* d4reccount.c (c)Copyright Sequiter Software Inc., 1987-1990. All rights reserved.
-
- Returns
- >= 0 The number of records in the database.
- -1 Error
- */
-
- #include "p4misc.h"
- #include "d4base.h"
- #include "u4error.h"
-
- #ifndef UNIX
- #include <io.h>
- #endif
-
- extern BASE *v4base ;
- extern int v4cur_base ;
-
-
- long d4reccount()
- {
- BASE *base_ptr ;
- long len, count ;
-
- if ( v4cur_base < 0 ) return -1L ;
-
- base_ptr = v4base+ v4cur_base ;
- if ( base_ptr->num_recs >= 0L ) return( base_ptr->num_recs ) ;
-
- if ( (len = filelength(base_ptr->file_hand)) < 0L)
- {
- u4error( E_INTERNAL, (char *) 0 ) ;
- return -1L ;
- }
-
- count = (len-base_ptr->header_len)/ base_ptr->buffer_len ;
- if ( base_ptr->file_lock >= 0 )
- base_ptr->num_recs = count ;
-
- return count ;
- }
-