home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * GETS.C
- *
- * (c)Copyright 1990, Matthew Dillon, All Rights Reserved
- *
- * buf = gets(buf)
- */
-
- #include <stdio.h>
-
- char *
- gets(buf)
- char *buf;
- {
- int c;
- int cnt = 0;
- char *base = buf;
-
- while ((c = getc(stdin)) != EOF) {
- *buf++ = c;
- if (c != '\n' && cnt < BUFSIZ) {
- ++cnt;
- continue;
- }
- buf[-1] = 0;
- return(base);
- }
- return(NULL);
- }
-
-