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