From 0ce21d42d553e47277c8523c0818f68f5d8c7711 Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 28 Mar 2026 14:40:08 +0100 Subject: [PATCH 1/4] feat(includes): adding colors.h --- includes/color.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 includes/color.h diff --git a/includes/color.h b/includes/color.h new file mode 100644 index 0000000..0a27f2c --- /dev/null +++ b/includes/color.h @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* color.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/05/12 14:13:18 by rparodi #+# #+# */ +/* Updated: 2025/05/12 14:13:30 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#pragma once + +#define CLR_RESET "\033[0m" + +#define CLR_BLACK "\033[0;30m" +#define CLR_RED "\033[0;31m" +#define CLR_GREEN "\033[0;32m" +#define CLR_YELLOW "\033[0;33m" +#define CLR_BLUE "\033[0;34m" +#define CLR_MAGENTA "\033[0;35m" +#define CLR_CYAN "\033[0;36m" +#define CLR_WHITE "\033[0;37m" +#define CLR_GOLD "\033[38;5;220m" +#define CLR_GREY "\033[38;5;240m" From 7f368f9ead703735f9fa8437a13e0c074aae9b1e Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 28 Mar 2026 14:40:22 +0100 Subject: [PATCH 2/4] feat(includes): adding debugs/errors macro --- includes/macro.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 includes/macro.h diff --git a/includes/macro.h b/includes/macro.h new file mode 100644 index 0000000..5ac0438 --- /dev/null +++ b/includes/macro.h @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* macro.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2026/03/24 11:23:47 by rparodi #+# #+# */ +/* Updated: 2026/03/24 13:20:48 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#pragma once + +#include +#include "color.h" + +#ifndef DEBUG +# define DEBUG 0 +#endif + +#define ERROR_LOG(str) dprintf(2, "%sError:\t%s (%s:%d in %s)%s\n", CLR_RED, str, __FILE_NAME__, __LINE__, __FUNCTION__, CLR_RESET); +#define WARN_LOG(str) if (DEBUG) {dprintf(2, "%sWarning:\t%s (%s:%d in %s)%s\n", CLR_YELLOW, str, __FILE_NAME__, __LINE__, __FUNCTION__, CLR_RESET);} +#define INFO_LOG(str) if (DEBUG) {dprintf(2, "%sInfo:\t%s (%s:%d in %s)%s\n", CLR_BLUE, str, __FILE_NAME__, __LINE__, __FUNCTION__, CLR_RESET);} +#define DEBUG_LOG(str) if (DEBUG) {dprintf(2, "%sDebug:\t%s (%s:%d in %s)%s\n", CLR_GREY, str, __FILE_NAME__, __LINE__, __FUNCTION__, CLR_RESET);} +#define SUCCESS_LOG(str) if (DEBUG) {dprintf(2, "%sSuccess from %s:\t%s (%s:%d)%s\n", CLR_GREEN, str, __FILE_NAME__, __LINE__, __FUNCTION__, CLR_RESET);} From 998677f79d9669d97c68e8f507b13395e8c4387e Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 28 Mar 2026 14:40:39 +0100 Subject: [PATCH 3/4] feat(includes): adding ping header --- includes/ping.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 includes/ping.h diff --git a/includes/ping.h b/includes/ping.h new file mode 100644 index 0000000..b009ab8 --- /dev/null +++ b/includes/ping.h @@ -0,0 +1,17 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ping.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2026/03/28 12:41:26 by rparodi #+# #+# */ +/* Updated: 2026/03/28 12:41:45 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#pragma once + +#include "struct.h" + +void parsing_args(int argc, char **argv, t_flags *flags); From 07b957ea0e08495febe66266e3b5c924315d952e Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 28 Mar 2026 14:40:50 +0100 Subject: [PATCH 4/4] feat(includes): adding struct header --- includes/struct.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 includes/struct.h diff --git a/includes/struct.h b/includes/struct.h new file mode 100644 index 0000000..131ce2e --- /dev/null +++ b/includes/struct.h @@ -0,0 +1,29 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* struct.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2026/03/23 15:06:41 by rparodi #+# #+# */ +/* Updated: 2026/03/24 13:30:42 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#pragma once + +#include +#include + +typedef struct s_flags { + bool help; + bool verbose; + bool flood; + bool quiet; + bool reverse_dns; + uint64_t wait; + uint64_t timeout; + uint64_t count; + char *content; + char *destination; +} t_flags;