plan9fox/sys/src/libstdio/gets.c
2011-03-30 19:35:09 +03:00

18 lines
261 B
C

/*
* pANS stdio -- gets
*/
#include "iolib.h"
char *gets(char *as){
#ifdef secure
stdin->flags|=ERR;
return NULL;
#else
char *s=as;
int c;
while((c=getchar())!='\n' && c!=EOF) *s++=c;
if(c!=EOF || s!=as) *s='\0';
else return NULL;
return as;
#endif
}