home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / gnu / libnix-0.8-src.lha / libnix-0.8 / sources / nix / stdio / gets.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-12  |  218 b   |  18 lines

  1. #include <stdio.h>
  2.  
  3. char *gets(char *s)
  4. {
  5.   int c;
  6.   char *s2=s;
  7.   for(;;)
  8.   { c=fgetc(stdin);
  9.     if(ferror(stdin))
  10.       return NULL;
  11.     if(c==EOF||c=='\n')
  12.       break;
  13.     *s2++=c;
  14.   }
  15.   *s2++='\0';
  16.   return s;
  17. }
  18.