Lines Matching refs:fp
34 ** Expand the ungetc buffer `in place'. That is, adjust fp->f_p when
40 ** fp -- the file pointer
50 sm_submore_x(fp)
51 SM_FILE_T *fp;
56 if (fp->f_ub.smb_base == fp->f_ubuf)
60 fp->f_ub.smb_base = p;
61 fp->f_ub.smb_size = SM_IO_BUFSIZ;
62 p += SM_IO_BUFSIZ - sizeof(fp->f_ubuf);
63 for (i = sizeof(fp->f_ubuf); --i >= 0;)
64 p[i] = fp->f_ubuf[i];
65 fp->f_p = p;
68 i = fp->f_ub.smb_size;
69 p = sm_realloc_x(fp->f_ub.smb_base, i << 1);
73 fp->f_p = p + i;
74 fp->f_ub.smb_base = p;
75 fp->f_ub.smb_size = i << 1;
82 ** fp -- the file pointer affected
96 sm_io_ungetc(fp, timeout, c)
97 register SM_FILE_T *fp;
101 SM_REQUIRE_ISA(fp, SmFileMagic);
117 if ((fp->f_flags & SMRD) == 0)
124 if ((fp->f_flags & SMRW) == 0)
126 if (fp->f_flags & SMWR)
128 if (sm_flush(fp, &timeout))
130 fp->f_flags &= ~SMWR;
131 fp->f_w = 0;
132 fp->f_lbfsize = 0;
134 fp->f_flags |= SMRD;
143 if (HASUB(fp))
145 if (fp->f_r >= fp->f_ub.smb_size)
146 sm_submore_x(fp);
147 *--fp->f_p = c;
148 fp->f_r++;
151 fp->f_flags &= ~SMFEOF;
159 if (fp->f_bf.smb_base != NULL && fp->f_p > fp->f_bf.smb_base &&
160 fp->f_p[-1] == c)
162 fp->f_p--;
163 fp->f_r++;
172 fp->f_ur = fp->f_r;
173 fp->f_up = fp->f_p;
174 fp->f_ub.smb_base = fp->f_ubuf;
175 fp->f_ub.smb_size = sizeof(fp->f_ubuf);
176 fp->f_ubuf[sizeof(fp->f_ubuf) - 1] = c;
177 fp->f_p = &fp->f_ubuf[sizeof(fp->f_ubuf) - 1];
178 fp->f_r = 1;