Initial revision

This commit is contained in:
Ben Gras
2005-04-21 14:53:53 +00:00
commit 9865aeaa79
2264 changed files with 411685 additions and 0 deletions

27
lib/stdio/gets.c Executable file
View File

@@ -0,0 +1,27 @@
/*
* gets.c - read a line from a stream
*/
/* $Header$ */
#include <stdio.h>
char *
gets(char *s)
{
register FILE *stream = stdin;
register int ch;
register char *ptr;
ptr = s;
while ((ch = getc(stream)) != EOF && ch != '\n')
*ptr++ = ch;
if (ch == EOF) {
if (feof(stream)) {
if (ptr == s) return NULL;
} else return NULL;
}
*ptr = '\0';
return s;
}