Ejemplo n.º 1
0
RcStatus OpenTable( char *fname, char *path )
{
    WResFileID  handle;
    RcStatus    ret;

    ret = RS_OK;
    _searchenv( fname, "PATH", path );
    if( path[0] == '\0' )
        return( RS_FILE_NOT_FOUND );
    handle = RCOPEN( path, O_RDONLY | O_BINARY, PMODE_RW );
    if( handle == NIL_HANDLE ) {
        ret = RS_OPEN_ERROR;
    }
    if( ret == RS_OK )
        ret = readDBHeader( handle );
    if( ret == RS_OK )
        ret = readDBRanges( handle );
    if( ret == RS_OK )
        ret = readDBIndex( handle );
    if( ret == RS_OK )
        ret = readDBTable( handle );
    if( ret != RS_OPEN_ERROR )
        RCCLOSE( handle );
    if( ret == RS_OK ) {
        ConvToUnicode = DBStringToUnicode;
    }
    return( ret );
}
Ejemplo n.º 2
0
RcStatus OpenTable( char *fname, char *path ) {
    int         fp;
    RcStatus    status;

    status = RS_OK;
    _searchenv( fname, "PATH", path );
    if( path[0] == '\0' ) return( RS_FILE_NOT_FOUND );
    fp = RcOpen( path, O_RDONLY | O_BINARY );
    if( fp == -1 ) {
        status = RS_OPEN_ERROR;
    }
    if( status == RS_OK ) status = readDBHeader( fp );
    if( status == RS_OK ) status = readDBRanges( fp );
    if( status == RS_OK ) status = readDBIndex( fp );
    if( status == RS_OK ) status = readDBTable( fp );
    if( status != RS_OPEN_ERROR ) RcClose( fp );
    if( status == RS_OK ) {
        ConvToUnicode = DBStringToUnicode;
    }
    return( status );
}