/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* help.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2026/03/28 12:38:44 by rparodi #+# #+# */ /* Updated: 2026/03/28 15:23:53 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ #include #include #include #include "parsing.h" void print_help(size_t size) { dprintf(2, "Usage: ./ft_ping [OPTION...] HOST ...\nSend ICMP ECHO_REQUEST packets to network hosts.\n\n"); dprintf(2, "Options:\n"); for (size_t i = 0; i < size; i++) if (_flags[i].is_mandatory != false || BONUS == 1) { if (isprint(_flags[i].short_option)) dprintf(2, "\t-%c, --%-15s%-15s%-15s\n", _flags[i].short_option, (_flags[i].long_option ? _flags[i].long_option : ""), (_flags[i].usage ? _flags[i].usage : ""), _flags[i].description); else dprintf(2, "\t --%-15s%-15s%-15s\n", (_flags[i].long_option ? _flags[i].long_option : ""), (_flags[i].usage ? _flags[i].usage : ""), _flags[i].description); } }