add PTHREAD_NULL
[musl.git] / src / stdio / gets.c
blob17963b93e39223a031dfbd661e34160e5fe81b58
1 #include "stdio_impl.h"
2 #include <limits.h>
3 #include <string.h>
5 char *gets(char *s)
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;