extra file rm'd and norm
This commit is contained in:
parent
d09f223683
commit
6e493e84ea
4 changed files with 5 additions and 346 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/14 20:22:56 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/25 14:59:53 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/25 21:31:28 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -39,6 +39,5 @@ struct s_data_template
|
|||
int cliopts_get(char **av, t_cliopts opt_map[], void *data);
|
||||
t_cliopts *cliopts_getmap_long(t_cliopts opt_map[], char *arg);
|
||||
t_cliopts *cliopts_getmap_short(t_cliopts opt_map[], char arg);
|
||||
int cliopts_has(char **av, char c);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/21 18:00:03 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/25 04:00:30 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/25 21:29:45 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -18,7 +18,6 @@ int bt_read_getdelim(char *opt_arg, t_read *data)
|
|||
return (1);
|
||||
if (data)
|
||||
data->delim = *opt_arg;
|
||||
DG("delim=%c", data->delim);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,100 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_putast.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/14 18:18:04 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/24 16:28:14 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
char *ft_putast(void *nodein)
|
||||
{
|
||||
t_astnode *node;
|
||||
node = nodein;
|
||||
|
||||
if (node->type == TK_BANG)
|
||||
return ("TK_BANG");
|
||||
if (node->type == TK_DSEMI)
|
||||
return ("TK_DSEMI");
|
||||
if (node->type == WORDLIST)
|
||||
return ("WORDLIST");
|
||||
if (node->type == CMD)
|
||||
return ("CMD");
|
||||
if (node->type == REDIR)
|
||||
return ("REDIR");
|
||||
if (node->type == CLOSE_LIST)
|
||||
return ("CLOSE_LIST");
|
||||
if (node->type == FNAME)
|
||||
return ("FNAME");
|
||||
if (node->type == TK_LBRACE)
|
||||
return ("TK_LBRACE");
|
||||
if (node->type == TK_ASSIGNMENT_WORD)
|
||||
return ("ASSIGNEMENT_WORD");
|
||||
if (node->type == SUBSHELL)
|
||||
return ("SUBSHELL");
|
||||
if (node->type == TK_NAME)
|
||||
return ("TK_NAME");
|
||||
if (node->type == TK_FOR)
|
||||
return ("TK_FOR");
|
||||
if (node->type == TK_CASE)
|
||||
return ("TK_CASE");
|
||||
else if (node->type == TK_PAREN_OPEN)
|
||||
return ("TK_OPE");
|
||||
else if (node->type == TK_PAREN_CLOSE)
|
||||
return ("TK_CLO");
|
||||
else if (node->type == TK_IN)
|
||||
return ("TK_IN");
|
||||
else if (node->type ==TK_ESAC)
|
||||
return ("TK_ESAC");
|
||||
else if (node->type == TK_THEN)
|
||||
return ("THEN");
|
||||
else if (node->type == TK_FI)
|
||||
return ("FI");
|
||||
else if (node->type == TK_DO)
|
||||
return ("TK_DO");
|
||||
else if (node->type == TK_AMP)
|
||||
return (" & ");
|
||||
else if (node->type == TK_WORD)
|
||||
return (" TK_WORD");
|
||||
else if (node->type == TK_SEMI)
|
||||
return (" ; ");
|
||||
else if (node->type == TK_AND_IF)
|
||||
return (" && ");
|
||||
else if (node->type == TK_OR_IF)
|
||||
return (" || ");
|
||||
else if (node->type == TK_PIPE)
|
||||
return (" | ");
|
||||
else if (node->type == TK_COMMAND)
|
||||
return (" COM ");
|
||||
else if (node->type == TK_WHILE)
|
||||
return (" WHILE ");
|
||||
else if (node->type == TK_IF)
|
||||
return ("IF");
|
||||
else if (node->type == TK_ELIF)
|
||||
return ("ELIF");
|
||||
else if (node->type == TK_ELSE)
|
||||
return ("ELSE");
|
||||
else if (node->type == TK_UNTIL)
|
||||
return ("UNTIL");
|
||||
else if (node->type == TK_NEWLINE)
|
||||
return ("NEW");
|
||||
else if (node->type == TK_GREAT)
|
||||
return (" > ");
|
||||
else if (node->type == TK_LESS)
|
||||
return (" < ");
|
||||
else if (node->type == TK_DGREAT)
|
||||
return (" >> ");
|
||||
else if (node->type == TK_DLESS)
|
||||
return (" << ");
|
||||
else if (node->type == TK_GREATAND)
|
||||
return (" >& ");
|
||||
else if (node->type == TK_LESSAND)
|
||||
return (" <& ");
|
||||
else
|
||||
return ("OTHER");
|
||||
}
|
||||
|
|
@ -1,239 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* read_stack.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/09 15:32:10 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/24 17:25:03 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
char *read_state(t_sym current)
|
||||
{
|
||||
if (current == FNAME)
|
||||
return ("FNAME");
|
||||
if (current == PIPE_CLOSE_SEQUENCE)
|
||||
return ("PIPE_CLOSE_SEQUENCE");
|
||||
if (current == TK_BANG)
|
||||
return ("TK_BANG");
|
||||
if (current == OPEN_FUNC)
|
||||
return ("OPEN_FUNC");
|
||||
if (current == CLOSE_FUNC)
|
||||
return ("CLOSE_FUNC");
|
||||
if (current == HEREDOCDATA)
|
||||
return ("HEREDOCDATA");
|
||||
if (current == TERMINUS)
|
||||
return ("TERMINUS");
|
||||
if (current == SEQUENCE)
|
||||
return ("SEQUENCE");
|
||||
if (current == LINEBREAK)
|
||||
return ("LINEBREAK");
|
||||
if (current == CLOSE_LIST)
|
||||
return ("CLOSE_LIST");
|
||||
if (current == BRACE_CLAUSE)
|
||||
return ("BRACE_CLAUSE");
|
||||
if (current == FUNC_NAME)
|
||||
return ("FUNC_NAME");
|
||||
if (current == TK_LBRACE)
|
||||
return ("TK_LBRACE");
|
||||
if (current == TK_RBRACE)
|
||||
return ("TK_RBRACE");
|
||||
if (current == TK_ASSIGNMENT_WORD)
|
||||
return ("TK_ASSIGNMENT_WORD");
|
||||
if (current == CASE_CLAUSE)
|
||||
return ("CASE_CLAUSE");
|
||||
if (current == CASE_LIST_NS)
|
||||
return ("CASE_LIST_NS");
|
||||
if (current == TK_DSEMI)
|
||||
return ("TK_DSEMI");
|
||||
if (current == TK_PAREN_OPEN)
|
||||
return ("TK_PAREN_OPEN");
|
||||
if (current == TK_PAREN_CLOSE)
|
||||
return ("TK_PAREN_CLOSE");
|
||||
if (current == FOR_WORDLIST)
|
||||
return ("FOR_WORDLIST");
|
||||
if (current == FOR_CLAUSE)
|
||||
return ("FOR_CLAUSE");
|
||||
if (current == TK_NAME)
|
||||
return ("TK_NAME");
|
||||
if (current == TK_FOR)
|
||||
return ("FOR");
|
||||
if (current == NAME)
|
||||
return ("NAME");
|
||||
if (current == 0)
|
||||
return ("NULL");
|
||||
if (current == PATTERN)
|
||||
return ("PATTERN");
|
||||
if (current == TK_CASE)
|
||||
return ("TK_CASE");
|
||||
if (current == TK_IN)
|
||||
return ("TK_IN");
|
||||
if (current == TK_ESAC)
|
||||
return ("TK_ESAC");
|
||||
if (current == UNTIL_CLAUSE)
|
||||
return ("UNTIL_CLAUSE");
|
||||
if (current == TK_UNTIL)
|
||||
return ("TK_UNTIL");
|
||||
if (current == IF_CLAUSE)
|
||||
return ("IF_CLAUSE");
|
||||
if (current == CONDITION)
|
||||
return ("CONDITION");
|
||||
if (current == COMPLETE_CONDITION)
|
||||
return ("COMPLETE_CONDITION");
|
||||
if (current == TK_ELSE)
|
||||
return ("TK_ELSE");
|
||||
if (current == TK_FI)
|
||||
return ("TK_FI");
|
||||
if (current == ELSE_PART)
|
||||
return ("ELSE_PART");
|
||||
if (current == TK_FI)
|
||||
return ("TK_FI");
|
||||
if (current == TK_IF)
|
||||
return ("TK_IF");
|
||||
if (current == TK_ELIF)
|
||||
return ("TK_ELIF");
|
||||
if (current == TK_THEN)
|
||||
return ("TK_THEN");
|
||||
if (current == COMPOUND_COMMAND)
|
||||
return ("COMPOUND_COMMAND");
|
||||
if (current == WHILE_CLAUSE)
|
||||
return ("WHILE_CLAUSE");
|
||||
if (current == LOOP)
|
||||
return ("LOOP");
|
||||
if (current == TK_DONE)
|
||||
return ("DONE");
|
||||
if (current == TK_DO)
|
||||
return ("TK_DO");
|
||||
if (current == END_COMMAND)
|
||||
return ("END_COMMAND");
|
||||
if (current == SEQUENTIAL_SEP)
|
||||
return ("SEQUENTIAL_SEP");
|
||||
if (current == SEPARATOR)
|
||||
return ("SEPARATOR");
|
||||
if (current == SEPARATOR_OP)
|
||||
return ("SEPARATOR_OP");
|
||||
if (current == TERM)
|
||||
return ("TERM");
|
||||
if (current == COMPOUND_LIST)
|
||||
return ("COMPOUND_LIST");
|
||||
if (current == DO_GROUP)
|
||||
return ("DO_GROUP");
|
||||
if (current == TK_NEWLINE)
|
||||
return ("TK_NEWLINE");
|
||||
if (current == TK_WHILE)
|
||||
return ("TK_WHILE");
|
||||
if (current == TK_DO)
|
||||
return ("TK_DO");
|
||||
if (current == TK_DONE)
|
||||
return ("TK_DONE");
|
||||
if (current == AND_OR_MINOR)
|
||||
return ("AND_OR_MINOR");
|
||||
if (current == AND_OR_MAJOR)
|
||||
return ("AND_OR_MAJOR");
|
||||
if (current == TK_COMMAND)
|
||||
return ("TK_COMMAND");
|
||||
if (current == TK_AND_IF)
|
||||
return ("TK_AND_IF");
|
||||
if (current == TK_OR_IF)
|
||||
return ("TK_OR_IF");
|
||||
if (current == TK_AMP)
|
||||
return ("TK_AMP");
|
||||
if (current == TK_PIPE)
|
||||
return ("TK_PIPE");
|
||||
if (current == TK_LESS)
|
||||
return ("TK_LESS");
|
||||
if (current == TK_GREAT)
|
||||
return ("TK_GREAT");
|
||||
if (current == TK_DLESS)
|
||||
return ("TK_DLESS");
|
||||
if (current == TK_DGREAT)
|
||||
return ("TK_DGREAT");
|
||||
if (current == TK_DGREAT)
|
||||
return ("TK_DGREAT");
|
||||
if (current == TK_LESSAND)
|
||||
return ("TK_LESSAND");
|
||||
if (current == TK_GREATAND)
|
||||
return ("TK_GREATAND");
|
||||
if (current == SUBSHELL)
|
||||
return ("SUBSEHLL");
|
||||
if (current == CMD_SUPERIOR)
|
||||
return ("CMD_SUPERIOR");
|
||||
if (current == TK_IO_NUMBER)
|
||||
return ("IO_NUMBER");
|
||||
if (current == CMD_SUFFIX)
|
||||
return ("CMD_SUFFIX");
|
||||
if (current == CMD_PREFIX)
|
||||
return ("CMD_PREFIX");
|
||||
if (current == IO_REDIRECT)
|
||||
return ("IO_REDIRECT");
|
||||
if (current == IO_FILE)
|
||||
return ("IO_FILE");
|
||||
if (current == PIPE_SEMI_SEQUENCE)
|
||||
return ("PIPE_SEMI_SEQUENCE");
|
||||
if (current == TK_PIPE)
|
||||
return ("TK_PIPE");
|
||||
if (current == PROGRAM)
|
||||
return ("PROGRAM");
|
||||
if (current == COMMAND)
|
||||
return ("COMMAND");
|
||||
if (current == PIPE_SEQUENCE)
|
||||
return ("PIPE_SEQUENCE");
|
||||
if (current == PIPELINE)
|
||||
return ("PIPELINE");
|
||||
if (current == AND_OR)
|
||||
return ("AND_OR");
|
||||
if (current == LIST)
|
||||
return ("LIST");
|
||||
if (current == COMPLETE_COMMAND)
|
||||
return ("COMPLETE_COMMAND");
|
||||
if (current == COMPLETE_COMMANDS)
|
||||
return ("COMPLETE_COMMANDS");
|
||||
if (current == TK_WORD)
|
||||
return ("TK_WORD");
|
||||
if (current == CMD_NAME)
|
||||
return ("CMD_NAME");
|
||||
if (current == HERE_END)
|
||||
return ("HERE_END");
|
||||
if (current == FILENAME)
|
||||
return ("FILENAME");
|
||||
if (current == CMD_SUFFIX)
|
||||
return ("CMD_SUFFIX");
|
||||
if (current == SIMPLE_COMMAND)
|
||||
return ("SIMPLE_COMMAND");
|
||||
if (current == TK_SEMI)
|
||||
return ("TK_SEMI");
|
||||
if (current == ALL)
|
||||
return ("ALL");
|
||||
if (current == NEWLINE_LIST)
|
||||
return ("NEWLINE_LIST");
|
||||
if (current == CMD)
|
||||
return ("CMD");
|
||||
if (current != 0)
|
||||
return ("NON-DEFINED");
|
||||
if (current == 0)
|
||||
return ("NULL");
|
||||
return ("NULL");
|
||||
}
|
||||
|
||||
int ft_read_stack(t_sym *stack)
|
||||
{
|
||||
while (*stack)
|
||||
DG("%s", read_state(*stack--));
|
||||
return (0);
|
||||
}
|
||||
|
||||
int ft_show_heredoc_data(t_astnode *node)
|
||||
{
|
||||
t_redir *redir;
|
||||
|
||||
if (node->type != CMD)
|
||||
return (1);
|
||||
redir = (node->data.cmd.redir)->content;
|
||||
if (redir->type != TK_DLESS)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
Loading…
Reference in a new issue