shithub: scc

ref: 37e4ca9b85b68ca0441c18c2f4fbf24c866e38cb
dir: /lib/c/src/gets.c/

View raw version
#include <stdio.h>
#undef gets

char *
gets(char *s)
{
	int ch;
	char *t = s;

	while ((ch = getc(stdin)) != EOF && ch != '\n')
		*t++ = ch;
	if (ch == EOF && s == t)
		return NULL;
	*t = '\0';

	return s;
}