1 /* $XConsortium: recfrst.c /main/2 1996/05/09 04:14:13 drk $ */
3 * COMPONENT_NAME: austext
9 * OBJECT CODE ONLY SOURCE MATERIALS
11 /* ********************** EDIT HISTORY *******************************
13 SCR DATE INI DESCRIPTION
14 ----- --------- --- -----------------------------------------------------
15 101 21-Jun-88 RSC Saved type and computed dba into rn_type and rn_dba
16 103 24-Jun-88 RSC Improve generation of single user version
17 04-Aug-88 RTK MULTI_TASK changes
18 18-Aug-88 RSC moved rn_type/dba to separate table
27 /* Find first record of type
29 d_recfrst( rec TASK_PARM DBN_PARM )
30 int rec; /* record type/table entry */
42 RECORD_ENTRY FAR *rec_ptr;
44 DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
46 if (nrec_check(rec, &rec, (RECORD_ENTRY FAR * FAR *)&rec_ptr) != S_OKAY)
49 rec -= curr_db_table->rt_offset;
52 /* get the normalized number of file containing this record type */
53 ftype = NUM2EXT(rec_ptr->rt_file, ft_offset);
55 if ( (last = dio_pznext(rec_ptr->rt_file)) <= 0 )
60 /* make sure we haven't gone past the end of the file */
61 if ( rno >= last ) RETURN( db_status = S_NOTFOUND );
63 /* create the database address to read */
64 dba = ( (FILEMASK & ftype) << FILESHIFT ) | (ADDRMASK & rno);
66 /* set up to allow unlocked read */
73 dio_read( dba, (char FAR * FAR *)&recptr, NOPGHOLD );
77 if ( db_status != S_OKAY )
80 /* get the record type out of the record */
81 bytecpy( &rectype, recptr, sizeof(INT) );
87 } while ( (int)rectype != rec );
89 /* set the current record and type */
91 RN_REF(rn_type) = rectype;
94 RETURN( db_status = S_OKAY );
96 /* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin recfrst.c */