shlvl_init(), set SHLVL
+ export builtin small change
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
static int export_var(char *arg);
|
||||
static int change_var_value(char *arg, char *var_name);
|
||||
|
||||
#define ERR_ID 1
|
||||
@@ -32,7 +31,7 @@ int builtin_export(int argc, char *argv[], t_all *c)
|
||||
{
|
||||
ret = export_var(argv[i]);
|
||||
if (ret == -1)
|
||||
return (EXIT_FAILURE);
|
||||
return (ft_reti_perror(EXIT_FAILURE, CMD", export_var()"));
|
||||
else if (ret == ERR_ID)
|
||||
exit_value = EXIT_FAILURE;
|
||||
if (ft_strncmp(argv[i], "PATH=", 5) == 0)
|
||||
@@ -44,7 +43,9 @@ int builtin_export(int argc, char *argv[], t_all *c)
|
||||
|
||||
// in complete shell, must mark arguments for export
|
||||
// (Not implemented in minishell)
|
||||
static int export_var(char *arg)
|
||||
// arg == var_name[=value]
|
||||
// return "-1" on alloc error
|
||||
int export_var(char *arg)
|
||||
{
|
||||
char **var_split;
|
||||
int ret;
|
||||
@@ -52,7 +53,7 @@ static int export_var(char *arg)
|
||||
ret = 0;
|
||||
var_split = ft_split(arg, '=');
|
||||
if (!var_split)
|
||||
return (ft_reti_perror(-1, CMD", ft_split()"));
|
||||
return (-1);
|
||||
if (!ft_is_posix_name(var_split[0]))
|
||||
{
|
||||
shell_error("export: ", var_split[0], ERR_ID_STR, 0);
|
||||
|
||||
Reference in New Issue
Block a user