mirror of
https://github.com/KeyZox71/ft_minipowershell.git
synced 2025-03-15 11:26:51 +01:00
@ -6,7 +6,7 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 13:20:22 by mmoussou #+# #+# */
|
||||
/* Updated: 2024/05/30 15:42:38 by mmoussou ### ########.fr */
|
||||
/* Updated: 2024/06/10 16:40:52 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -30,15 +30,6 @@ typedef struct s_env
|
||||
*/
|
||||
int env_init(char **env_d, t_env *env);
|
||||
|
||||
/**
|
||||
* @brief DEBUG FUNC : print the actual state of the env struct
|
||||
*
|
||||
* @param env the env struct that will be printed
|
||||
*
|
||||
* @return (void)
|
||||
*/
|
||||
void env_print(t_env *env);
|
||||
|
||||
/**
|
||||
* @brief get value of an env
|
||||
*
|
||||
@ -99,4 +90,13 @@ t_env *ft_envlast(t_env *env);
|
||||
t_env *ft_envnew(char *name, char *content);
|
||||
uint ft_envsize(t_env *lst);
|
||||
|
||||
/**
|
||||
* @brief DEBUG FUNC : print the actual state of the env struct
|
||||
*
|
||||
* @param env the env struct that will be printed
|
||||
*
|
||||
* @return (void)
|
||||
*/
|
||||
void ft_envprint(t_env *env);
|
||||
|
||||
#endif
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: mmoussou <mmoussou@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/01 22:03:09 by mmoussou #+# #+# */
|
||||
/* Updated: 2024/01/11 18:03:15 by mmoussou ### ########.fr */
|
||||
/* Updated: 2024/06/10 16:37:38 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -23,5 +23,5 @@ int ft_strcmp(const char *s1, const char *s2)
|
||||
return (((unsigned char *)s1)[i] - ((unsigned char *)s2)[i]);
|
||||
i++;
|
||||
}
|
||||
return (0);
|
||||
return (((unsigned char *)s1)[i] - ((unsigned char *)s2)[i]);
|
||||
}
|
||||
|
12
src/env/env_cmd.c
vendored
12
src/env/env_cmd.c
vendored
@ -6,7 +6,7 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/22 14:50:01 by mmoussou #+# #+# */
|
||||
/* Updated: 2024/05/27 13:11:07 by mmoussou ### ########.fr */
|
||||
/* Updated: 2024/06/10 16:39:43 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -74,11 +74,11 @@ char *env_get_value(char *name, t_env *env)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void env_print(t_env *env)
|
||||
char *env_getn_value(char *name, t_env *env, int n)
|
||||
{
|
||||
while (env)
|
||||
{
|
||||
printf("%s:%s\n", env->name, env->content);
|
||||
while (env && ft_strncmp(env->name, name, n))
|
||||
env = env->next;
|
||||
}
|
||||
if (env)
|
||||
return (env->content);
|
||||
return (NULL);
|
||||
}
|
||||
|
22
src/env/env_list/ft_envprint.c
vendored
Normal file
22
src/env/env_list/ft_envprint.c
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_envprint.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/06/10 16:39:58 by mmoussou #+# #+# */
|
||||
/* Updated: 2024/06/10 16:42:29 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
void ft_envprint(t_env *env)
|
||||
{
|
||||
while (env)
|
||||
{
|
||||
printf("%s:%s\n", env->name, env->content);
|
||||
env = env->next;
|
||||
}
|
||||
}
|
@ -3,10 +3,10 @@
|
||||
/* ::: :::::::: */
|
||||
/* split_cmd.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/04 15:00:32 by adjoly #+# #+# */
|
||||
/* Updated: 2024/06/04 13:15:47 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/06/08 18:31:42 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -15,10 +15,8 @@
|
||||
|
||||
t_cmd *split_cmd(char *cmd_av, t_cmd *cmd)
|
||||
{
|
||||
char *tmp;
|
||||
char **split;
|
||||
|
||||
tmp = cmd_av;
|
||||
split = ft_split(cmd_av, ' ');
|
||||
cmd->cmd = ft_strdup(*split);
|
||||
cmd->argv = split;
|
||||
|
Reference in New Issue
Block a user