This commit is contained in:
Alexandre POMMIER 2022-01-19 19:02:33 +01:00
parent 05b259f57b
commit c4fd38a1ac
5 changed files with 31 additions and 6 deletions

View File

@ -6,7 +6,7 @@
# By: apommier <apommier@student.42.fr> +#+ +:+ +#+ # # By: apommier <apommier@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2021/11/13 13:06:47 by apommier #+# #+# # # Created: 2021/11/13 13:06:47 by apommier #+# #+# #
# Updated: 2022/01/19 05:41:28 by apommier ### ########.fr # # Updated: 2022/01/19 18:49:46 by apommier ### ########.fr #
# # # #
# **************************************************************************** # # **************************************************************************** #
@ -50,7 +50,7 @@ bonus:${BONUS_O}
gcc -g ${CFLAGS} ${BONUS_O} ${LIBFT}/libft.a gcc -g ${CFLAGS} ${BONUS_O} ${LIBFT}/libft.a
mv a.out checker mv a.out checker
all: ${NAME} all: ${NAME} bonus
clean: clean:
${RM} ${OBJS} ${RM} ${OBJS}

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */ /* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/25 23:10:37 by apommier #+# #+# */ /* Created: 2021/11/25 23:10:37 by apommier #+# #+# */
/* Updated: 2022/01/19 18:33:54 by apommier ### ########.fr */ /* Updated: 2022/01/19 19:01:19 by apommier ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */ /* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/25 23:15:17 by apommier #+# #+# */ /* Created: 2021/11/25 23:15:17 by apommier #+# #+# */
/* Updated: 2022/01/19 18:38:00 by apommier ### ########.fr */ /* Updated: 2022/01/19 18:45:38 by apommier ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -23,6 +23,7 @@ typedef struct procest_slist
struct procest_slist *next; struct procest_slist *next;
} t_slist; } t_slist;
int max_int(t_list *start);
int push_swap(int nbrarg, char **list); int push_swap(int nbrarg, char **list);
int is_nbr(int nbrarg, char **list, int i); int is_nbr(int nbrarg, char **list, int i);
t_list *set_list(int nbrarg, char **list); t_list *set_list(int nbrarg, char **list);

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */ /* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/18 02:14:22 by apommier #+# #+# */ /* Created: 2022/01/18 02:14:22 by apommier #+# #+# */
/* Updated: 2022/01/19 06:10:06 by apommier ### ########.fr */ /* Updated: 2022/01/19 18:56:16 by apommier ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -31,3 +31,22 @@ int do_move2(t_list **lst, t_list **lst_b, t_slist *a, t_slist **delete)
s_lstclear(delete); s_lstclear(delete);
return (1); return (1);
} }
int max_int(t_list *start)
{
long long swap;
t_list *lst;
lst = start;
swap = 0;
while (start)
{
swap = *(long long *)start->nbr;
if (swap > 2147483647 || swap < -2147483648)
{
return (1);
}
start = start->next;
}
return (0);
}

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */ /* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/17 21:29:45 by apommier #+# #+# */ /* Created: 2022/01/17 21:29:45 by apommier #+# #+# */
/* Updated: 2022/01/19 06:07:41 by apommier ### ########.fr */ /* Updated: 2022/01/19 18:58:47 by apommier ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -78,6 +78,11 @@ int checker(t_slist *action, t_list **a)
t_list *lst_b; t_list *lst_b;
int lst_size; int lst_size;
if (max_int(*a))
{
ft_putstr_fd("Error\n", 2);
return (0);
}
lst_size = ft_lstsize(*a); lst_size = ft_lstsize(*a);
lst_b = 0; lst_b = 0;
action = verify_list(action); action = verify_list(action);