While nobody in their right mind should be calling this function,
it is needed for linking a shared libssp (stack smashing protection)
with that crt.
Signed-off-by: Martin Storsjö
---
mingw-w64-crt/Makefile.am | 6 --
mingw-w64-crt/stdio/gets.c | 19 +++
2 files changed, 23 insertions(+), 2 deletions(-)
create mode 100644 mingw-w64-crt/stdio/gets.c
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 84b32e133..83e3979fa 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -249,7 +249,8 @@ src_msvcrtarm32=\
misc/__p__acmdln.c \
misc/__p__fmode.c \
misc/__p__wcmdln.c \
- misc/_getpid.c
+ misc/_getpid.c \
+ stdio/gets.c
if !ENABLE_SOFTMATH
src_msvcrtarm32+=\
@@ -328,7 +329,8 @@ src_msvcrtarm64=\
misc/__p__acmdln.c \
misc/__p__fmode.c \
misc/__p__wcmdln.c \
- misc/_getpid.c
+ misc/_getpid.c \
+ stdio/gets.c
src_msvcr80_64=\
$(src_msvcrt_common) \
diff --git a/mingw-w64-crt/stdio/gets.c b/mingw-w64-crt/stdio/gets.c
new file mode 100644
index 0..eb73d4604
--- /dev/null
+++ b/mingw-w64-crt/stdio/gets.c
@@ -0,0 +1,19 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+#include
+#include
+#include
+
+char *__cdecl gets(char *buf) {
+ char *ret = fgets(buf, INT_MAX, stdin);
+ if (ret) {
+size_t len = strlen(buf);
+if (len > 0 && buf[len - 1] == '\n')
+ buf[len - 1] = '\0';
+ }
+ return ret;
+}
--
2.17.1
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public