Open64 (mfef90, whirl2f, and IR tools)
TAG: version-openad; SVN changeset: 916
|
00001 /* 00002 00003 Copyright (C) 2000, 2001, Silicon Graphics, Inc. All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify it 00006 under the terms of version 2.1 of the GNU Lesser General Public License 00007 as published by the Free Software Foundation. 00008 00009 This program is distributed in the hope that it would be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 Further, this software is distributed without any warranty that it is 00014 free of the rightful claim of any third person regarding infringement 00015 or the like. Any license provided herein, whether implied or 00016 otherwise, applies only to this software file. Patent licenses, if 00017 any, provided herein do not apply to combinations of this program with 00018 other software, or any other product whatsoever. 00019 00020 You should have received a copy of the GNU Lesser General Public 00021 License along with this program; if not, write the Free Software 00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, 00023 USA. 00024 00025 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00026 Mountain View, CA 94043, or: 00027 00028 http://www.sgi.com 00029 00030 For further information regarding this notice, see: 00031 00032 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00033 00034 */ 00035 00036 00037 00038 #pragma ident "@(#) libf/fio/skipf.c 92.1 06/21/99 10:37:55" 00039 00040 #include <errno.h> 00041 #include <ffio.h> 00042 #include <liberrno.h> 00043 #include "fio.h" 00044 00045 /* 00046 * Skip files 00047 * dn - unit 00048 * nb - number of files to skip. Negative for skip backwards. 00049 * istat - optional 2 word array. 00050 * First word = number of records skipped (not always set) 00051 * Second word = number of files skipped. Only count when 00052 * we cross a file boundary. 00053 * retstat - optional return status 00054 */ 00055 #define ERET(x) { \ 00056 if (narg > 3) { \ 00057 *retstat = x; \ 00058 goto ret; \ 00059 } else \ 00060 _ferr(&cfs, x); \ 00061 } 00062 00063 void 00064 SKIPF( 00065 _f_int *unump, 00066 _f_int8 *nb, 00067 _f_int *istat, 00068 _f_int *retstat) 00069 { 00070 register int narg; 00071 register unum_t unum; 00072 unit *cup; 00073 struct fiostate cfs; 00074 struct ffp_skipf_s skip_arg; 00075 00076 #ifdef _UNICOS 00077 narg = _numargs(); 00078 #else 00079 narg = 4; 00080 #endif 00081 if (narg > 2) { 00082 *(istat) = 0; 00083 *(istat + 1) = 0; 00084 } 00085 00086 unum = *unump; 00087 00088 STMT_BEGIN(unum, 0, T_MISC, NULL, &cfs, cup); 00089 /* 00090 * If not connected, do an implicit open. Abort if the open fails. 00091 */ 00092 if (cup == NULL) { 00093 int ostat; 00094 00095 cup = _imp_open(&cfs, SEQ, UNF, unum, 1, &ostat); 00096 00097 if (cup == NULL) { 00098 ERET(ostat); 00099 } 00100 } 00101 00102 switch (cup->ufs) { 00103 case FS_FDC: 00104 skip_arg.ffp_nfil = *nb; 00105 skip_arg.ffp_nrec = 0; 00106 if(XRCALL(cup->ufp.fdc, posrtn) cup->ufp.fdc, 00107 FP_SKIPF, &skip_arg, 2, &cup->uffsw) < 0) 00108 ERET(errno); 00109 if (narg > 2) { 00110 *(istat+1) = skip_arg.ffp_nfil; 00111 *(istat) = skip_arg.ffp_nrec; 00112 } 00113 break; 00114 default: 00115 ERET(FENOSKPF); 00116 } 00117 00118 ret: 00119 cup->uwrt = 0; 00120 cup->uend = BEFORE_ENDFILE; 00121 00122 STMT_END(cup, T_MISC, NULL, &cfs); 00123 00124 return; 00125 }