32 if (!ft_isalpha(str[0]) && str[0] !=
'_')
35 while (str[i] && str[i] !=
'=')
39 if (str[i + 1] ==
'=')
44 if (!ft_isalnum(str[i]) && str[i] !=
'_')
58 ft_putstr_fd(
"minishell: export: `", STDERR_FILENO);
59 ft_putstr_fd(arg, STDERR_FILENO);
60 ft_putstr_fd(
"': not a valid identifier\n", STDERR_FILENO);
79 if (ft_strnstr(arg,
"+=", ft_strlen(arg)))
81 else if (ft_strchr(arg,
'='))
static int is_valid_identifier(char *str)
Validate an export identifier (KEY or KEY= or KEY+=)
int builtin_export(char **args, t_env **env)
Implement the export command.
static int export_one(char *arg, t_env **env)
Process an export argument.
static void print_export_error(char *arg)
Print export error.
Shell builtin commands prototypes.
Environment variable management prototypes.
void export_no_value(t_env **env, char *key)
Export a variable with no value (export KEY)
void export_assign(t_env **env, char *arg)
Export a variable with a value (export KEY=value)
void export_append(t_env **env, char *arg)
Export a variable with append (export KEY+=value)
void print_sorted_export(t_env *env)
Print all env vars sorted in alphabetical order, in declare -x format.
Environment variable (doubly linked list)