add -? arg support
This commit is contained in:
@ -32,7 +32,7 @@ Send ICMP ECHO_REQUEST packets to network hosts.\n\
|
||||
-W, --linger=N Number of seconds to wait for response\n\
|
||||
-v, --verbose Enable verbose mode\n\
|
||||
\n\
|
||||
-h, --help Print this usage info\n"
|
||||
-h, -?, --help Print this usage info\n"
|
||||
|
||||
extern int g_stop;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/26 17:01:53 by tomoron #+# #+# */
|
||||
/* Updated: 2025/08/15 02:16:12 by tomoron ### ########.fr */
|
||||
/* Updated: 2025/08/18 15:50:29 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
#include "includes/ft_ping.h"
|
||||
@ -76,6 +76,7 @@ int check_values(t_settings *set, char *name)
|
||||
void init_settings(t_settings *set)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
tmp = set->name;
|
||||
bzero(set, sizeof(t_settings));
|
||||
set->name = tmp;
|
||||
@ -100,6 +101,14 @@ int parse_args(int argc, char **argv, t_settings *set)
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
for(int i = 1; i < argc; i++)
|
||||
{
|
||||
if(!strcmp(argv[i], "-?"))
|
||||
{
|
||||
show_help(set);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
unsetenv("POSIXLY_CORRECT");
|
||||
init_settings(set);
|
||||
|
Reference in New Issue
Block a user