repo.or.cz
/
musl.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
remove LFS64 symbol aliases; replace with dynamic linker remapping
[musl.git]
/
src
/
stdio
/
ungetc.c
blob
bc629d4ca511f812976abb93224e2732e0788e6e
1
#include
"stdio_impl.h"
2
3
int
ungetc
(
int
c
,
FILE
*
f
)
4
{
5
if
(
c
==
EOF
)
return
c
;
6
7
FLOCK
(
f
);
8
9
if
(!
f
->
rpos
)
__toread
(
f
);
10
if
(!
f
->
rpos
||
f
->
rpos
<=
f
->
buf
-
UNGET
) {
11
FUNLOCK
(
f
);
12
return
EOF
;
13
}
14
15
*--
f
->
rpos
=
c
;
16
f
->
flags
&= ~
F_EOF
;
17
18
FUNLOCK
(
f
);
19
return
(
unsigned char
)
c
;
20
}