/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* b_export_mute.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rbousset +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */ /* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include #include "b_export.h" #include "b_export_next.h" #include "d_define.h" #include "f_fail.h" #include "s_destroy.h" #include "s_line.h" #include "s_lvars.h" #include "s_struct.h" #include "u_utils.h" #include "u_vars.h" static void b_classic_export_mute(char *ptr[], t_msh *msh) { char varval[4096]; char fmt[4096]; if (check_equals(*ptr) == FALSE) { ft_sprintf(fmt, "$%s", *ptr); u_get_custom_var(varval, fmt, 4096, msh); if (varval[0] != C_NUL) { ft_sprintf(fmt, "%s=%s", *ptr, varval); b_add_to_env_from_globals(*ptr, fmt, msh); } } else if (check_equals(*ptr) == TRUE) { b_export_with_equals(*ptr, msh); } } unsigned char b_export_mute(char *args[], t_msh *msh) { char **ptr; unsigned char r; if (args[0] == NULL) return (0); r = 0; ptr = args; while (*ptr != NULL) { if (check_valid_identifier(*ptr) == FALSE) { r = 1; ptr++; continue ; } b_classic_export_mute(ptr, msh); ptr++; } return (r); }