shithub: scc

ref: 3e6e8f74f042a31ace6ae54247790f9a9230285a
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;
}