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 libraries 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: recnext.c /main/2 1996/05/09 04:14:47 drk $ */
25 * COMPONENT_NAME: austext
27 * FUNCTIONS: d_recnext
31 * OBJECT CODE ONLY SOURCE MATERIALS
34 /* ********************** EDIT HISTORY *******************************
36 SCR DATE INI DESCRIPTION
37 ----- --------- --- -----------------------------------------------------
38 101 21-Jun-88 RSC Use rn_type and rn_dba instead of curr_rec
39 103 24-Jun-88 RSC Improve generation of single user version
40 04-Aug-88 RTK MULTI_TASK changes
41 18-Aug-88 RSC moved rn_type/dba to separate table
50 /* Find next record of type
59 int rec_ndx; /* Index into record table */
60 RECORD_ENTRY *rec_ptr; /* Pointer to record table */
64 DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
66 /* look for the current record type */
67 if ( RN_REF(rn_type) < 0 ) RETURN( dberr(S_NOTYPE) );
69 /* get the record number and file number from the current record */
71 fno = (FILE_NO)((RN_REF(rn_dba) >> FILESHIFT) & FILEMASK);
72 rno = RN_REF(rn_dba) & ADDRMASK;
74 else { /* No current rec - get fno from rn_type */
75 nrec_check(RN_REF(rn_type) + RECMARK, &rec_ndx, (RECORD_ENTRY * *)&rec_ptr);
76 fno = (FILE_NO)NUM2EXT(rec_ptr->rt_file, ft_offset);
77 fno = (int)((fno >> FILESHIFT) & FILEMASK);
80 ft = NUM2INT( fno, ft_offset );
82 /* start looking at the next record number */
83 if ( (last = dio_pznext(ft)) <= 0 )
88 /* make sure we haven't gone past the end of the file */
89 if ( rno >= last ) RETURN( db_status = S_NOTFOUND );
91 /* create the database address to read */
92 dba = ( (FILEMASK & fno) << FILESHIFT ) | (ADDRMASK & rno);
94 /* set up to allow unlocked read */
97 dio_read( dba, (char * *)&recptr, NOPGHOLD );
98 if ( db_status != S_OKAY )
101 /* get the record type out of the record */
102 bytecpy( &rectype, recptr, sizeof(INT) );
105 } while ( rectype != RN_REF(rn_type) );
107 /* set the current record */
109 RN_REF(rn_type) = rectype;
110 RN_REF(rn_dba) = dba;
112 RETURN( db_status = S_OKAY );
114 /* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin recnext.c */