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,31 +4719,53 @@ int CDECL MSVCRT_getc(MSVCRT_FILE* file) ...@@ -4719,31 +4719,53 @@ 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)
{ {
int cc; char *buf_start = buf;
char * buf_start = buf; int cc;
MSVCRT__lock_file(MSVCRT_stdin); if (!MSVCRT_CHECK_PMT(buf != NULL)) return NULL;
for(cc = MSVCRT__fgetc_nolock(MSVCRT_stdin); cc != MSVCRT_EOF && cc != '\n'; if (!MSVCRT_CHECK_PMT(len != 0)) return NULL;
cc = MSVCRT__fgetc_nolock(MSVCRT_stdin))
{
if(cc != '\r')
*buf++ = (char)cc;
}
MSVCRT__unlock_file(MSVCRT_stdin);
if ((cc == MSVCRT_EOF) && (buf_start == buf)) MSVCRT__lock_file(MSVCRT_stdin);
{ for(cc = MSVCRT__fgetc_nolock(MSVCRT_stdin);
TRACE(":nothing read\n"); len != 0 && cc != MSVCRT_EOF && cc != '\n';
return NULL; cc = MSVCRT__fgetc_nolock(MSVCRT_stdin))
} {
*buf = '\0'; if (cc != '\r')
{
*buf++ = (char)cc;
len--;
}
}
MSVCRT__unlock_file(MSVCRT_stdin);
TRACE("got '%s'\n", buf_start); if (!len)
return buf_start; {
*buf_start = 0;
MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0);
return NULL;
}
if ((cc == MSVCRT_EOF) && (buf_start == buf))
{
TRACE(":nothing read\n");
return NULL;
}
*buf = '\0';
TRACE("got '%s'\n", buf_start);
return buf_start;
}
/*********************************************************************
* gets (MSVCRT.@)
*/
char * CDECL MSVCRT_gets(char *buf)
{
return MSVCRT_gets_s(buf, -1);
} }
/********************************************************************* /*********************************************************************
......
...@@ -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