3 * ReactOS msvcrt library
7 * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
9 * Based on original work Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details
10 * 28/12/1998: Appropriated for Reactos
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
28 #include <msvcrt/stdio.h>
36 while ((c = getc(stdin)) != '\n' && c != EOF)
38 if (c == EOF && cs == s)
45 #define WEOF (wchar_t)(0xFFFF)
48 // Get a line from the stdin stream.
49 wchar_t* _getws(wchar_t* s)
55 while ((c = getwc(stdin)) != L'\n' && c != WEOF)
57 if (c == WEOF && cs == s)
64 /* Copyright (C) 1991, 1994, 1995, 1996 Free Software Foundation, Inc.
65 This file is part of the GNU C Library.
67 The GNU C Library is free software; you can redistribute it and/or
68 modify it under the terms of the GNU Library General Public License as
69 published by the Free Software Foundation; either version 2 of the
70 License, or (at your option) any later version.
72 The GNU C Library is distributed in the hope that it will be useful,
73 but WITHOUT ANY WARRANTY; without even the implied warranty of
74 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
75 Library General Public License for more details.
77 You should have received a copy of the GNU Library General Public
78 License along with the GNU C Library; see the file COPYING.LIB. If
79 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
80 Cambridge, MA 02139, USA. */
86 link_warning (gets, "the `gets' function is dangerous and should not be used.")
89 /* Read a newline-terminated multibyte string from stdin into S,
90 removing the trailing newline. Return S or NULL. */
101 if (!__validfp (stream) || p == NULL)
103 __set_errno (EINVAL);
107 if (feof (stream) || ferror (stream))
110 while ((c = getc(stdin)) != EOF) {
116 else if ( isleadbyte(c) ) {
120 if ( isleadbyte(c) || c == EOF )
121 return NULL; // encoding error
128 return NULL; // suspicious input
133 /* Return null if we had an error, or if we got EOF
134 before writing any characters. */
136 if (ferror (stream) || (feof (stream) && p == s))