• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * This file has no copyright assigned and is placed in the Public Domain.
3  * This file is part of the mingw-w64 runtime package.
4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5  */
6 
7 #include <stdio.h>
8 #include <string.h>
9 #include <limits.h>
10 
gets(char * buf)11 char *__cdecl gets(char *buf) {
12   char *ret = fgets(buf, INT_MAX, stdin);
13   if (ret) {
14     size_t len = strlen(buf);
15     if (len > 0 && buf[len - 1] == '\n')
16       buf[len - 1] = '\0';
17   }
18   return ret;
19 }
20