Example #1
0
intstar4        __fortran SETSYSHANDLE( intstar4 *unit, intstar2 *handle ) {
//========================================================================

    ftnfile     *fcb;
    struct stat stat_buff;

    fcb = Files;
    for(;;) {
        if( fcb == NULL ) return( -1 );
        if( *unit == fcb->unitid ) {
            if( fstat( *handle, &stat_buff ) == -1 ) {
                 return( -1 );
            }
            if( fcb->fileptr != NULL ) {
                Closef( fcb->fileptr );
                if( Errorf( NULL ) != IO_OK ) {
                    return( -1 );
                }
            }
            fcb->fileptr = _AllocFile( *handle, _FileAttrs( fcb ), 0 );
            if( fcb->fileptr == NULL ) {
                return( -1 );
            } else {
                _AllocBuffer( fcb );
                return( 0 );
            }
        }
        fcb = fcb->link;
    }
}
Example #2
0
void    OpenAction( ftnfile *fcb ) {
//==================================

// Open a file.

    SetIOBufferSize( fcb->blocksize );
    fcb->fileptr = Openf( fcb->filename, _FileAttrs( fcb ) );
    if( fcb->fileptr != NULL ) {
        if( ((a_file *)(fcb->fileptr))->attrs & CHAR_DEVICE ) {
            // In dos box under NT we do not get correct information
            // about a device until we actually open it (a bug in the NT
            // dos box
            fcb->device = INFO_DEV;
        }
    }
}