gets.c 197 B

12345678910
  1. #include "stdio_impl.h"
  2. #include <limits.h>
  3. #include <string.h>
  4. char *gets(char *s)
  5. {
  6. char *ret = fgets(s, INT_MAX, stdin);
  7. if (ret && s[strlen(s)-1] == '\n') s[strlen(s)-1] = 0;
  8. return ret;
  9. }