home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************
- *
- * $Source: /unixb/home/unixlib/source/unixlib37/src/stdio/c/RCS/gets,v $
- * $Date: 1996/04/19 21:32:42 $
- * $Revision: 1.1 $
- * $State: Rel $
- * $Author: simon $
- *
- * $Log: gets,v $
- * Revision 1.1 1996/04/19 21:32:42 simon
- * Initial revision
- *
- ***************************************************************************/
-
- static const char rcs_id[] = "$Id: gets,v 1.1 1996/04/19 21:32:42 simon Rel $";
-
- #include <stdio.h>
-
- __STDIOLIB__
-
- char *
- gets (register char *_s)
- {
- register FILE *f = stdin;
- register char *s = _s;
- register int c = 0;
-
- while ((c = getc (f)) >= 0)
- if ((*s++ = c) == '\n')
- break;
-
- (c == '\n') ? (*--s = 0) : (*s = 0);
- return ((c < 0 && s == _s) ? 0 : _s);
- }
-