minishell/includes/minishell.h
2019-11-10 21:45:56 +01:00

55 lines
1.8 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* minishell.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/18 13:12:34 by tmaze #+# #+# */
/* Updated: 2019/11/10 20:57:46 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef MINISHELL_H
# define MINISHELL_H
# include <unistd.h>
# include <sys/stat.h>
# include "libft.h"
# define S_BIN 5
typedef struct s_env
{
char *key;
char *val;
struct s_env *next;
} t_env;
typedef struct s_builtin
{
char *cmd;
int (*f)(char **argv, t_env **env);
} t_builtin;
int cmd_env(char **argv, t_env **env);
int cmd_setenv(char **argv, t_env **env);
int cmd_unsetenv(char **argv, t_env **env);
int cmd_cd(char **argv, t_env **env);
int cmd_echo(char **argv, t_env **env);
void ft_envdelelem(t_env **elem);
void ft_envdel(t_env **env);
t_env *ft_envnew(char *env);
t_env *ft_envaddend(t_env **alst, t_env *new);
t_env *ft_envgetelem(char *key, t_env *env);
char **ft_envtotab(t_env *env);
char *ft_envupdate(char *key, t_env *env, char *val);
void ft_envclean(t_env **env);
char **res_ext(char **argv, t_env *env);
int exec_cmd(char **argv, t_env **env);
#endif