gets.c 261 B

1234567891011121314151617
  1. /*
  2. * pANS stdio -- gets
  3. */
  4. #include "iolib.h"
  5. char *gets(char *as){
  6. #ifdef secure
  7. stdin->flags|=ERR;
  8. return NULL;
  9. #else
  10. char *s=as;
  11. int c;
  12. while((c=getchar())!='\n' && c!=EOF) *s++=c;
  13. if(c!=EOF || s!=as) *s='\0';
  14. else return NULL;
  15. return as;
  16. #endif
  17. }