https://github.com/Kitware/CMake
Revision 3af8c7715b359affce99c575bdcb84ca87585bb2 authored by KWSys Upstream on 01 June 2018, 16:53:33 UTC, committed by Brad King on 01 June 2018, 16:54:12 UTC
Code extracted from:

    https://gitlab.kitware.com/utils/kwsys.git

at commit 8ef62b289e0a99856893ef49106c2b2d94e9dd0c (master).

Upstream Shortlog
-----------------

Brad King (2):
      6b9c233c clang-format.bash: update to clang-format-6.0
      b7a341cf Empty commit at end of history preceding clang-format-6.0 style transition

Kitware Robot (1):
      828b6837 Revise C++ coding style using clang-format-6.0
1 parent 1f52cb0
Raw File
Tip revision: 3af8c7715b359affce99c575bdcb84ca87585bb2 authored by KWSys Upstream on 01 June 2018, 16:53:33 UTC
KWSys 2018-06-01 (8ef62b28)
Tip revision: 3af8c77
testConsoleBufChild.cxx
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing#kwsys for details.  */
#include "kwsysPrivate.h"

#include KWSYS_HEADER(ConsoleBuf.hxx)
#include KWSYS_HEADER(Encoding.hxx)

// Work-around CMake dependency scanning limitation.  This must
// duplicate the above list of headers.
#if 0
#  include "ConsoleBuf.hxx.in"
#  include "Encoding.hxx.in"
#endif

#include <iostream>

#include "testConsoleBuf.hxx"

int main(int argc, const char* argv[])
{
#if defined(_WIN32)
  kwsys::ConsoleBuf::Manager out(std::cout);
  kwsys::ConsoleBuf::Manager err(std::cerr, true);
  kwsys::ConsoleBuf::Manager in(std::cin);

  if (argc > 1) {
    std::cout << argv[1] << std::endl;
    std::cerr << argv[1] << std::endl;
  } else {
    std::string str = kwsys::Encoding::ToNarrow(std::wstring(
      UnicodeTestString, sizeof(UnicodeTestString) / sizeof(wchar_t) - 1));
    std::cout << str << std::endl;
    std::cerr << str << std::endl;
  }

  std::string input;
  HANDLE event = OpenEventW(EVENT_MODIFY_STATE, FALSE, BeforeInputEventName);
  if (event) {
    SetEvent(event);
    CloseHandle(event);
  }

  std::cin >> input;
  std::cout << input << std::endl;
  event = OpenEventW(EVENT_MODIFY_STATE, FALSE, AfterOutputEventName);
  if (event) {
    SetEvent(event);
    CloseHandle(event);
  }
#else
  static_cast<void>(argc);
  static_cast<void>(argv);
#endif
  return 0;
}
back to top