linger flag seems to work now

This commit is contained in:
2025-05-22 23:30:01 +02:00
parent 94085f5bb2
commit 64ac4ba5e0
4 changed files with 21 additions and 18 deletions

View File

@ -6,7 +6,7 @@
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/26 17:01:53 by tomoron #+# #+# */
/* Updated: 2025/04/30 00:17:50 by tomoron ### ########.fr */
/* Updated: 2025/05/22 23:01:05 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
#include "includes/ft_ping.h"
@ -99,7 +99,7 @@ void parse_opt(int *i, t_settings *set, int argc, char **argv)
else if(!strcmp(argv[*i], "-w") || !strncmp(argv[*i], "--timeout", 9))
set->timeout = get_set_int(i, argc, argv, 9, set);
else if(!strcmp(argv[*i], "-W") || !strncmp(argv[*i], "--linger", 8))
set->timeout = get_set_int(i, argc, argv, 8, set);
set->linger = get_set_int(i, argc, argv, 8, set);
else if(!strcmp(argv[*i], "-i") || !strncmp(argv[*i], "--interval", 10))
set->interval = get_set_float(i, argc, argv, 10, set);
else if(!strncmp(argv[*i], "--ttl", 5))
@ -147,6 +147,7 @@ t_settings parse_args(int argc, char **argv)
res.count = -1;
res.timeout = -1;
res.interval = 1;
res.linger = 10;
while(i < argc)
{
if(*argv[i] == '-')