00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #pragma ident "@(#) libf/fio/ftell.c 92.1 06/18/99 19:52:04"
00043
00044 #include <errno.h>
00045 #include <ffio.h>
00046 #include <liberrno.h>
00047 #include "fio.h"
00048 #include "fstats.h"
00049
00050 extern long long __ftell64_f90( _f_int *unump);
00051 extern _f_int8 ftellf90_8_4_( _f_int *unump);
00052 extern _f_int8 ftellf90_8_( _f_int8 *unump);
00053 extern _f_int ftell90_ (_f_int *u);
00054
00055 #ifdef KEY
00056
00057 void
00058 pathf90_ftell4(_f_int *unit, _f_int *offset) {
00059 _f_int junk;
00060 *offset = (_f_int) ftellf90_8_4_(unit);
00061 }
00062
00063 void
00064 pathf90_ftell8(_f_int8 *unit, _f_int8 *offset) {
00065 *offset = ftellf90_8_(unit);
00066 }
00067
00068 void
00069 pathf90_ftell48(_f_int *unit, _f_int8 *offset) {
00070 *offset = ftellf90_8_4_(unit);
00071 }
00072
00073 #endif
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108 long long
00109 __ftell64_f90( _f_int *unump)
00110 {
00111 return ftellf90_8_4_(unump);
00112 }
00113
00114 _f_int8
00115 ftellf90_8_4_( _f_int *unump)
00116 {
00117 _f_int8 pos;
00118 register unum_t unum;
00119 unit *cup;
00120 struct fiostate cfs;
00121
00122 unum = *unump;
00123
00124
00125 STMT_BEGIN(unum, 0, T_GETPOS, NULL, &cfs, cup);
00126
00127
00128
00129
00130 if (cup == NULL)
00131 cup = _imp_open(&cfs, SEQ, UNF, unum, 0, NULL);
00132
00133
00134 if (cup->useq == 0)
00135 _ferr(&cfs, FEBIONDA, "GETPOS");
00136
00137
00138
00139
00140
00141
00142
00143
00144 pos = 0;
00145 switch( cup->ufs ) {
00146
00147 case FS_TEXT:
00148 case STD:
00149 #ifdef KEY
00150 pos = ftello(cup->ufp.std);
00151 #else
00152 pos = ftell(cup->ufp.std);
00153 #endif
00154 break;
00155
00156 case FS_FDC:
00157 _ferr(&cfs, FDC_ERR_NOSUP);
00158 break;
00159
00160 case FS_AUX:
00161 _ferr(&cfs, FEMIXAUX);
00162 break;
00163 default:
00164 _ferr(&cfs, FEINTFST);
00165
00166 }
00167
00168 getpos_done:
00169 STMT_END(cup, T_GETPOS, NULL, &cfs);
00170 return(pos);
00171 }
00172
00173 _f_int8
00174 ftellf90_8_( _f_int8 *unump)
00175 {
00176 _f_int8 pos;
00177 register unum_t unum;
00178 unit *cup;
00179 struct fiostate cfs;
00180
00181 unum = *unump;
00182
00183
00184 STMT_BEGIN(unum, 0, T_GETPOS, NULL, &cfs, cup);
00185
00186
00187
00188
00189 if (cup == NULL)
00190 cup = _imp_open(&cfs, SEQ, UNF, unum, 0, NULL);
00191
00192
00193 if (cup->useq == 0)
00194 _ferr(&cfs, FEBIONDA, "GETPOS");
00195
00196
00197
00198
00199
00200
00201
00202
00203 pos = 0;
00204 switch( cup->ufs ) {
00205
00206 case FS_TEXT:
00207 case STD:
00208 #ifdef KEY
00209 pos = ftello(cup->ufp.std);
00210 #else
00211 pos = ftell(cup->ufp.std);
00212 #endif
00213 break;
00214
00215 case FS_FDC:
00216 _ferr(&cfs, FDC_ERR_NOSUP);
00217 break;
00218
00219 case FS_AUX:
00220 _ferr(&cfs, FEMIXAUX);
00221 break;
00222 default:
00223 _ferr(&cfs, FEINTFST);
00224
00225 }
00226
00227 getpos_done:
00228 STMT_END(cup, T_GETPOS, NULL, &cfs);
00229 return(pos);
00230 }
00231
00232 #ifdef KEY
00233
00234 _f_int
00235 ftell90_(_f_int *u)
00236 {
00237 return( (_f_int) ftellf90_8_4_(u));
00238 }
00239 #endif
00240
00241 #if 0
00242 extern int ftell_(_f_int *u);
00243 int
00244 ftell_(_f_int *u)
00245 {
00246 return( (int) ftellf90_8_4_(u));
00247 }
00248 #endif