renamed functions to improve readability and removed useless test files
This commit is contained in:
20
Makefile
20
Makefile
@ -3,24 +3,24 @@
|
||||
# ::: :::::::: #
|
||||
# Makefile :+: :+: :+: #
|
||||
# +:+ +:+ +:+ #
|
||||
# By: tomoron <marvin@42.fr> +#+ +:+ +#+ #
|
||||
# By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2023/07/28 00:35:01 by tomoron #+# #+# #
|
||||
# Updated: 2024/02/09 18:32:31 by tomoron ### ########.fr #
|
||||
# Updated: 2024/02/13 16:22:36 by marde-vr ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
CC = cc
|
||||
|
||||
SRCS = main.c\
|
||||
ft_lst_cmd.c\
|
||||
ft_lst_env.c\
|
||||
ft_exec.c\
|
||||
ft_exit.c\
|
||||
ft_echo.c\
|
||||
ft_pwd.c\
|
||||
ft_parsing.c\
|
||||
ft_parsing_var.c
|
||||
lst_cmd.c\
|
||||
lst_env.c\
|
||||
exec.c\
|
||||
exit.c\
|
||||
echo.c\
|
||||
pwd.c\
|
||||
parsing.c\
|
||||
parsing_var.c
|
||||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
|
@ -1,18 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_echo.c :+: :+: :+: */
|
||||
/* echo.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/07 15:30:37 by tomoron #+# #+# */
|
||||
/* Updated: 2024/02/09 14:56:57 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/02/13 16:11:20 by marde-vr ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
int ft_echo(t_cmd *args)
|
||||
int echo(t_cmd *args)
|
||||
{
|
||||
int put_nl;
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_exec.c :+: :+: :+: */
|
||||
/* exec.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/07 14:12:49 by tomoron #+# #+# */
|
||||
/* Updated: 2024/02/12 14:46:37 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/02/13 16:23:01 by marde-vr ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -15,21 +15,21 @@
|
||||
int exec_builtin(t_cmd *parsed_cmd, t_env *env)
|
||||
{
|
||||
if (!ft_strcmp(parsed_cmd->token, "echo"))
|
||||
g_return_code = ft_echo(parsed_cmd->next);
|
||||
g_return_code = echo(parsed_cmd->next);
|
||||
else if (!ft_strcmp(parsed_cmd->token, "ret"))
|
||||
g_return_code = ft_atoi(parsed_cmd->next->token);
|
||||
else if (!ft_strcmp(parsed_cmd->token, "env"))
|
||||
g_return_code = ft_print_env(env);
|
||||
g_return_code = print_env(env);
|
||||
else if (!ft_strcmp(parsed_cmd->token, "exit"))
|
||||
ft_exit(parsed_cmd, env);
|
||||
else if (!ft_strcmp(parsed_cmd->token, "pwd"))
|
||||
g_return_code = ft_pwd();
|
||||
g_return_code = pwd();
|
||||
else
|
||||
return (STDIN_FILENO);
|
||||
return (STDOUT_FILENO);
|
||||
}
|
||||
|
||||
void ft_exec_command(t_cmd *parsed_cmd, t_env *env)
|
||||
void exec_command(t_cmd *parsed_cmd, t_env *env)
|
||||
{
|
||||
if (!parsed_cmd || exec_builtin(parsed_cmd, env))
|
||||
return ;
|
@ -1,18 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_exit.c :+: :+: :+: */
|
||||
/* exit.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/07 16:04:11 by tomoron #+# #+# */
|
||||
/* Updated: 2024/02/12 20:11:51 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/02/13 16:24:18 by marde-vr ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
void ft_print_numeric_arg_err(char *arg)
|
||||
void print_numeric_arg_err(char *arg)
|
||||
{
|
||||
ft_putstr_fd("minishell: exit: ", 2);
|
||||
ft_putstr_fd(arg, 2);
|
||||
@ -32,15 +32,15 @@ void ft_exit(t_cmd *args, t_env *env)
|
||||
else
|
||||
{
|
||||
if (args && !ft_strisnbr(args->token))
|
||||
ft_print_numeric_arg_err(args->token);
|
||||
print_numeric_arg_err(args->token);
|
||||
if (args)
|
||||
exit_code = (unsigned char)ft_atoi(args->token);
|
||||
else if (args && !ft_strisnbr(args->token))
|
||||
exit_code = 2;
|
||||
else
|
||||
exit_code = g_return_code;
|
||||
ft_free_cmd(start);
|
||||
ft_free_env(env);
|
||||
free_cmd(start);
|
||||
free_env(env);
|
||||
exit(exit_code);
|
||||
}
|
||||
}
|
@ -1,18 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_lst_cmd.c :+: :+: :+: */
|
||||
/* lst_cmd.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/06 20:46:19 by tomoron #+# #+# */
|
||||
/* Updated: 2024/02/11 22:54:28 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/02/13 16:13:01 by marde-vr ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
t_cmd *ft_cmd_add_back(t_cmd *cmd, char *token, t_token_type type)
|
||||
t_cmd *cmd_add_back(t_cmd *cmd, char *token, t_token_type type)
|
||||
{
|
||||
t_cmd *res;
|
||||
t_cmd *current;
|
||||
@ -31,10 +31,10 @@ t_cmd *ft_cmd_add_back(t_cmd *cmd, char *token, t_token_type type)
|
||||
return (cmd);
|
||||
}
|
||||
|
||||
void ft_free_cmd(t_cmd *cmd)
|
||||
void free_cmd(t_cmd *cmd)
|
||||
{
|
||||
if (cmd && cmd->next)
|
||||
ft_free_cmd(cmd->next);
|
||||
free_cmd(cmd->next);
|
||||
if (cmd)
|
||||
free(cmd->token);
|
||||
free(cmd);
|
@ -1,18 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_lst_env.c :+: :+: :+: */
|
||||
/* lst_env.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/06 20:46:19 by tomoron #+# #+# */
|
||||
/* Updated: 2024/02/09 15:24:59 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/02/13 16:21:41 by marde-vr ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
t_env *ft_env_add_back(t_env *env, char *name, char *value)
|
||||
t_env *env_add_back(t_env *env, char *name, char *value)
|
||||
{
|
||||
t_env *res;
|
||||
t_env *current;
|
||||
@ -31,10 +31,10 @@ t_env *ft_env_add_back(t_env *env, char *name, char *value)
|
||||
return (env);
|
||||
}
|
||||
|
||||
void ft_free_env(t_env *env)
|
||||
void free_env(t_env *env)
|
||||
{
|
||||
if (env && env->next)
|
||||
ft_free_env(env->next);
|
||||
free_env(env->next);
|
||||
if (env)
|
||||
{
|
||||
free(env->name);
|
||||
@ -43,7 +43,7 @@ void ft_free_env(t_env *env)
|
||||
free(env);
|
||||
}
|
||||
|
||||
int ft_print_env(t_env *env)
|
||||
int print_env(t_env *env)
|
||||
{
|
||||
while (env)
|
||||
{
|
||||
@ -53,7 +53,7 @@ int ft_print_env(t_env *env)
|
||||
return (0);
|
||||
}
|
||||
|
||||
char *ft_getenv(t_env *env, char *name)
|
||||
char *ft_get_env(t_env *env, char *name)
|
||||
{
|
||||
while (env)
|
||||
{
|
20
main.c
20
main.c
@ -3,10 +3,10 @@
|
||||
/* ::: :::::::: */
|
||||
/* main.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/02 21:59:20 by tomoron #+# #+# */
|
||||
/* Updated: 2024/02/12 14:53:26 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/02/13 16:16:46 by marde-vr ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -31,7 +31,7 @@ char *get_prompt(void)
|
||||
return (res);
|
||||
}
|
||||
|
||||
t_env *ft_get_env(char **envp)
|
||||
t_env *get_env(char **envp)
|
||||
{
|
||||
t_env *env;
|
||||
char *name;
|
||||
@ -50,9 +50,9 @@ t_env *ft_get_env(char **envp)
|
||||
j++;
|
||||
name = ft_substr(*envp, 0, i);
|
||||
value = ft_substr(*envp, i + 1, j);
|
||||
env = ft_env_add_back(env, name, value);
|
||||
env = env_add_back(env, name, value);
|
||||
if (!name || !value)
|
||||
ft_free_env(env);
|
||||
free_env(env);
|
||||
if (!name || !value)
|
||||
return (0);
|
||||
envp++;
|
||||
@ -70,7 +70,7 @@ int main(int argc, char **argv, char **envp)
|
||||
command = (char *)STDOUT_FILENO;
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
env = ft_get_env(envp);
|
||||
env = get_env(envp);
|
||||
while (env && command)
|
||||
{
|
||||
prompt = get_prompt();
|
||||
@ -79,12 +79,12 @@ int main(int argc, char **argv, char **envp)
|
||||
command = readline(prompt);
|
||||
free(prompt);
|
||||
add_history(command);
|
||||
parsed_cmd = ft_parse_command(command, env);
|
||||
parsed_cmd = parse_command(command, env);
|
||||
free(command);
|
||||
ft_exec_command(parsed_cmd, env);
|
||||
ft_free_cmd(parsed_cmd);
|
||||
exec_command(parsed_cmd, env);
|
||||
free_cmd(parsed_cmd);
|
||||
}
|
||||
rl_clear_history();
|
||||
ft_free_env(env);
|
||||
free_env(env);
|
||||
return (g_return_code);
|
||||
}
|
||||
|
30
minishell.h
30
minishell.h
@ -3,10 +3,10 @@
|
||||
/* ::: :::::::: */
|
||||
/* minishell.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/04 17:31:38 by tomoron #+# #+# */
|
||||
/* Updated: 2024/02/13 15:49:02 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/02/13 16:21:55 by marde-vr ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -42,19 +42,19 @@ typedef struct s_env
|
||||
|
||||
extern int g_return_code;
|
||||
|
||||
t_cmd *ft_cmd_add_back(t_cmd *res, char *token, t_token_type type);
|
||||
void ft_free_cmd(t_cmd *cmd);
|
||||
void ft_exec_command(t_cmd *cmd, t_env *env);
|
||||
int ft_echo(t_cmd *args);
|
||||
t_cmd *cmd_add_back(t_cmd *res, char *token, t_token_type type);
|
||||
void free_cmd(t_cmd *cmd);
|
||||
void exec_command(t_cmd *cmd, t_env *env);
|
||||
int echo(t_cmd *args);
|
||||
void ft_exit(t_cmd *args, t_env *env);
|
||||
t_env *ft_env_add_back(t_env *env, char *name, char *value);
|
||||
void ft_free_env(t_env *env);
|
||||
int ft_print_env(t_env *env);
|
||||
t_cmd *ft_parse_command(char *command, t_env *env);
|
||||
int ft_get_token_len(char *cmd, t_env *env);
|
||||
int ft_add_var_to_str(char *res, char **command, t_env *env);
|
||||
t_env *env_add_back(t_env *env, char *name, char *value);
|
||||
void free_env(t_env *env);
|
||||
int print_env(t_env *env);
|
||||
t_cmd *parse_command(char *command, t_env *env);
|
||||
int get_token_len(char *cmd, t_env *env);
|
||||
int add_var_to_str(char *res, char **command, t_env *env);
|
||||
int get_var_name_len(char *command);
|
||||
char *ft_getenv(t_env *env, char *var_name);
|
||||
int ft_pwd(void);
|
||||
int ft_is_cmd_char(char c);
|
||||
char *ft_get_env(t_env *env, char *var_name);
|
||||
int pwd(void);
|
||||
int is_cmd_char(char c);
|
||||
#endif
|
||||
|
@ -1,22 +1,22 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_parsing.c :+: :+: :+: */
|
||||
/* parsing.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/09 15:26:01 by tomoron #+# #+# */
|
||||
/* Updated: 2024/02/13 15:50:08 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/02/13 16:25:15 by marde-vr ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
#include "minishell.h"
|
||||
|
||||
int ft_is_cmd_char(char c)
|
||||
int is_cmd_char(char c)
|
||||
{
|
||||
return(!ft_isspace(c) && c != '|' && c != '&');
|
||||
}
|
||||
|
||||
char *ft_get_token(char **cmd, int *in_quote, int *in_dquote, t_env *env)
|
||||
char *get_token(char **cmd, int *in_quote, int *in_dquote, t_env *env)
|
||||
{
|
||||
char *res;
|
||||
int i;
|
||||
@ -24,8 +24,8 @@ char *ft_get_token(char **cmd, int *in_quote, int *in_dquote, t_env *env)
|
||||
i = 0;
|
||||
while (ft_isspace(**cmd))
|
||||
(*cmd)++;
|
||||
res = ft_calloc(ft_get_token_len(*cmd, env) + 1, 1);
|
||||
while (res && **cmd && (ft_is_cmd_char(**cmd) || *in_quote || *in_dquote))
|
||||
res = ft_calloc(get_token_len(*cmd, env) + 1, 1);
|
||||
while (res && **cmd && (is_cmd_char(**cmd) || *in_quote || *in_dquote))
|
||||
{
|
||||
if (**cmd == '"' && !*in_quote)
|
||||
*in_dquote = !*in_dquote;
|
||||
@ -34,7 +34,7 @@ char *ft_get_token(char **cmd, int *in_quote, int *in_dquote, t_env *env)
|
||||
if (**cmd == '$' && !*in_quote)
|
||||
{
|
||||
(*cmd) += EXIT_FAILURE;
|
||||
i += ft_add_var_to_str(res + i, cmd, env);
|
||||
i += add_var_to_str(res + i, cmd, env);
|
||||
}
|
||||
else if (((**cmd == '\'' && *in_dquote) || (**cmd == '"' && *in_quote))
|
||||
|| (**cmd != '\'' && **cmd != '"'))
|
||||
@ -44,7 +44,7 @@ char *ft_get_token(char **cmd, int *in_quote, int *in_dquote, t_env *env)
|
||||
return (res);
|
||||
}
|
||||
|
||||
t_token_type ft_get_token_type(char *command)
|
||||
t_token_type get_token_type(char *command)
|
||||
{
|
||||
while (ft_isspace(*command))
|
||||
command++;
|
||||
@ -57,7 +57,7 @@ t_token_type ft_get_token_type(char *command)
|
||||
return (ARG);
|
||||
}
|
||||
|
||||
t_cmd *ft_parse_command(char *command, t_env *env)
|
||||
t_cmd *parse_command(char *command, t_env *env)
|
||||
{
|
||||
int in_quote;
|
||||
int in_dquote;
|
||||
@ -70,16 +70,16 @@ t_cmd *ft_parse_command(char *command, t_env *env)
|
||||
res = 0;
|
||||
while (command && *command)
|
||||
{
|
||||
type = ft_get_token_type(command);
|
||||
type = get_token_type(command);
|
||||
if (type == ARG)
|
||||
token = ft_get_token(&command, &in_quote, &in_dquote, env);
|
||||
token = get_token(&command, &in_quote, &in_dquote, env);
|
||||
else
|
||||
token = 0;
|
||||
res = ft_cmd_add_back(res, token, type);
|
||||
res = cmd_add_back(res, token, type);
|
||||
}
|
||||
if (command && (in_quote || in_dquote))
|
||||
{
|
||||
ft_free_cmd(res);
|
||||
free_cmd(res);
|
||||
ft_putstr_fd("minishell: syntax error\n", 2);
|
||||
return (0);
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_parsing_var.c :+: :+: :+: */
|
||||
/* parsing_var.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/09 15:24:36 by tomoron #+# #+# */
|
||||
/* Updated: 2024/02/13 15:47:33 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/02/13 16:25:37 by marde-vr ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -22,7 +22,7 @@ char *get_var_name(char *command)
|
||||
return (res);
|
||||
}
|
||||
|
||||
int ft_get_var_len(char **command, t_env *env)
|
||||
int get_var_len(char **command, t_env *env)
|
||||
{
|
||||
char *var_name;
|
||||
char *env_var;
|
||||
@ -33,7 +33,7 @@ int ft_get_var_len(char **command, t_env *env)
|
||||
if (**command == '?')
|
||||
return (get_number_len(g_return_code));
|
||||
var_name = get_var_name(*command);
|
||||
env_var = ft_getenv(env, var_name);
|
||||
env_var = ft_get_env(env, var_name);
|
||||
free(var_name);
|
||||
if (!env_var)
|
||||
return (0);
|
||||
@ -41,7 +41,7 @@ int ft_get_var_len(char **command, t_env *env)
|
||||
return (ft_strlen(env_var));
|
||||
}
|
||||
|
||||
int ft_get_token_len(char *command, t_env *env)
|
||||
int get_token_len(char *command, t_env *env)
|
||||
{
|
||||
int in_quote;
|
||||
int in_dquote;
|
||||
@ -50,14 +50,14 @@ int ft_get_token_len(char *command, t_env *env)
|
||||
in_quote = 0;
|
||||
in_dquote = 0;
|
||||
res = 0;
|
||||
while (*command && (ft_is_cmd_char(*command) || in_quote || in_dquote))
|
||||
while (*command && (is_cmd_char(*command) || in_quote || in_dquote))
|
||||
{
|
||||
if (*command == '"' && !in_quote)
|
||||
in_dquote = !in_dquote;
|
||||
if (*command == '\'' && !in_dquote)
|
||||
in_quote = !in_quote;
|
||||
if (*command == '$' && !in_quote)
|
||||
res += ft_get_var_len(&command, env);
|
||||
res += get_var_len(&command, env);
|
||||
else if (*command != '\'' && *command != '"')
|
||||
res++;
|
||||
else if ((*command == '\'' && in_dquote)
|
||||
@ -68,7 +68,7 @@ int ft_get_token_len(char *command, t_env *env)
|
||||
return (res);
|
||||
}
|
||||
|
||||
int ft_add_return_code_to_str(char *res)
|
||||
int add_return_code_to_str(char *res)
|
||||
{
|
||||
char *var;
|
||||
int i;
|
||||
@ -84,7 +84,7 @@ int ft_add_return_code_to_str(char *res)
|
||||
return (i);
|
||||
}
|
||||
|
||||
int ft_add_var_to_str(char *res, char **command, t_env *env)
|
||||
int add_var_to_str(char *res, char **command, t_env *env)
|
||||
{
|
||||
char *var_name;
|
||||
char *var;
|
||||
@ -98,9 +98,9 @@ int ft_add_var_to_str(char *res, char **command, t_env *env)
|
||||
return (2);
|
||||
}
|
||||
if (**command == '?')
|
||||
return (ft_add_return_code_to_str(res));
|
||||
return (add_return_code_to_str(res));
|
||||
var_name = get_var_name(*command);
|
||||
var = ft_getenv(env, var_name);
|
||||
var = ft_get_env(env, var_name);
|
||||
free(var_name);
|
||||
while (var && var[i])
|
||||
{
|
@ -1,17 +1,17 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_pwd.c :+: :+: :+: */
|
||||
/* pwd.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/09 18:31:21 by tomoron #+# #+# */
|
||||
/* Updated: 2024/02/12 14:53:05 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/02/13 16:18:01 by marde-vr ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
#include "minishell.h"
|
||||
|
||||
int ft_pwd(void)
|
||||
int pwd(void)
|
||||
{
|
||||
char *buffer;
|
||||
|
Reference in New Issue
Block a user