Rev 4874 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4874 | Rev 4921 | ||
---|---|---|---|
Line 123... | Line 123... | ||
123 | ??? Might be able to remove this as some other stdio routine should |
123 | ??? Might be able to remove this as some other stdio routine should |
124 | have already been called to get the char we are un-getting. */ |
124 | have already been called to get the char we are un-getting. */ |
Line 125... | Line 125... | ||
125 | 125 | ||
Line 126... | Line 126... | ||
126 | CHECK_INIT (rptr, fp); |
126 | CHECK_INIT (rptr, fp); |
Line 127... | Line 127... | ||
127 | 127 | ||
Line 128... | Line 128... | ||
128 | _flockfile (fp); |
128 | _newlib_flockfile_start (fp); |
129 | 129 | ||
Line 138... | Line 138... | ||
138 | * Not already reading: no good unless reading-and-writing. |
138 | * Not already reading: no good unless reading-and-writing. |
139 | * Otherwise, flush any current write stuff. |
139 | * Otherwise, flush any current write stuff. |
140 | */ |
140 | */ |
141 | if ((fp->_flags & __SRW) == 0) |
141 | if ((fp->_flags & __SRW) == 0) |
142 | { |
142 | { |
143 | _funlockfile (fp); |
143 | _newlib_flockfile_exit (fp); |
144 | return EOF; |
144 | return EOF; |
145 | } |
145 | } |
146 | if (fp->_flags & __SWR) |
146 | if (fp->_flags & __SWR) |
147 | { |
147 | { |
148 | if (_fflush_r (rptr, fp)) |
148 | if (_fflush_r (rptr, fp)) |
149 | { |
149 | { |
150 | _funlockfile (fp); |
150 | _newlib_flockfile_exit (fp); |
151 | return EOF; |
151 | return EOF; |
152 | } |
152 | } |
153 | fp->_flags &= ~__SWR; |
153 | fp->_flags &= ~__SWR; |
154 | fp->_w = 0; |
154 | fp->_w = 0; |
155 | fp->_lbfsize = 0; |
155 | fp->_lbfsize = 0; |
Line 165... | Line 165... | ||
165 | 165 | ||
166 | if (HASUB (fp)) |
166 | if (HASUB (fp)) |
167 | { |
167 | { |
168 | if (fp->_r >= fp->_ub._size && __submore (rptr, fp)) |
168 | if (fp->_r >= fp->_ub._size && __submore (rptr, fp)) |
169 | { |
169 | { |
170 | _funlockfile (fp); |
170 | _newlib_flockfile_exit (fp); |
171 | return EOF; |
171 | return EOF; |
172 | } |
172 | } |
173 | *--fp->_p = c; |
173 | *--fp->_p = c; |
174 | fp->_r++; |
174 | fp->_r++; |
175 | _funlockfile (fp); |
175 | _newlib_flockfile_exit (fp); |
176 | return c; |
176 | return c; |
Line 177... | Line 177... | ||
177 | } |
177 | } |
178 | 178 | ||
Line 184... | Line 184... | ||
184 | 184 | ||
185 | if (fp->_bf._base != NULL && fp->_p > fp->_bf._base && fp->_p[-1] == c) |
185 | if (fp->_bf._base != NULL && fp->_p > fp->_bf._base && fp->_p[-1] == c) |
186 | { |
186 | { |
187 | fp->_p--; |
187 | fp->_p--; |
188 | fp->_r++; |
188 | fp->_r++; |
189 | _funlockfile (fp); |
189 | _newlib_flockfile_exit (fp); |
190 | return c; |
190 | return c; |
Line 191... | Line 191... | ||
191 | } |
191 | } |
192 | 192 | ||
Line 200... | Line 200... | ||
200 | fp->_ub._base = fp->_ubuf; |
200 | fp->_ub._base = fp->_ubuf; |
201 | fp->_ub._size = sizeof (fp->_ubuf); |
201 | fp->_ub._size = sizeof (fp->_ubuf); |
202 | fp->_ubuf[sizeof (fp->_ubuf) - 1] = c; |
202 | fp->_ubuf[sizeof (fp->_ubuf) - 1] = c; |
203 | fp->_p = &fp->_ubuf[sizeof (fp->_ubuf) - 1]; |
203 | fp->_p = &fp->_ubuf[sizeof (fp->_ubuf) - 1]; |
204 | fp->_r = 1; |
204 | fp->_r = 1; |
205 | _funlockfile (fp); |
205 | _newlib_flockfile_end (fp); |
206 | return c; |
206 | return c; |
207 | } |
207 | } |
Line 208... | Line 208... | ||
208 | 208 | ||
209 | #ifndef _REENT_ONLY |
209 | #ifndef _REENT_ONLY |