/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/18 10:16:14 by cacharle #+# #+# */ /* Updated: 2021/09/10 10:33:05 by charles ### ########.fr */ /* */ /* ************************************************************************** */ #include "checker.h" int main(int argc, char **argv) { t_status s; t_stack *a; t_stack *b; if (argc == 1) return (0); a = stack_new(argc - 1); if (a == NULL) return (1); if (parse(argc, argv, a) != STATUS_SUCCESS) return (1); b = stack_new(stack_length(a)); if (b == NULL) return (stack_destroy(a)); s = check(a, b); if (s == STATUS_SUCCESS) ft_putendl("OK"); else if (s == STATUS_FAILURE) ft_putendl("KO"); else if (s == STATUS_ERROR) ft_putendl_fd("Error", STDERR_FILENO); stack_destroy(a); stack_destroy(b); return (0); }