static int deal_with_arg(t_shell *sh, char **arg, char **env_cpy) { char **res; char *cmd; res = NULL; if (cmp_line(arg, env_cpy) == 0) { if (check_caract(*arg, '=') < 0) return (print_wrong_identifier_env(*arg)); else if (check_caract(*arg, '=') != 1) { cmd = join_tab(arg); exec_env(sh, cmd, env_cpy); free(cmd); return (sh->return_val); } else if (check_caract(*arg, '=') == 1) { res = add_elem(env_cpy, *arg); ft_print_tab(res); ft_free_tab(res); return (0); } } ft_print_tab(env_cpy); return (0); }
static void cmp_buffer(const void *buf1, const void *buf2, unsigned int len) { unsigned int i; for (i = 0; i < len; i += 16) { if (!cmp_line(i, buf1 + i, buf2 + i, min(len - i, 16u))) continue; pr_info("Expected:\n"); print_line(i, buf2 + i, min(len - i, 16u)); } }