minishell/includes/minishell.h
2019-09-27 17:00:03 +02:00

51 lines
1.7 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* minishell.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/18 13:12:34 by tmaze #+# #+# */
/* Updated: 2019/09/27 16:09:09 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 lstdelelem(t_env **elem);
void lstdel(t_env **env);
t_env *lstnew(char *env);
t_env *lstaddend(t_env **alst, t_env *new);
t_env *lstgetelem(char *key, t_env *env);
char **lsttotab(t_env *env);
int exec_cmd(char **argv, t_env **env);
#endif