Compare commits

...

4 commits

Author SHA1 Message Date
Raphael
07b957ea0e
feat(includes): adding struct header 2026-03-28 14:40:50 +01:00
Raphael
998677f79d
feat(includes): adding ping header 2026-03-28 14:40:39 +01:00
Raphael
7f368f9ead
feat(includes): adding debugs/errors macro 2026-03-28 14:40:27 +01:00
Raphael
0ce21d42d5
feat(includes): adding colors.h 2026-03-28 14:40:08 +01:00
4 changed files with 98 additions and 0 deletions

26
includes/color.h Normal file
View file

@ -0,0 +1,26 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* color.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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"

26
includes/macro.h Normal file
View file

@ -0,0 +1,26 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* macro.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/03/24 11:23:47 by rparodi #+# #+# */
/* Updated: 2026/03/24 13:20:48 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include <stdio.h>
#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);}

17
includes/ping.h Normal file
View file

@ -0,0 +1,17 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ping.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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);

29
includes/struct.h Normal file
View file

@ -0,0 +1,29 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* struct.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/03/23 15:06:41 by rparodi #+# #+# */
/* Updated: 2026/03/24 13:30:42 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include <stdbool.h>
#include <stdint.h>
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;