Trailing-Edge
-
PDP-10 Archives
-
SRI_NIC_PERM_FS_1_19910112
-
kccdist/lib/stdio/gets.c
There are 7 other files named gets.c in the archive. Click here to see a list.
/*
* GETS - get a string from stdin
*
* Copyright (c) 1986 by Ian Macky, SRI International
*/
#include "stdio.h"
char *gets(s)
register char *s;
{
register int c;
register char *original_s;
if (!_readable(stdin)) return NULL;
original_s = s;
while ((c = getchar()) != EOF && c != '\n')
*s++ = c;
if (c == EOF && s == original_s) return NULL;
*s = '\0';
return original_s;
}