From 69818ced89fadb8f6080900649a77ae305facea2 Mon Sep 17 00:00:00 2001 From: acetone Date: Thu, 20 May 2021 13:09:19 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20#?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 12 ++++++------ tcpsyncclient.cpp | 4 ++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/main.cpp b/main.cpp index 4d43c71..bd06b91 100644 --- a/main.cpp +++ b/main.cpp @@ -64,16 +64,16 @@ void make_tsc() int main(int argc, char * argv[]) { -////// Проверка переданных данных +//// Проверка переданных данных if (argc < 5) { + std::cout << argc << std::endl; usage( std::string(argv[0])); - return -1; + return 1; } channel = std::string(argv[3]); if (argv[3][0] != '#') { - std::cerr << "Incorrect channel name. Maybe '#" << channel << "'?" << std::endl; - return -2; + channel = "#" + channel; } std::string address(argv[1]); @@ -88,7 +88,7 @@ int main(int argc, char * argv[]) } catch (boost::system::system_error & err) { std::cerr << err.what() << ": " << address << " / " << port << std::endl; - return -3; + return 3; } nick = std::string(argv[4]); @@ -118,5 +118,5 @@ int main(int argc, char * argv[]) std::this_thread::sleep_for(std::chrono::milliseconds(100)); } connection.join(); - return -4; // Выход по обрыву цикла + return 4; // Выход по обрыву цикла } diff --git a/tcpsyncclient.cpp b/tcpsyncclient.cpp index 6198ac6..a5921be 100644 --- a/tcpsyncclient.cpp +++ b/tcpsyncclient.cpp @@ -3,7 +3,11 @@ template void TcpSyncClient::log(T message) { +#ifdef WIN32 + std::cout << "[TSC] " << message; +#else std::cout << "[TSC] " << message << std::endl; +#endif } TcpSyncClient::TcpSyncClient(boost::asio::ip::tcp::endpoint ep, boost::asio::io_service& s,