Commit 6b268e77 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcr80: Add gets_s implementation.

parent 13f9461e
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
@ cdecl getc(ptr) ucrtbase.getc @ cdecl getc(ptr) ucrtbase.getc
@ cdecl getchar() ucrtbase.getchar @ cdecl getchar() ucrtbase.getchar
@ cdecl gets(str) ucrtbase.gets @ cdecl gets(str) ucrtbase.gets
@ stub gets_s @ cdecl gets_s(ptr long) ucrtbase.gets_s
@ cdecl getwc(ptr) ucrtbase.getwc @ cdecl getwc(ptr) ucrtbase.getwc
@ cdecl getwchar() ucrtbase.getwchar @ cdecl getwchar() ucrtbase.getwchar
@ cdecl putc(long ptr) ucrtbase.putc @ cdecl putc(long ptr) ucrtbase.putc
......
...@@ -1700,7 +1700,7 @@ ...@@ -1700,7 +1700,7 @@
@ cdecl getenv(str) MSVCRT_getenv @ cdecl getenv(str) MSVCRT_getenv
@ cdecl getenv_s(ptr ptr long str) @ cdecl getenv_s(ptr ptr long str)
@ cdecl gets(str) MSVCRT_gets @ cdecl gets(str) MSVCRT_gets
@ stub gets_s @ cdecl gets_s(ptr long) MSVCRT_gets_s
@ cdecl getwc(ptr) MSVCRT_getwc @ cdecl getwc(ptr) MSVCRT_getwc
@ cdecl getwchar() MSVCRT_getwchar @ cdecl getwchar() MSVCRT_getwchar
@ cdecl is_wctype(long long) ntdll.iswctype @ cdecl is_wctype(long long) ntdll.iswctype
......
...@@ -2058,7 +2058,7 @@ ...@@ -2058,7 +2058,7 @@
@ cdecl getenv(str) MSVCRT_getenv @ cdecl getenv(str) MSVCRT_getenv
@ cdecl getenv_s(ptr ptr long str) @ cdecl getenv_s(ptr ptr long str)
@ cdecl gets(str) MSVCRT_gets @ cdecl gets(str) MSVCRT_gets
@ stub gets_s @ cdecl gets_s(ptr long) MSVCRT_gets_s
@ cdecl getwc(ptr) MSVCRT_getwc @ cdecl getwc(ptr) MSVCRT_getwc
@ cdecl getwchar() MSVCRT_getwchar @ cdecl getwchar() MSVCRT_getwchar
@ cdecl is_wctype(long long) ntdll.iswctype @ cdecl is_wctype(long long) ntdll.iswctype
......
...@@ -2204,7 +2204,7 @@ ...@@ -2204,7 +2204,7 @@
@ cdecl getenv(str) MSVCRT_getenv @ cdecl getenv(str) MSVCRT_getenv
@ cdecl getenv_s(ptr ptr long str) @ cdecl getenv_s(ptr ptr long str)
@ cdecl gets(str) MSVCRT_gets @ cdecl gets(str) MSVCRT_gets
@ stub gets_s @ cdecl gets_s(ptr long) MSVCRT_gets_s
@ cdecl getwc(ptr) MSVCRT_getwc @ cdecl getwc(ptr) MSVCRT_getwc
@ cdecl getwchar() MSVCRT_getwchar @ cdecl getwchar() MSVCRT_getwchar
@ stub ilogb @ stub ilogb
......
...@@ -1868,7 +1868,7 @@ ...@@ -1868,7 +1868,7 @@
@ cdecl getc(ptr) msvcr120.getc @ cdecl getc(ptr) msvcr120.getc
@ cdecl getchar() msvcr120.getchar @ cdecl getchar() msvcr120.getchar
@ cdecl gets(str) msvcr120.gets @ cdecl gets(str) msvcr120.gets
@ stub gets_s @ cdecl gets_s(ptr long) msvcr120.gets_s
@ cdecl getwc(ptr) msvcr120.getwc @ cdecl getwc(ptr) msvcr120.getwc
@ cdecl getwchar() msvcr120.getwchar @ cdecl getwchar() msvcr120.getwchar
@ stub ilogb @ stub ilogb
......
...@@ -1382,7 +1382,7 @@ ...@@ -1382,7 +1382,7 @@
@ cdecl getenv(str) MSVCRT_getenv @ cdecl getenv(str) MSVCRT_getenv
@ cdecl getenv_s(ptr ptr long str) @ cdecl getenv_s(ptr ptr long str)
@ cdecl gets(str) MSVCRT_gets @ cdecl gets(str) MSVCRT_gets
@ stub gets_s @ cdecl gets_s(ptr long) MSVCRT_gets_s
@ cdecl getwc(ptr) MSVCRT_getwc @ cdecl getwc(ptr) MSVCRT_getwc
@ cdecl getwchar() MSVCRT_getwchar @ cdecl getwchar() MSVCRT_getwchar
@ cdecl is_wctype(long long) ntdll.iswctype @ cdecl is_wctype(long long) ntdll.iswctype
......
...@@ -1355,7 +1355,7 @@ ...@@ -1355,7 +1355,7 @@
@ cdecl getenv(str) MSVCRT_getenv @ cdecl getenv(str) MSVCRT_getenv
@ cdecl getenv_s(ptr ptr long str) @ cdecl getenv_s(ptr ptr long str)
@ cdecl gets(str) MSVCRT_gets @ cdecl gets(str) MSVCRT_gets
@ stub gets_s @ cdecl gets_s(ptr long) MSVCRT_gets_s
@ cdecl getwc(ptr) MSVCRT_getwc @ cdecl getwc(ptr) MSVCRT_getwc
@ cdecl getwchar() MSVCRT_getwchar @ cdecl getwchar() MSVCRT_getwchar
@ cdecl is_wctype(long long) ntdll.iswctype @ cdecl is_wctype(long long) ntdll.iswctype
......
...@@ -4719,22 +4719,36 @@ int CDECL MSVCRT_getc(MSVCRT_FILE* file) ...@@ -4719,22 +4719,36 @@ int CDECL MSVCRT_getc(MSVCRT_FILE* file)
} }
/********************************************************************* /*********************************************************************
* gets (MSVCRT.@) * gets_s (MSVCR80.@)
*/ */
char * CDECL MSVCRT_gets(char *buf) char * CDECL MSVCRT_gets_s(char *buf, MSVCRT_size_t len)
{ {
char *buf_start = buf;
int cc; int cc;
char * buf_start = buf;
if (!MSVCRT_CHECK_PMT(buf != NULL)) return NULL;
if (!MSVCRT_CHECK_PMT(len != 0)) return NULL;
MSVCRT__lock_file(MSVCRT_stdin); MSVCRT__lock_file(MSVCRT_stdin);
for(cc = MSVCRT__fgetc_nolock(MSVCRT_stdin); cc != MSVCRT_EOF && cc != '\n'; for(cc = MSVCRT__fgetc_nolock(MSVCRT_stdin);
len != 0 && cc != MSVCRT_EOF && cc != '\n';
cc = MSVCRT__fgetc_nolock(MSVCRT_stdin)) cc = MSVCRT__fgetc_nolock(MSVCRT_stdin))
{ {
if(cc != '\r') if (cc != '\r')
{
*buf++ = (char)cc; *buf++ = (char)cc;
len--;
}
} }
MSVCRT__unlock_file(MSVCRT_stdin); MSVCRT__unlock_file(MSVCRT_stdin);
if (!len)
{
*buf_start = 0;
MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0);
return NULL;
}
if ((cc == MSVCRT_EOF) && (buf_start == buf)) if ((cc == MSVCRT_EOF) && (buf_start == buf))
{ {
TRACE(":nothing read\n"); TRACE(":nothing read\n");
...@@ -4747,6 +4761,14 @@ char * CDECL MSVCRT_gets(char *buf) ...@@ -4747,6 +4761,14 @@ char * CDECL MSVCRT_gets(char *buf)
} }
/********************************************************************* /*********************************************************************
* gets (MSVCRT.@)
*/
char * CDECL MSVCRT_gets(char *buf)
{
return MSVCRT_gets_s(buf, -1);
}
/*********************************************************************
* _getws (MSVCRT.@) * _getws (MSVCRT.@)
*/ */
MSVCRT_wchar_t* CDECL MSVCRT__getws(MSVCRT_wchar_t* buf) MSVCRT_wchar_t* CDECL MSVCRT__getws(MSVCRT_wchar_t* buf)
......
...@@ -2337,7 +2337,7 @@ ...@@ -2337,7 +2337,7 @@
@ cdecl getenv(str) MSVCRT_getenv @ cdecl getenv(str) MSVCRT_getenv
@ cdecl getenv_s(ptr ptr long str) @ cdecl getenv_s(ptr ptr long str)
@ cdecl gets(str) MSVCRT_gets @ cdecl gets(str) MSVCRT_gets
@ stub gets_s @ cdecl gets_s(ptr long) MSVCRT_gets_s
@ cdecl getwc(ptr) MSVCRT_getwc @ cdecl getwc(ptr) MSVCRT_getwc
@ cdecl getwchar() MSVCRT_getwchar @ cdecl getwchar() MSVCRT_getwchar
@ cdecl hypot(double double) _hypot @ cdecl hypot(double double) _hypot
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment