master
 1#include "stdio_impl.h"
 2#include <limits.h>
 3#include <string.h>
 4
 5char *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}