diff --git a/configure.ac b/configure.ac index ff789bcf577519b3bcdae113d1d28040648ec14e..07a584e5e22b696f9d1e87f083b4c44a8e3871c0 100644 --- a/configure.ac +++ b/configure.ac @@ -15,19 +15,22 @@ echo "checking CFLAGS..." AC_CANONICAL_HOST case $host_os in - *osf*) + *osf*) CFLAGS='-Wall -W -ansi -pedantic -D_XOPEN_SOURCE=600' ;; - *solaris*) + *solaris*) CFLAGS='-Wall -W -ansi -pedantic -D_XOPEN_SOURCE=600' ;; - *linux*|*netbsd*) + *linux*|*netbsd*) CFLAGS='-Wall -Wextra -std=c99 -pedantic -D_XOPEN_SOURCE=600 -pipe' ;; - *) - pl="`uname -s`" - AC_MSG_ERROR([Platform $pl not supported.]) + *darwin*) + CFLAGS='-Wall -W -std=c99 -pedantic -D_XOPEN_SOURCE=600 -pipe' ;; + *) + pl="`uname -s`" + AC_MSG_ERROR([Platform $pl not supported.]) + ;; esac # Check for C compiler @@ -85,8 +88,6 @@ AC_CHECK_HEADERS([limits.h]) dnl Memo: dnl AC ARG WITH(package, help-string, [action-if-given], [action-if-not-given]) - - AC_ARG_WITH([noerror], [AS_HELP_STRING([--with-noerror], [Warning dont create compilation error])], [dnl action-if-given diff --git a/src/exec/exec.h b/src/exec/exec.h index 95d1d6ad0400a40d582be95e9df5574642fdd94c..cba632b225ae7f3a648932eb24c1ff25cd218ceb 100644 --- a/src/exec/exec.h +++ b/src/exec/exec.h @@ -5,7 +5,7 @@ ** Login ** ** Started on Sun Mar 30 16:02:07 2006 Seblu -** Last update Sun Nov 12 03:43:20 2006 seblu +** Last update Sun Nov 12 13:29:49 2006 seblu */ #ifndef EXEC_H_ @@ -16,21 +16,12 @@ # include "../ast/ast.h" # include "../shell/shell.h" -void exec_node(s_ast_node *node); - -/* void exec_list(struct s_list *node, struct s_42sh *sh); */ -/* void exec_if(struct s_if *node, struct s_42sh *sh); */ -/* void exec_while(struct s_while *node, struct s_42sh *sh); */ -/* void exec_until(struct s_while *node, struct s_42sh *sh); */ -/* void exec_and(struct s_op *node, struct s_42sh *sh); */ -/* void exec_or(struct s_op *node, struct s_42sh *sh); */ -/* void exec_cmd(struct s_cmd *node, struct s_42sh *sh); */ -/* void exec_pipe(struct s_op *node, struct s_42sh *sh); */ -/* void exec_bang(struct s_op *node, struct s_42sh *sh); */ -/* void exec_sepand(struct s_op *node, struct s_42sh *sh); */ -/* void exec_sepsemicolon(struct s_op *node, struct s_42sh *sh); */ -/* void exec_line(struct s_op *node, struct s_42sh *sh); */ -/* void exec_subshell(struct s_subshell *node, struct s_42sh *sh); */ +void exec_node(s_ast_node *node); +void exec_and(s_bin_node *node); +void exec_or(s_bin_node *node); +void exec_bang(s_bin_node *node); +void exec_if(s_if_node *node); +void exec_while(s_while_node *node); /* FIXME */ diff --git a/src/exec/exec_and.c b/src/exec/exec_and.c index ae823022e42148747f3610c317adddbb1a9930d2..89eab82e816bfab4fe6c975cb20197f6998d3277 100644 --- a/src/exec/exec_and.c +++ b/src/exec/exec_and.c @@ -5,14 +5,14 @@ ** Login ** ** Started on Sat Mar 25 15:27:20 2006 Seblu -** Last update Sun Nov 12 03:43:57 2006 seblu +** Last update Sun Nov 12 13:40:37 2006 seblu */ #include "exec.h" void exec_and(s_bin_node *node) { - assert(node && node->lhs && node->rhs); + assert(node); exec_node(node->lhs); //FIXME: error with chained "or" and "and" if (!shell->status) diff --git a/src/exec/exec_if.c b/src/exec/exec_if.c index cc871ec88ef466a2803de9648a1a326a9f67dfb2..a86664cc9c330447160b381dc31fdbcb4f2f77b0 100644 --- a/src/exec/exec_if.c +++ b/src/exec/exec_if.c @@ -5,12 +5,12 @@ ** Login ** ** Started on Sat Mar 25 15:27:20 2006 Seblu -** Last update Sun Nov 12 03:45:42 2006 seblu +** Last update Sun Nov 12 13:11:02 2006 seblu */ #include "exec.h" -void exec_if(s_if_node *node) +void exec_if(s_if_node *node) { assert(node); exec_node(node->cond); diff --git a/src/exec/exec_node.c b/src/exec/exec_node.c index 02439995af42ce1b6a1e31f4c88f44a8699c554f..65551f1a90b7604f952f778c21b25f89c75b92c3 100644 --- a/src/exec/exec_node.c +++ b/src/exec/exec_node.c @@ -5,51 +5,29 @@ ** Login ** ** Started on Sat Mar 25 14:51:09 2006 Seblu -** Last update Tue Aug 29 00:19:35 2006 Seblu +** Last update Sun Nov 12 13:36:41 2006 seblu */ #include "exec.h" -/*! -** Execute a node of ast by calling the good function -** -** @param node node to execute -** @param sh shell struct -*/ void exec_node(s_ast_node *node) { - node = node; + if (node == NULL) + return; + switch (node->type) { + case T_SEP: break; + case T_SEPAND: break; + case T_CMD: break; + case T_RED: break; + case T_PIPE: break; + case T_AND: exec_and(&node->body.child_and); break; + case T_OR: exec_or(&node->body.child_or); break; + case T_IF: exec_if(&node->body.child_if); break; + case T_WHILE: exec_while(&node->body.child_while); break; + case T_BANG: exec_bang(&node->body.child_bang); break; + case T_SUBSHELL: break; + case T_FUNCDEC: break; + case T_CASE: break; + default: assert(0); + } } - -/* { */ -/* if (node == NULL) */ -/* return; */ -/* else if (node->type == T_CMD) */ -/* exec_cmd(&node->data.node_cmd, sh); */ -/* else if (node->type == T_PIPE) */ -/* exec_pipe(&node->data.node_op, sh); */ -/* else if (node->type == T_LINE) */ -/* exec_line(&node->data.node_op, sh); */ -/* else if (node->type == T_SEP_AND) */ -/* exec_sepand(&node->data.node_op, sh); */ -/* else if (node->type == T_SEP_SEMICOMMA) */ -/* exec_sepsemicolon(&node->data.node_op, sh); */ -/* else if (node->type == T_IF) */ -/* exec_if(&node->data.node_if, sh); */ -/* else if (node->type == T_FOR) */ -/* exec_for(&node->data.node_for, sh); */ -/* else if (node->type == T_AND) */ -/* exec_and(&node->data.node_op, sh); */ -/* else if (node->type == T_OR) */ -/* exec_or(&node->data.node_op, sh); */ -/* else if (node->type == T_WHILE) */ -/* exec_while(&node->data.node_while, sh); */ -/* else if (node->type == T_UNTIL) */ -/* exec_until(&node->data.node_while, sh); */ -/* else if (node->type == T_BANG) */ -/* exec_bang(&node->data.node_op, sh); */ -/* else if (node->type == T_SUBSHELL) */ -/* exec_subshell(&node->data.node_subshell, sh); */ -/* else */ -/* assert(0); */ -/* } */ diff --git a/src/exec/exec_or.c b/src/exec/exec_or.c index ec689beb435335da6bee03e6f66edd19f115655b..6b6587b65977bae8994a33d9d6849cbd3fcb681c 100644 --- a/src/exec/exec_or.c +++ b/src/exec/exec_or.c @@ -5,14 +5,14 @@ ** Login ** ** Started on Sat Mar 25 15:27:20 2006 Seblu -** Last update Sun Nov 12 03:45:03 2006 seblu +** Last update Sun Nov 12 13:40:45 2006 seblu */ #include "exec.h" void exec_or(s_bin_node *node) { - assert(node && node->lhs && node->rhs); + assert(node); exec_node(node->lhs); //FIXME: error with chained "or" and "and" if (shell->status)