Gitiles
Code Review
Sign In
gerrit-public.fairphone.software
/
platform
/
external
/
musl
/
d41cdef9198e635270d30e82be939d4ea0cbce82
/
.
/
src
/
stdio
/
ungetc.c
blob: 180673a47663ad57b11d3e6525c35cc23858939a [
file
] [
log
] [
blame
]
#include
"stdio_impl.h"
int
ungetc
(
int
c
,
FILE
*
f
)
{
if
(
c
==
EOF
)
return
c
;
FLOCK
(
f
);
if
(!
f
->
rpos
)
__toread
(
f
);
if
(!
f
->
rpos
||
f
->
rpos
<=
f
->
buf
-
UNGET
)
{
FUNLOCK
(
f
);
return
EOF
;
}
*--
f
->
rpos
=
c
;
f
->
flags
&=
~
F_EOF
;
FUNLOCK
(
f
);
return
c
;
}