made a lot of changes

This commit is contained in:
eck
1989-12-18 15:04:14 +00:00
parent bb48507f58
commit 2f92b46a9d
40 changed files with 540 additions and 386 deletions

View File

@@ -8,15 +8,19 @@
char *
gets(char *s)
{
register FILE *stream = stdin;
register int ch;
register char *ptr;
ptr = s;
while ((ch = getc(stdin)) != EOF && ch != '\n')
while ((ch = getc(stream)) != EOF && ch != '\n')
*ptr++ = ch;
if (ch == EOF && ptr==s)
return (char *)NULL;
if (ch == EOF) {
if (feof(stream)) {
if (ptr == s) return NULL;
} else return NULL;
}
*ptr = '\0';
return s;