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
add PTHREAD_NULL
[musl.git]
/
src
/
stdio
/
gets.c
blob
17963b93e39223a031dfbd661e34160e5fe81b58
1
#include
"stdio_impl.h"
2
#include <limits.h>
3
#include <string.h>
4
5
char
*
gets
(
char
*
s
)
6
{
7
size_t
i
=
0
;
8
int
c
;
9
FLOCK
(
stdin
);
10
while
((
c
=
getc_unlocked
(
stdin
)) !=
EOF
&&
c
!=
'
\n
'
)
s
[
i
++] =
c
;
11
s
[
i
] =
0
;
12
if
(
c
!=
'
\n
'
&& (!
feof
(
stdin
) || !
i
))
s
=
0
;
13
FUNLOCK
(
stdin
);
14
return
s
;
15
}