error handling, change -f to -i
This commit is contained in:
45
srcs/ft_ping.c
Normal file
45
srcs/ft_ping.c
Normal file
@ -0,0 +1,45 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_ping.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/26 19:54:25 by tomoron #+# #+# */
|
||||
/* Updated: 2025/04/29 01:43:38 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "includes/ft_ping.h"
|
||||
|
||||
void send_icmp(t_settings set, char *host)
|
||||
{
|
||||
(void)set;
|
||||
(void)host;
|
||||
printf("would send to %s\n", host);
|
||||
}
|
||||
|
||||
void ping_host(t_settings set, char *host)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while(i < set.count || set.count == -1)
|
||||
{
|
||||
send_icmp(set, host);
|
||||
usleep(set.interval * 1000 * 1000);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void send_pings(t_settings set)
|
||||
{
|
||||
t_host_list *cur;
|
||||
|
||||
cur = set.hosts;
|
||||
while(cur)
|
||||
{
|
||||
ping_host(set, cur->host);
|
||||
cur = cur->next;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user