Lines Matching refs:fp

79 sm_io_seek(fp, timeout, offset, whence)  in sm_io_seek()  argument
80 register SM_FILE_T *fp; in sm_io_seek()
93 SM_REQUIRE_ISA(fp, SmFileMagic);
100 if ((seekfn = fp->f_seek) == NULL)
107 timeout = fp->f_timeout;
147 sm_flush(fp, (int *) &timeout);
149 if (fp->f_flags & SMOFF)
150 curoff = fp->f_lseekoff;
153 curoff = (*seekfn)(fp, (off_t) 0, SM_IO_SEEK_CUR);
160 if (fp->f_flags & SMRD)
162 curoff -= fp->f_r;
163 if (HASUB(fp))
164 curoff -= fp->f_ur;
166 else if (fp->f_flags & SMWR && fp->f_p != NULL)
167 curoff += fp->f_p - fp->f_bf.smb_base;
195 if (fp->f_bf.smb_base == NULL)
196 sm_makebuf(fp);
197 if (fp->f_flags & (SMWR | SMRW | SMNBF | SMNPT))
199 if ((fp->f_flags & SMOPT) == 0)
202 fp->f_file < 0 || fstat(fp->f_file, &st) ||
205 fp->f_flags |= SMNPT;
208 fp->f_blksize = st.st_blksize;
209 fp->f_flags |= SMOPT;
221 if (fstat(fp->f_file, &st))
228 if (fp->f_flags & SMOFF)
229 curoff = fp->f_lseekoff;
232 curoff = (*seekfn)(fp, (off_t) 0, SM_IO_SEEK_CUR);
236 curoff -= fp->f_r;
237 if (HASUB(fp))
238 curoff -= fp->f_ur;
248 if (HASUB(fp))
250 curoff += fp->f_r; /* kill off ungetc */
251 n = fp->f_up - fp->f_bf.smb_base;
253 n += fp->f_ur;
257 n = fp->f_p - fp->f_bf.smb_base;
259 n += fp->f_r;
273 fp->f_p = fp->f_bf.smb_base + o;
274 fp->f_r = n - o;
275 if (HASUB(fp))
276 FREEUB(fp);
277 fp->f_flags &= ~SMFEOF;
291 curoff = target & ~(fp->f_blksize - 1);
292 if ((*seekfn)(fp, curoff, SM_IO_SEEK_SET) == POS_ERR)
294 fp->f_r = 0;
295 fp->f_p = fp->f_bf.smb_base;
296 if (HASUB(fp))
297 FREEUB(fp);
298 fp->f_flags &= ~SMFEOF;
303 if (sm_refill(fp, SM_TIME_FOREVER) || fp->f_r < (int) n)
305 fp->f_p += n;
306 fp->f_r -= n;
323 if (sm_flush(fp, &ret) != 0 ||
324 (*seekfn)(fp, (off_t) offset, whence) == POS_ERR)
331 if (HASUB(fp))
332 FREEUB(fp);
333 fp->f_p = fp->f_bf.smb_base;
334 fp->f_r = 0;
335 fp->f_flags &= ~SMFEOF;