-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
77 lines (67 loc) · 2.12 KB
/
Copy pathmain.c
File metadata and controls
77 lines (67 loc) · 2.12 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: iziane <iziane@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/05 18:45:32 by iziane #+# #+# */
/* Updated: 2024/05/23 06:50:29 by iziane ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
//TODO:
// void check(t_node **tail_a, t_node **tail_b);
// void foo(void)
// {
// system("leaks push_swap");
// }
// int ft_space_checker(const char *str)
// {
// int counter;
// counter = 0;
// if (ft_strncmp(str, "", ft_strlen(str)))
// return (0);
// while (str && str[counter] && str[counter] != '\0')
// {
// if (str[counter] != ' ' || str[counter] != '\t')
// return (1);
// counter++;
// }
// return (0);
// }
//For System-> leaks atexit(foo);
int main(int argc, char **argv)
{
int *array;
int *sorted_array;
int amount_words;
if (argc == 2 && !pre_atoi(argv[1]))
{
write (1, "Error\n", 6);
exit (1);
}
if ((argc <= 1)
|| ((argc == 2 && ft_space_checker(argv[1]) && !pre_atoi(argv[1]))))
return (0);
amount_words = number_counter(argv);
parcer(argv, amount_words);
array = make_array(&amount_words, argv);
sorted_array = array_dub(array, amount_words);
sort_array(sorted_array, amount_words);
list_manager(array, amount_words, sorted_array);
free(array);
free(sorted_array);
array = NULL;
sorted_array = NULL;
return (0);
}
// int main(void)
// {
// char *test;
// test = malloc(1);
// (void)test;
// test = NULL;
// // free(test);
// }
// ft_strncmp(argv[1], "", ft_strlen(argv[1])))))