2.9BSD/usr/src/lib/c/stdio/gets.c

Compare this file to the similar file:
Show the results in this format:

/*	@(#)gets.c	2.1	SCCS id keyword	*/
#include	<stdio.h>

char *
gets(s)
char *s;
{
	register c;
	register char *cs;

	cs = s;
	while ((c = getchar()) != '\n' && c >= 0)
		*cs++ = c;
	if (c<0 && cs==s)
		return(NULL);
	*cs++ = '\0';
	return(s);
}