Lines Matching refs:fp
36 ** Expand the ungetc buffer `in place'. That is, adjust fp->f_p when
42 ** fp -- the file pointer
52 sm_submore_x(fp)
53 SM_FILE_T *fp;
58 if (fp->f_ub.smb_base == fp->f_ubuf)
62 fp->f_ub.smb_base = p;
63 fp->f_ub.smb_size = SM_IO_BUFSIZ;
64 p += SM_IO_BUFSIZ - sizeof(fp->f_ubuf);
65 for (i = sizeof(fp->f_ubuf); --i >= 0;)
66 p[i] = fp->f_ubuf[i];
67 fp->f_p = p;
70 i = fp->f_ub.smb_size;
71 p = sm_realloc_x(fp->f_ub.smb_base, i << 1);
75 fp->f_p = p + i;
76 fp->f_ub.smb_base = p;
77 fp->f_ub.smb_size = i << 1;
84 ** fp -- the file pointer affected
98 sm_io_ungetc(fp, timeout, c)
99 register SM_FILE_T *fp;
103 SM_REQUIRE_ISA(fp, SmFileMagic);
119 if ((fp->f_flags & SMRD) == 0)
126 if ((fp->f_flags & SMRW) == 0)
128 if (fp->f_flags & SMWR)
130 if (sm_flush(fp, &timeout))
132 fp->f_flags &= ~SMWR;
133 fp->f_w = 0;
134 fp->f_lbfsize = 0;
136 fp->f_flags |= SMRD;
145 if (HASUB(fp))
147 if (fp->f_r >= fp->f_ub.smb_size)
148 sm_submore_x(fp);
149 *--fp->f_p = c;
150 fp->f_r++;
153 fp->f_flags &= ~SMFEOF;
161 if (fp->f_bf.smb_base != NULL && fp->f_p > fp->f_bf.smb_base &&
162 fp->f_p[-1] == c)
164 fp->f_p--;
165 fp->f_r++;
174 fp->f_ur = fp->f_r;
175 fp->f_up = fp->f_p;
176 fp->f_ub.smb_base = fp->f_ubuf;
177 fp->f_ub.smb_size = sizeof(fp->f_ubuf);
178 fp->f_ubuf[sizeof(fp->f_ubuf) - 1] = c;
179 fp->f_p = &fp->f_ubuf[sizeof(fp->f_ubuf) - 1];
180 fp->f_r = 1;