error handling, change -f to -i

This commit is contained in:
2025-04-29 02:09:18 +02:00
parent 4e344d945e
commit 208dcad657
4 changed files with 98 additions and 11 deletions

45
srcs/ft_ping.c Normal file
View 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;
}
}