replace parsing to use getopt (safer), change count opt behavior, close socket when needed

This commit is contained in:
2025-08-15 02:17:19 +02:00
parent c230dc6d86
commit 01c4d7cc51
6 changed files with 110 additions and 125 deletions

View File

@ -6,7 +6,7 @@
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/26 19:54:25 by tomoron #+# #+# */
/* Updated: 2025/06/02 22:10:42 by tomoron ### ########.fr */
/* Updated: 2025/08/13 16:59:55 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -83,7 +83,7 @@ int ping_host(t_settings *set, char *host)
wl = 0;
inet_ntop(info->ai_family, (void *)&((struct sockaddr_in *)(info->ai_addr))->sin_addr, set->current_ip, sizeof(set->current_ip));
ping_start_print(set, host);
while((seq < set->count || set->count == -1) && !g_stop)
while((seq < set->count || set->count == 0) && !g_stop)
{
tmp = send_icmp(set, info, &seq, &last_sent, &stats);
if(tmp)