[CRT] Sync _cputs() with Wine Staging 1.9.16. CORE-11866 CORE-8546
authorAmine Khaldi <amine.khaldi@reactos.org>
Wed, 7 Sep 2016 09:31:52 +0000 (09:31 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Wed, 7 Sep 2016 09:31:52 +0000 (09:31 +0000)
svn path=/trunk/; revision=72606

reactos/media/doc/README.WINE
reactos/sdk/lib/crt/conio/cputs.c

index e56c6a5..1c160ac 100644 (file)
@@ -287,6 +287,7 @@ kernel32 -
   reactos/dll/win32/kernel32/winnls/string/sortkey.c     # Synced to WineStaging-1.9.16
 
 msvcrt -
+  reactos/sdk/lib/crt/conio/cputs.c             # Synced to WineStaging-1.9.16
   reactos/sdk/lib/crt/except/cpp.c              # Synced at 20080528
   reactos/sdk/lib/crt/except/cppexcept.c        # Synced at 20071111
   reactos/sdk/lib/crt/process/_cwait.c          # Synced to WineStaging-1.7.37
index 7444527..bf0d8d0 100644 (file)
@@ -1,26 +1,29 @@
-/*
- * COPYRIGHT:   LGPL - See COPYING in the top level directory
- * PROJECT:     ReactOS system libraries
- * FILE:        lib/sdk/crt/conio/cputs.c
- * PURPOSE:     Writes a character to stdout
- * PROGRAMER:   Aleksey Bragin
- */
+/* Imported from msvcrt/console.c */
 
 #include <precomp.h>
 
-/*
- * @implemented
+/*********************************************************************
+ *             _cputs (MSVCRT.@)
  */
-int _cputs(const char *_str)
+int CDECL _cputs(const char* str)
 {
   DWORD count;
-  int retval = EOF;
-  HANDLE console_out = GetStdHandle(STD_OUTPUT_HANDLE);
+  int len, retval = -1;
+#ifdef __REACTOS__ /* r54651 */
+  HANDLE MSVCRT_console_out = GetStdHandle(STD_OUTPUT_HANDLE);
+#endif
+
+  if (!MSVCRT_CHECK_PMT(str != NULL)) return -1;
+  len = strlen(str);
 
-  //LOCK_CONSOLE;
-  if (WriteConsoleA(console_out, _str, strlen(_str), &count, NULL)
-      && count == 1)
+#ifndef __REACTOS__ /* r54651 */
+  LOCK_CONSOLE;
+#endif
+  if (WriteConsoleA(MSVCRT_console_out, str, len, &count, NULL)
+      && count == len)
     retval = 0;
-  //UNLOCK_CONSOLE;
+#ifndef __REACTOS__ /* r54651 */
+  UNLOCK_CONSOLE;
+#endif
   return retval;
 }