home *** CD-ROM | disk | FTP | other *** search
-
- /* d4seek_str.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 <string.h>
-
- #include "d4all.h"
- #include "u4error.h"
-
- extern INDEX *v4index ;
-
-
- int d4seek_str( char *str )
- {
- INDEX *index_ptr ;
- int index_ref ;
-
- if ( (index_ref = i4seek_ref()) < 0 )
- {
- u4error( E_NO_INDEX, d4name(), (char *) 0 ) ;
- return( -1 ) ;
- }
-
- index_ptr= v4index+ index_ref ;
-
- #ifdef CLIPPER
- if ( index_ptr->i_type == 'N' )
- {
- char seek_buf[33] ;
-
- strncpy( seek_buf, str, sizeof(seek_buf) ) ;
- seek_buf[32] = '\000' ;
- c4clip( seek_buf, (int) strlen(seek_buf) ) ;
-
- d4seek_key( index_ref, seek_buf ) ;
- }
- else
- return( d4seek_key( index_ref, str)) ;
- #else
- {
- double d ;
-
- switch ( index_ptr->i_type )
- {
- case 'C':
- return( d4seek_key( index_ref, str) ) ;
-
- case 'D':
- c4dt_julian( str, &d ) ;
- return( d4seek_key( index_ref, &d)) ;
-
- default:
- d = c4atod( str, (int) strlen(str) ) ;
- return( d4seek_key( index_ref, &d)) ;
- }
- }
- #endif
- }
-