From 5c980ec086ea856d5790a40922623e14846ea7fb Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 13 May 2025 12:07:03 +0200 Subject: [PATCH] style(core): Uniform all the prefix --- sources/core/main.cpp | 12 +++++++----- sources/core/server.cpp | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/sources/core/main.cpp b/sources/core/main.cpp index 5ab69c3..13a5c5d 100644 --- a/sources/core/main.cpp +++ b/sources/core/main.cpp @@ -6,22 +6,24 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/05/13 11:03:13 by rparodi #+# #+# */ -/* Updated: 2025/05/13 11:03:16 by rparodi ### ########.fr */ +/* Updated: 2025/05/13 11:56:50 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ -#include #include "core.hpp" +#include int main(int argc, char *argv[]) { if (argc != 3) { std::cerr << CLR_RED << "Usage: " << argv[0] << " " << CLR_RESET << std::endl; return 1; } - if (DEBUG) { - std::cout << CLR_GREY << "Port:\t\t" << CLR_GREEN << argv[1] << CLR_RESET << std::endl; - std::cout << CLR_GREY << "Password:\t" << CLR_GREEN << argv[2] << CLR_RESET << std::endl; + unsigned short int tmp_port = valid_port(argv[1]); + if (tmp_port == 0) { + std::cerr << CLR_RED << "Error: Invalid port: " << argv[1] << CLR_RESET << std::endl; + return 1; } + Server server(tmp_port, argv[2]); while (1) ; return 0; diff --git a/sources/core/server.cpp b/sources/core/server.cpp index abb71e6..e26b68f 100644 --- a/sources/core/server.cpp +++ b/sources/core/server.cpp @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/05/13 11:11:07 by rparodi #+# #+# */ -/* Updated: 2025/05/13 11:19:18 by rparodi ### ########.fr */ +/* Updated: 2025/05/13 12:00:55 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,8 +18,8 @@ */ Server::Server() : _port(0), _password("") { if (DEBUG) - std::cerr << CLR_MAGENTA << "[DEBUG] Thanks to use the constructor with port and password !" << std::endl; - std::cout << CLR_GREY << "[INFO] Server default constructor called" << CLR_RESET << std::endl; + std::cerr << CLR_MAGENTA << "Debug: Thanks to use the constructor with port and password !" << std::endl; + std::cout << CLR_GREY << "Info: Server default constructor called" << CLR_RESET << std::endl; } /**