norm
This commit is contained in:
parent
01722c4e21
commit
6184e4e982
1 changed files with 27 additions and 21 deletions
|
@ -6,42 +6,48 @@
|
||||||
/* By: jschaft <cecile.schaft@orange.fr> +#+ +:+ +#+ */
|
/* By: jschaft <cecile.schaft@orange.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/07/03 18:57:19 by jschaft #+# #+# */
|
/* Created: 2024/07/03 18:57:19 by jschaft #+# #+# */
|
||||||
/* Updated: 2024/07/04 11:58:06 by mcolonna ### ########.fr */
|
/* Updated: 2024/07/04 12:19:08 by mcolonna ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "include.h"
|
#include "include.h"
|
||||||
|
|
||||||
|
static void export_print_builtin_loop(char *const var, int std[2])
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char c[2];
|
||||||
|
|
||||||
|
c[1] = '\0';
|
||||||
|
i = 0;
|
||||||
|
print_str(fatal_error, std[1], "declare -x ");
|
||||||
|
while (var[i] != '=')
|
||||||
|
{
|
||||||
|
c[0] = var[i];
|
||||||
|
print_str(fatal_error, std[1], c);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
print_str(fatal_error, std[1], "=\"");
|
||||||
|
i++;
|
||||||
|
while (var[i])
|
||||||
|
{
|
||||||
|
c[0] = var[i];
|
||||||
|
print_str(fatal_error, std[1], c);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
print_str(fatal_error, std[1], "\"\n");
|
||||||
|
}
|
||||||
|
|
||||||
int export_print_builtin(t_env *env, t_call call, int std[2])
|
int export_print_builtin(t_env *env, t_call call, int std[2])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int i2;
|
|
||||||
const t_memclass mc = mem_subclass(fatal_error, env->mc_global);
|
const t_memclass mc = mem_subclass(fatal_error, env->mc_global);
|
||||||
char *const *envp = variables_envp(env->variables, mc);
|
char *const *envp = variables_envp(env->variables, mc);
|
||||||
char c[2];
|
|
||||||
|
|
||||||
(void)call;
|
(void)call;
|
||||||
i = 0;
|
i = 0;
|
||||||
c[1] = '\0';
|
|
||||||
while (envp[i])
|
while (envp[i])
|
||||||
{
|
{
|
||||||
i2 = 0;
|
export_print_builtin_loop(envp[i], std);
|
||||||
print_str(fatal_error, std[1], "declare -x ");
|
|
||||||
while (envp[i][i2] != '=')
|
|
||||||
{
|
|
||||||
c[0] = envp[i][i2];
|
|
||||||
print_str(fatal_error, std[1], c);
|
|
||||||
i2++;
|
|
||||||
}
|
|
||||||
print_str(fatal_error, std[1], "=\"");
|
|
||||||
i2++;
|
|
||||||
while (envp[i][i2])
|
|
||||||
{
|
|
||||||
c[0] = envp[i][i2];
|
|
||||||
print_str(fatal_error, std[1], c);
|
|
||||||
i2++;
|
|
||||||
}
|
|
||||||
print_str(fatal_error, std[1], "\"\n");
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue