norm
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/03/26 09:06:51 by marde-vr #+# #+# */
|
||||
/* Updated: 2024/05/07 17:26:43 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/05/08 12:31:54 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -81,7 +81,7 @@ void parse_var(t_msh *msh, char *line)
|
||||
|
||||
void remove_here_doc_file(t_msh *msh)
|
||||
{
|
||||
if(msh->here_doc_filename)
|
||||
if (msh->here_doc_filename)
|
||||
{
|
||||
unlink(msh->here_doc_filename);
|
||||
free(msh->here_doc_filename);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/04 17:31:38 by tomoron #+# #+# */
|
||||
/* Updated: 2024/05/08 11:56:37 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/05/08 11:58:45 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -81,7 +81,7 @@ typedef struct s_msh
|
||||
extern int g_return_code;
|
||||
|
||||
int get_in_type(t_msh *msh, t_cmd *t_strt, t_cmd *tokens, int here_doc);
|
||||
int add_var_to_str(char *res, char **cmd, t_env *env, int quote, int *i_v);
|
||||
int add_var_to_str(char *res, char **cmd, t_env *env, int quote);
|
||||
t_env *export_set_env(t_env *env, char *name, char *value, int append);
|
||||
t_env *env_add_back(t_env *env, char *name, char *value, int empty);
|
||||
void parent(t_msh *msh, int i, int cmd_count, char **cmd_args);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/09 15:24:36 by tomoron #+# #+# */
|
||||
/* Updated: 2024/05/08 11:55:37 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/05/08 11:59:25 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -85,7 +85,7 @@ int invalid_variable_char(char *res, char c)
|
||||
return (2);
|
||||
}
|
||||
|
||||
int add_var_to_str(char *res, char **command, t_env *env, int dquote, int *i_v)
|
||||
int add_var_to_str(char *res, char **command, t_env *env, int dquote)
|
||||
{
|
||||
char *var_name;
|
||||
char *var;
|
||||
@ -93,7 +93,6 @@ int add_var_to_str(char *res, char **command, t_env *env, int dquote, int *i_v)
|
||||
|
||||
i = 0;
|
||||
(*command)++;
|
||||
*i_v = 1;
|
||||
if (**command == '\'' || **command == '"' || !**command)
|
||||
{
|
||||
if ((**command != '\'' && **command != '"') || dquote)
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/06 10:57:33 by tomoron #+# #+# */
|
||||
/* Updated: 2024/05/08 11:54:17 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/05/08 12:29:17 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
#include "minishell.h"
|
||||
@ -54,8 +54,8 @@ char *expand_variables(char *command, t_env *env, int *is_var)
|
||||
in_quote = !in_quote;
|
||||
if (*command == '"' && !in_quote)
|
||||
in_dquote = !in_dquote;
|
||||
if (*command == '$' && !in_quote)
|
||||
i += add_var_to_str(res + i, &command, env, in_dquote, is_var);
|
||||
if (*command == '$' && !in_quote && ++(*is_var))
|
||||
i += add_var_to_str(res + i, &command, env, in_dquote);
|
||||
else
|
||||
res[i++] = *command;
|
||||
command++;
|
||||
|
Reference in New Issue
Block a user