|
|
1.1 ! root 1: #if defined(LIBC_SCCS) && !defined(lint) ! 2: static char sccsid[] = "@(#)gets.c 5.2 (Berkeley) 3/9/86"; ! 3: #endif LIBC_SCCS and not lint ! 4: ! 5: #include <stdio.h> ! 6: ! 7: char * ! 8: gets(s) ! 9: char *s; ! 10: { ! 11: register c; ! 12: register char *cs; ! 13: ! 14: cs = s; ! 15: while ((c = getchar()) != '\n' && c != EOF) ! 16: *cs++ = c; ! 17: if (c == EOF && cs==s) ! 18: return(NULL); ! 19: *cs++ = '\0'; ! 20: return(s); ! 21: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.