42_C_PISCINE/Rush/Rush02/ex00/main.c

43 lines
1.4 KiB
C
Raw Permalink Normal View History

2023-05-17 12:45:25 -04:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/31 11:33:20 by cchauvet #+# #+# */
/* Updated: 2022/07/31 21:28:20 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "rush02.h"
int main(int argc, char **argv)
{
t_number *dict;
char **tab;
int i;
i = 1;
if (!(argc >= 2 && argc <= 3))
{
write (1, "Error\n", 6);
return (0);
}
if (argc == 3)
{
i = 2;
if (ft_dict_validator(argv[1]) == 0)
return (0);
dict = ft_dictionnary_reader(argv[1]);
}
else
dict = ft_dictionnary_reader(PATH);
if (dict == NULL || ft_print_errors(argv[i]) == 0)
return (0);
tab = ft_decompose(argv[i]);
ft_printapc(tab, dict);
free(tab);
free(dict);
}