Lines Matching refs:fp
30 ** SM_IO_FLUSH -- flush the buffer for a 'fp' to the "file"
33 ** all open files when fp==NULL any longer.
36 ** fp -- the file pointer buffer to flush
45 sm_io_flush(fp, timeout)
46 register SM_FILE_T *fp;
52 SM_REQUIRE_ISA(fp, SmFileMagic);
54 if ((fp->f_flags & (SMWR | SMRW)) == 0)
65 SM_CONVERT_TIME(fp, fd, timeout, &to);
68 return sm_flush(fp, (int *) &timeout);
74 ** Assumes that 'fp' has been validated before this function called.
77 ** fp -- file pointer to be flushed
89 sm_flush(fp, timeout)
90 register SM_FILE_T *fp;
97 SM_REQUIRE_ISA(fp, SmFileMagic);
99 t = fp->f_flags;
105 *fp->f_p = '\0';
109 if ((p = fp->f_bf.smb_base) == NULL)
112 n = fp->f_p - p; /* write this much */
114 if ((fd = sm_io_getinfo(fp, SM_IO_WHAT_FD, NULL)) == -1)
116 /* can't get an fd, likely internal 'fake' fp */
126 fp->f_p = p;
127 fp->f_w = t & (SMLBF|SMNBF) ? 0 : fp->f_bf.smb_size; /* implies SMFBF */
134 t = (*fp->f_write)(fp, (char *)p, n);
142 fp->f_flags |= SMERR;
144 /* errno set by fp->f_write */
147 SM_IO_WR_TIMEOUT(fp, fd, *timeout);