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/24 22:49:22 by tomoron #+# #+# */
/* Updated: 2025/08/08 22:19:52 by tomoron ### ########.fr */
/* Updated: 2025/08/13 16:35:29 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
#include "includes/ft_ping.h"
@ -125,7 +125,7 @@ void ttl_exceeded(t_icmp_ip_reply *res,t_settings *settings, size_t len)
sent->header.ttl, sent->header.protocol, htons(sent->header.check),\
convert_ip(sent->header.saddr));
printf(" %s\nICMP: ", convert_ip(sent->header.daddr));
printf("type %d, code %d, size %zu, id 0x%04x, seq 0x%04x\n", sent->icmp.type, sent->icmp.code, sent->header.tot_len - sizeof(struct iphdr), sent->icmp.identifier, sent->icmp.sequence);
printf("type %d, code %d, size %zu, id 0x%04x, seq 0x%04x\n", sent->icmp.type, sent->icmp.code, htons(sent->header.tot_len) - sizeof(struct iphdr), sent->icmp.identifier, sent->icmp.sequence);
}