42 push_swap group project
0

Configure Feed

Select the types of activity you want to include in your feed.

fix: parse args in stringified args

gvoelkne (Jun 8, 2026, 9:30 AM +0200) bf90e486 03bc1e30

+10 -8
+2 -2
parse_args.c
··· 6 6 /* By: gvoelkne <marvin@42.fr> +#+ +:+ +#+ */ 7 7 /* +#+#+#+#+#+ +#+ */ 8 8 /* Created: 2026/06/01 00:00:00 by gvoelkne #+# #+# */ 9 - /* Updated: 2026/06/01 00:00:00 by gvoelkne ### ########.fr */ 9 + /* Updated: 2026/06/08 09:14:55 by gvoelkne ### ########.fr */ 10 10 /* */ 11 11 /* ************************************************************************** */ 12 12 ··· 48 48 49 49 if (is_flag(arg)) 50 50 return (parse_flag(prog_args, arg)); 51 - parsed_nums = parse_nums_to_list(arg); 51 + parsed_nums = parse_nums_to_list(prog_args, arg); 52 52 if (!parsed_nums) 53 53 return (0); 54 54 if (!concat_nums(&(prog_args->nums), parsed_nums))
+6 -4
parse_nums.c
··· 6 6 /* By: gvoelkne <marvin@42.fr> +#+ +:+ +#+ */ 7 7 /* +#+#+#+#+#+ +#+ */ 8 8 /* Created: 2026/06/01 00:00:00 by gvoelkne #+# #+# */ 9 - /* Updated: 2026/06/01 00:00:00 by gvoelkne ### ########.fr */ 9 + /* Updated: 2026/06/08 09:14:07 by gvoelkne ### ########.fr */ 10 10 /* */ 11 11 /* ************************************************************************** */ 12 12 ··· 36 36 return (0); 37 37 } 38 38 39 - static int parse_one_token(t_node **head, char **splits, int idx) 39 + static int parse_one_token(t_args *args, t_node **head, char **splits, int idx) 40 40 { 41 41 int *num; 42 42 t_node *node; 43 43 44 + if (is_flag(splits[idx])) 45 + return (parse_flag(args, splits[idx])); 44 46 num = ft_atoi(splits[idx]); 45 47 if (!num) 46 48 return (0); ··· 57 59 return (1); 58 60 } 59 61 60 - t_node *parse_nums_to_list(char *nums_str) 62 + t_node *parse_nums_to_list(t_args *args, char *nums_str) 61 63 { 62 64 int idx; 63 65 t_node *head; ··· 72 74 return (NULL); 73 75 while (splits && splits[idx]) 74 76 { 75 - if (!parse_one_token(&head, splits, idx)) 77 + if (!parse_one_token(args, &head, splits, idx)) 76 78 return (free_split(splits), lst_clear(&head)); 77 79 idx++; 78 80 }
+2 -2
push_swap.h
··· 6 6 /* By: jkrishna <jkrishna@student.42.fr> +#+ +:+ +#+ */ 7 7 /* +#+#+#+#+#+ +#+ */ 8 8 /* Created: 2026/04/20 13:29:44 by gvoelkne #+# #+# */ 9 - /* Updated: 2026/06/02 15:01:12 by gvoelkne ### ########.fr */ 9 + /* Updated: 2026/06/08 09:11:47 by gvoelkne ### ########.fr */ 10 10 /* */ 11 11 /* ************************************************************************** */ 12 12 ··· 158 158 int stk_early_exit(t_node **a, t_stack_ops *ops); 159 159 char *algo_config_to_str(t_algo_config config); 160 160 int print_benchmark(t_bench_stats stats); 161 - t_node *parse_nums_to_list(char *nums_str); 161 + t_node *parse_nums_to_list(t_args *args, char *nums_str); 162 162 int concat_nums(t_node **a, t_node *b); 163 163 void *free_args(t_args args); 164 164 int is_flag(char *str);