Compare commits

...

2 commits

Author SHA1 Message Date
Raphael
14e05066cc
style(parsing/sources): using the same error message for empty args
- This message is the same of the ping command (inetutils 2.0).
2026-03-30 19:21:46 +02:00
Raphael
67addc4c1c
style(includes): adding a tabulation to the macro 2026-03-30 19:20:49 +02:00
2 changed files with 8 additions and 8 deletions

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */ /* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2026/03/24 11:23:47 by rparodi #+# #+# */ /* Created: 2026/03/24 11:23:47 by rparodi #+# #+# */
/* Updated: 2026/03/30 12:29:28 by rparodi ### ########.fr */ /* Updated: 2026/03/30 19:18:54 by rparodi ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -19,8 +19,8 @@
# define DEBUG 0 # define DEBUG 0
#endif #endif
#define ERROR_LOG(str) if (DEBUG) {dprintf(2, "%sError:\t%s (%s:%d in %s)%s\n", CLR_RED, str, __FILE_NAME__, __LINE__, __FUNCTION__, CLR_RESET);} else { dprintf(2, "%s\n", str); } #define ERROR_LOG(str) if (DEBUG) {dprintf(2, "%sError:\t\t%s (%s:%d in %s)%s\n", CLR_RED, str, __FILE_NAME__, __LINE__, __FUNCTION__, CLR_RESET);} else { dprintf(2, "%s\n", str); }
#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 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 INFO_LOG(str) if (DEBUG) {dprintf(2, "%sInfo:\t\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 DEBUG_LOG(str) if (DEBUG) {dprintf(2, "%sDebug:\t\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:\t%s (%s:%d in %s)%s\n", CLR_GREEN, str, __FILE_NAME__, __LINE__, __FUNCTION__, CLR_RESET);} #define SUCCESS_LOG(str) if (DEBUG) {dprintf(2, "%sSuccess:\t%s (%s:%d in %s)%s\n", CLR_GREEN, str, __FILE_NAME__, __LINE__, __FUNCTION__, CLR_RESET);}

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */ /* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2026/03/23 14:49:36 by rparodi #+# #+# */ /* Created: 2026/03/23 14:49:36 by rparodi #+# #+# */
/* Updated: 2026/03/30 15:53:23 by rparodi ### ########.fr */ /* Updated: 2026/03/30 19:07:53 by rparodi ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -29,8 +29,8 @@ static char *_find_target(int argc, char **argv) {
} }
} }
if (target == NULL || target[0] == '\0') { if (target == NULL) {
ERROR_LOG("ft_ping: missing host operand \n Try 'ft_ping --help' or 'ft_ping --usage' for more information."); ERROR_LOG("ft_ping: missing host operand\nTry 'ft_ping --help' or 'ft_ping --usage' for more information.");
exit(64); exit(64);
} }
@ -40,7 +40,7 @@ static char *_find_target(int argc, char **argv) {
void parsing_args(int argc, char **argv, t_flags *flags) void parsing_args(int argc, char **argv, t_flags *flags)
{ {
if (argc == 1) { if (argc == 1) {
ERROR_LOG("ft_ping: missing host operand \n Try 'ft_ping --help' or 'ft_ping --usage' for more information."); ERROR_LOG("ft_ping: missing host operand\nTry 'ft_ping --help' or 'ft_ping --usage' for more information.");
exit(64); exit(64);
} }