-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhack.c
29 lines (27 loc) · 1.23 KB
/
hack.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* hack.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ihermell <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/12/04 17:24:59 by ihermell #+# #+# */
/* Updated: 2014/12/04 17:27:13 by ihermell ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_ls.h"
int ft_sort_hack(t_data *start, t_data *data_lst,
int (*f)(t_data *, t_data *))
{
if (g_flags[FLAG_R] && f(start, data_lst) < 0)
{
lst_insert_before(lst_copy_data(data_lst), start);
return (1);
}
else if (!g_flags[FLAG_R] && f(start, data_lst) > 0)
{
lst_insert_before(lst_copy_data(data_lst), start);
return (1);
}
return (0);
}