minishell/includes/minishell.h

47 lines
1.7 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* minishell.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/18 13:12:34 by tmaze #+# #+# */
/* Updated: 2019/01/15 15:09:58 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef MINISHELL_H
# define MINISHELL_H
# include <unistd.h>
# include <sys/stat.h>
# include "libft.h"
typedef struct s_builtin
{
char *cmd;
int (*f)(char **argv, t_list **env);
} t_builtin;
typedef struct s_envelem
{
char *key;
char *val;
} t_envelem;
t_envelem *elem_new(char *key, char *val);
t_envelem *env_getelemfromkey(char *key, t_list *env);
t_envelem *env_addupdate(char *key, char *val, t_list **env);
void env_delelem(char *key, t_list **env);
void ft_lstdelenvelem(void *content, size_t size);
int exec_cmd(char **argv, t_list **env);
int cmd_echo(char **argv, t_list **env);
int cmd_cd(char **argv, t_list **env);
int cmd_env(char **argv, t_list **env);
int cmd_setenv(char **argv, t_list **env);
int cmd_unsetenv(char **argv, t_list **env);
#endif