2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: recfrst.c /main/2 1996/05/09 04:14:13 drk $ */
25 * COMPONENT_NAME: austext
27 * FUNCTIONS: d_recfrst
31 * OBJECT CODE ONLY SOURCE MATERIALS
33 /* ********************** EDIT HISTORY *******************************
35 SCR DATE INI DESCRIPTION
36 ----- --------- --- -----------------------------------------------------
37 101 21-Jun-88 RSC Saved type and computed dba into rn_type and rn_dba
38 103 24-Jun-88 RSC Improve generation of single user version
39 04-Aug-88 RTK MULTI_TASK changes
40 18-Aug-88 RSC moved rn_type/dba to separate table
49 /* Find first record of type
51 d_recfrst( rec TASK_PARM DBN_PARM )
52 int rec; /* record type/table entry */
64 RECORD_ENTRY FAR *rec_ptr;
66 DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
68 if (nrec_check(rec, &rec, (RECORD_ENTRY FAR * FAR *)&rec_ptr) != S_OKAY)
71 rec -= curr_db_table->rt_offset;
74 /* get the normalized number of file containing this record type */
75 ftype = NUM2EXT(rec_ptr->rt_file, ft_offset);
77 if ( (last = dio_pznext(rec_ptr->rt_file)) <= 0 )
82 /* make sure we haven't gone past the end of the file */
83 if ( rno >= last ) RETURN( db_status = S_NOTFOUND );
85 /* create the database address to read */
86 dba = ( (FILEMASK & ftype) << FILESHIFT ) | (ADDRMASK & rno);
88 /* set up to allow unlocked read */
95 dio_read( dba, (char FAR * FAR *)&recptr, NOPGHOLD );
99 if ( db_status != S_OKAY )
102 /* get the record type out of the record */
103 bytecpy( &rectype, recptr, sizeof(INT) );
109 } while ( (int)rectype != rec );
111 /* set the current record and type */
113 RN_REF(rn_type) = rectype;
114 RN_REF(rn_dba) = dba;
116 RETURN( db_status = S_OKAY );
118 /* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin recfrst.c */