shithub: scc

ref: d82fe81032115596968f35e60beb85ac5ef69f9c
dir: /src/libc/stdio/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;
}