diff --git a/42sh/42ShellTester/minishell_error b/42sh/42ShellTester/minishell_error new file mode 100644 index 00000000..5ace4e58 --- /dev/null +++ b/42sh/42ShellTester/minishell_error @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/42sh/includes/builtin.h b/42sh/includes/builtin.h index b32489e2..85e8a8a2 100644 --- a/42sh/includes/builtin.h +++ b/42sh/includes/builtin.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/14 22:59:57 by jhalford #+# #+# */ -/* Updated: 2017/03/25 01:08:44 by wescande ### ########.fr */ +/* Updated: 2017/03/25 01:18:37 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,7 +17,6 @@ # include "libft.h" # include "builtin_read.h" -# define BT_EXPORT_LP (1 << 0) struct s_env_data diff --git a/42sh/libft/includes/cliopts.h b/42sh/libft/includes/cliopts.h index af352318..0271655d 100644 --- a/42sh/libft/includes/cliopts.h +++ b/42sh/libft/includes/cliopts.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/14 20:22:56 by jhalford #+# #+# */ -/* Updated: 2017/03/24 23:57:01 by wescande ### ########.fr */ +/* Updated: 2017/03/25 01:18:54 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/libft/src/cliopts/cliopts_get.c b/42sh/libft/src/cliopts/cliopts_get.c index b8a80b44..27437ade 100644 --- a/42sh/libft/src/cliopts/cliopts_get.c +++ b/42sh/libft/src/cliopts/cliopts_get.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/14 20:04:04 by jhalford #+# #+# */ -/* Updated: 2017/03/25 01:17:12 by wescande ### ########.fr */ +/* Updated: 2017/03/25 01:19:12 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -113,11 +113,8 @@ int cliopts_get(char **av, t_cliopts opt_map[], void *data) av++; while (av && *av) { - if (ft_strcmp(*av, "--") == 0) - { - av++; + if (ft_strcmp(*av, "-") == 0 || (ft_strcmp(*av, "--") == 0 && av++)) break ; - } else if ((*av)[0] == '-' && (*av)[1] == '-') { if (cliopts_parse_long(&av, opt_map, data)) diff --git a/42sh/log b/42sh/log new file mode 100644 index 00000000..2c0fdf70 --- /dev/null +++ b/42sh/log @@ -0,0 +1,304 @@ +Norme: ./src/builtin/bt_read_get.c +Norme: ./src/builtin/builtin_echo.c +Norme: ./src/builtin/bt_read_term.c +Norme: ./src/builtin/builtin_exit.c +Error (line 31): spaces at the end of line +Norme: ./src/builtin/builtin_func.c +Norme: ./src/builtin/builtin_cd.c +Error (line 74): comment not well formatted +Error (line 74): bad indentation +Error (line 74): comment not well placed +Norme: ./src/builtin/builtin_export.c +Error (line 60): line has 88 characters +Norme: ./src/builtin/builtin_hash.c +Norme: ./src/builtin/builtin_history.c +Norme: ./src/builtin/builtin_env.c +Error (line 51): line has 82 characters +Error (line 57): function builtin_env has 29 lines +Norme: ./src/builtin/builtin_unset.c +Norme: ./src/builtin/builtin_math.c +Norme: ./src/builtin/error_msg.c +Norme: ./src/builtin/builtin_unsetenv.c +Norme: ./src/builtin/is_builtin.c +Norme: ./src/builtin/builtin_setenv.c +Norme: ./src/completion/c_find_abspath.c +Norme: ./src/completion/c_find_binary.c +Norme: ./src/completion/c_arrow.c +Norme: ./src/builtin/builtin_read.c +Norme: ./src/completion/c_clear.c +Norme: ./src/completion/c_find_env.c +Norme: ./src/completion/c_match.c +Norme: ./src/completion/c_match_glob.c +Norme: ./src/completion/c_init.c +Norme: ./src/completion/c_match_update.c +Norme: ./src/completion/c_find_files.c +Norme: ./src/completion/c_misc.c +Norme: ./src/completion/c_output.c +Norme: ./src/completion/c_parser.c +Norme: ./src/completion/c_sizing.c +Norme: ./src/completion/c_printer.c +Norme: ./src/exec/ast_free.c +Norme: ./src/completion/c_terminal.c +Norme: ./src/completion/completion.c +Norme: ./src/exec/bad_fd.c +Norme: ./src/exec/exec_and_if.c +Norme: ./src/exec/exec_bang.c +Norme: ./src/exec/exec_ampersand.c +Norme: ./src/exec/exec_elif.c +Norme: ./src/exec/exec_case_branch.c +Norme: ./src/exec/exec_else.c +Norme: ./src/exec/exec_or_if.c +Norme: ./src/exec/exec_pipe.c +Norme: ./src/completion/c_pathsolver.c +Norme: ./src/exec/exec_semi.c +Norme: ./src/exec/exec_leaf.c +Norme: ./src/exec/exec_func.c +Norme: ./src/exec/exec_reset.c +Error (line 25): missing void in function exec_pushfds +Error (line 37): missing void in function exec_popfds +Norme: ./src/exec/fd_is_valid.c +Norme: ./src/exec/exec_var.c +Norme: ./src/exec/is_function.c +Norme: ./src/exec/ft_exec.c +Norme: ./src/exec/ft_findexec.c +Norme: ./src/exec/mark_process_status.c +Norme: ./src/exec/pfree_cond.c +Norme: ./src/exec/pfree_cmd.c +Norme: ./src/exec/pfree_list.c +Norme: ./src/exec/pfree_func.c +Norme: ./src/exec/pfree_subshell.c +Norme: ./src/exec/node_copy.c +Norme: ./src/exec/plaunch_brace.c +Norme: ./src/exec/plaunch_empty.c +Norme: ./src/exec/plaunch_builtin.c +Norme: ./src/exec/plaunch_case.c +Norme: ./src/exec/plaunch_function.c +Norme: ./src/exec/plaunch_if.c +Norme: ./src/exec/plaunch_for.c +Norme: ./src/exec/plaunch_subshell.c +Norme: ./src/exec/plaunch_until.c +Norme: ./src/exec/plaunch_while.c +Norme: ./src/exec/plaunch_file.c +Norme: ./src/exec/process_setgroup.c +Norme: ./src/exec/process_setsig.c +Norme: ./src/exec/pset_brace.c +Norme: ./src/exec/process_launch.c +Norme: ./src/exec/process_redirect.c +Norme: ./src/exec/pset_case.c +Norme: ./src/exec/pset_for.c +Norme: ./src/exec/pset_if.c +Norme: ./src/exec/pset_subshell.c +Norme: ./src/exec/pset_until.c +Norme: ./src/exec/pset_while.c +Norme: ./src/exec/pset_cmd.c +Norme: ./src/exec/redir_copy.c +Norme: ./src/exec/redir_free.c +Norme: ./src/exec/redirect_dgreat.c +Norme: ./src/exec/redirect_dless.c +Norme: ./src/exec/process_set.c +Norme: ./src/exec/redirect_great.c +Error (line 25, col 7): Spacing after call to exit +Norme: ./src/exec/redirect_less.c +Norme: ./src/exec/redirect_greatand.c +Norme: ./src/exec/redirect_lessand.c +Norme: ./src/exec/set_exitstatus.c +Norme: ./src/exec/token_to_argv.c +Norme: ./src/glob/esc_print.c +Norme: ./src/glob/command_getoutput.c +Norme: ./src/glob/dir_glob.c +Norme: ./src/glob/expand_esc.c +Norme: ./src/glob/expand_home.c +Norme: ./src/glob/expand_var.c +Norme: ./src/glob/expand_brace.c +Norme: ./src/glob/ft_strsplit_esc.c +Norme: ./src/glob/gen_tab_esc.c +Norme: ./src/glob/ft_strsplit_spe.c +Norme: ./src/glob/is_char_esc.c +Norme: ./src/glob/lib_perso/ft_ld_back.c +Norme: ./src/glob/lib_perso/ft_ld_clear.c +Norme: ./src/glob/lib_perso/ft_ld_copy.c +Norme: ./src/glob/lib_perso/ft_ld_front.c +Norme: ./src/glob/lib_perso/ft_ld_del.c +Norme: ./src/glob/lib_perso/ft_ld_new.c +Norme: ./src/glob/lib_perso/ft_ld_order.c +Norme: ./src/glob/lib_perso/ft_ld_pushback.c +Norme: ./src/glob/lib_perso/ft_ld_reverse.c +Norme: ./src/glob/lib_perso/ft_ld_pushfront.c +Norme: ./src/glob/lib_perso/ft_ld_size.c +Norme: ./src/glob/glob.c +Norme: ./src/glob/lib_perso/ft_ld_swap.c +Norme: ./src/glob/lib_perso/ft_memrealloc.c +Norme: ./src/glob/lib_perso/ft_ld_to_tab.c +Norme: ./src/glob/lib_perso/ft_strjoinf.c +Norme: ./src/glob/lib_perso/ft_strsubf.c +Norme: ./src/glob/lib_perso/ft_tablen.c +Norme: ./src/glob/lib_perso/ft_tabdel.c +Norme: ./src/glob/tab_esc_copy.c +Norme: ./src/glob/word_is_assignment.c +Norme: ./src/hash_table/ft_add_hash.c +Norme: ./src/hash_table/hash.c +Norme: ./src/hash_table/hash_free.c +Norme: ./src/hash_table/hash_str.c +Norme: ./src/hash_table/is_hash.c +Norme: ./src/glob/expand_bquote.c +Norme: ./src/history/add_str_in_history.c +Norme: ./src/history/history.c +Norme: ./src/history/history_parsing_toolz_2.c +Norme: ./src/history/history_parsing_toolz.c +Norme: ./src/history/list_toolz.c +Norme: ./src/job_control/builtin_bg.c +Norme: ./src/history/history_parsing.c +Norme: ./src/glob/match_pattern.c +Norme: ./src/job_control/builtin_fg.c +Norme: ./src/job_control/do_job_notification.c +Norme: ./src/history/surch_in_history.c +Norme: ./src/job_control/has_running_job.c +Norme: ./src/job_control/has_stopped_job.c +Norme: ./src/job_control/job_cmp_id.c +Norme: ./src/job_control/job_format.c +Norme: ./src/job_control/job_format_head.c +Norme: ./src/job_control/job_free.c +Norme: ./src/job_control/job_addprocess.c +Norme: ./src/job_control/job_getprocess.c +Norme: ./src/job_control/job_hup_all.c +Norme: ./src/job_control/job_is_completed.c +Norme: ./src/job_control/builtin_jobs.c +Norme: ./src/job_control/job_is_stopped.c +Norme: ./src/job_control/job_notify_change.c +Norme: ./src/job_control/job_getrank.c +Norme: ./src/job_control/job_run.c +Norme: ./src/job_control/job_notify_new.c +Norme: ./src/job_control/job_update_id.c +Norme: ./src/job_control/job_remove.c +Norme: ./src/job_control/job_update_status.c +Norme: ./src/job_control/mark_job_as_running.c +Norme: ./src/job_control/pprint_brace.c +Norme: ./src/job_control/pprint_case.c +Norme: ./src/job_control/pprint_cmd.c +Norme: ./src/job_control/pprint_for.c +Norme: ./src/job_control/pprint_function.c +Norme: ./src/job_control/pprint_if.c +Norme: ./src/job_control/pprint_subshell.c +Norme: ./src/job_control/job_wait.c +Norme: ./src/job_control/pprint_while.c +Norme: ./src/job_control/process_cmp_pid.c +Norme: ./src/job_control/pprint_until.c +Norme: ./src/job_control/process_free.c +Norme: ./src/job_control/put_job_in_background.c +Norme: ./src/job_control/sigchld_handler.c +Norme: ./src/job_control/sigint_handler.c +Norme: ./src/job_control/sigtstp_handler.c +Norme: ./src/job_control/sigttin_handler.c +Norme: ./src/job_control/sigttou_handler.c +Norme: ./src/lexer/get_lexer_stack.c +Norme: ./src/job_control/put_job_in_foreground.c +Error (line 27): bad indentation +Error (line 27): C++ comment +Norme: ./src/lexer/get_lexer_stack2.c +Norme: ./src/lexer/do_lexer_routine.c +Norme: ./src/lexer/get_state_global.c +Norme: ./src/lexer/get_state_redir.c +Norme: ./src/lexer/insert_newline.c +Norme: ./src/lexer/keep_last_type.c +Norme: ./src/lexer/isrw_delim.c +Norme: ./src/lexer/lexer_backslash.c +Norme: ./src/lexer/get_reserved_words.c +Norme: ./src/lexer/lexer_curly_braces.c +Norme: ./src/job_control/process_format.c +Norme: ./src/lexer/lexer_default.c +Norme: ./src/lexer/lexer_bquote.c +Norme: ./src/lexer/lexer_destroy.c +Norme: ./src/lexer/lexer_delim.c +Norme: ./src/lexer/lexer_end.c +Norme: ./src/lexer/lexer_heredoc.c +Norme: ./src/lexer/lexer_dquote.c +Norme: ./src/lexer/lexer_great.c +Norme: ./src/lexer/lexer_init.c +Norme: ./src/lexer/lexer_less.c +Norme: ./src/lexer/lexer_newline.c +Norme: ./src/lexer/lexer_lex.c +Norme: ./src/lexer/lexer_quote.c +Norme: ./src/lexer/lexer_paren.c +Norme: ./src/lexer/lexer_number.c +Norme: ./src/lexer/lexer_sep.c +Norme: ./src/lexer/token_cmp_type.c +Norme: ./src/lexer/token_free.c +Norme: ./src/lexer/token_init.c +Norme: ./src/lexer/lexer_word.c +Norme: ./src/lexer/token_print.c +Norme: ./src/line_editing/copy_cut_paste/underline_down.c +Norme: ./src/lexer/token_append.c +Norme: ./src/line_editing/control_features.c +Norme: ./src/line_editing/copy_cut_paste/underline_end.c +Norme: ./src/line_editing/copy_cut_paste/underline_function.c +Norme: ./src/line_editing/copy_cut_paste/underline_home.c +Norme: ./src/line_editing/copy_cut_paste/underline_left.c +Norme: ./src/line_editing/copy_cut_paste/underline_reset.c +Norme: ./src/line_editing/copy_cut_paste/underline_up.c +Norme: ./src/line_editing/copy_cut_paste/underline_right.c +Norme: ./src/line_editing/copy_cut_paste/copy_cut_paste.c +Norme: ./src/line_editing/init_line/init_history.c +Norme: ./src/line_editing/init_line/init_line.c +Norme: ./src/line_editing/init_line/init_termcaps.c +Norme: ./src/line_editing/lib_line_editing/ft_nb_line.c +Norme: ./src/line_editing/ft_prompt.c +Norme: ./src/line_editing/get_key.c +Norme: ./src/line_editing/lib_line_editing/toolz.c +Norme: ./src/line_editing/lib_line_editing/tool_line.c +Norme: ./src/line_editing/lib_line_editing/tool_line_2.c +Norme: ./src/line_editing/lib_line_editing/toolz_parseur.c +Norme: ./src/line_editing/lib_line_editing/toolz_termcaps.c +Norme: ./src/line_editing/lib_line_editing/toolz2.c +Norme: ./src/line_editing/move_term/home_end.c +Norme: ./src/line_editing/move_term/move_left_and_right.c +Norme: ./src/line_editing/print_del_completion/completion.c +Norme: ./src/line_editing/move_term/move_up_and_down.c +Norme: ./src/line_editing/readline.c +Norme: ./src/line_editing/resize.c +Norme: ./src/main/data_exit.c +Norme: ./src/line_editing/print_del_completion/queue.c +Norme: ./src/main/data_singleton.c +Norme: ./src/line_editing/move_term/move_to_word.c +Norme: ./src/line_editing/print_del_completion/print_and_del.c +Norme: ./src/main/data_init.c +Norme: ./src/main/ft_putast.c +Error (line 15): function ft_putast has 83 lines +Error (line 15): declarations must be followed by one empty line in ft_putast +Error (line 19): Empty line +Error (line 52, col 21): missing space around == +Norme: ./src/main/shell_reset.c +Norme: ./src/main/main.c +Norme: ./src/main/shell_init.c +Norme: ./src/parser/add_bang.c +Norme: ./src/parser/add_case.c +Norme: ./src/parser/add_condition.c +Norme: ./src/parser/add_func.c +Norme: ./src/parser/add_cmd.c +Norme: ./src/parser/add_number.c +Norme: ./src/parser/add_sep.c +Norme: ./src/parser/add_loop.c +Norme: ./src/parser/add_subshell.c +Norme: ./src/parser/do_parser_routine.c +Norme: ./src/parser/error_syntax.c +Norme: ./src/parser/add_redir.c +Norme: ./src/parser/build_tree.c +Norme: ./src/parser/ft_parse.c +Norme: ./src/parser/parser_destroy.c +Norme: ./src/parser/parser_init.c +Norme: ./src/parser/heredoc_parser.c +Norme: ./src/parser/pop_stack.c +Norme: ./src/parser/push_stack.c +Norme: ./src/parser/produce_sym.c +Norme: ./src/parser/redir_init.c +Norme: ./src/parser/stack_init.c +Norme: ./src/parser/sym_free.c +Norme: ./src/parser/tree_func_free.c +Norme: ./src/parser/tree_wrapper.c +Norme: ./src/parser/read_stack.c +Error (line 15): function read_state has 203 lines +Norme: ./src/parser/aggregate_sym.c +Error (line 401): C++ comment +Error (line 402): C++ comment +Error (line 403): C++ comment +Norme: ./src/parser/eval_sym.c +Error (line 1300): C++ comment diff --git a/42sh/minishell_error b/42sh/minishell_error index 7fc58653..883caec1 100644 --- a/42sh/minishell_error +++ b/42sh/minishell_error @@ -1,4 +1,4 @@ -...x...~......xx....~.~.~..........xxx....xxx...~.xxx. +...x...~......xx....~.~.~......x....x.....x........... ---------------------------------------------------------------- @@ -11,10 +11,10 @@  01: export PATH="" STDIN: - 01: write_on_stdout "TOKEN201703241735" + 01: write_on_stdout "TOKEN201703242314" STDOUT: - FAILURE expected_to match_regex `TOKEN201703241735` + FAILURE expected_to match_regex `TOKEN201703242314`  (no output) STDERR: @@ -79,15 +79,15 @@ 05: SHELL=/bin/zsh 06: HOMEBREW_TEMP=/tmp/ariard/Homebrew/Temp 07: TMPDIR=/var/folders/zz/zyxvpxvq6csfxvn_n0002_2m000khn/T/ - 08: Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.LmcFivfwkY/Render + 08: Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.UJksyURLXc/Render 09: TERM_PROGRAM_VERSION=3.0.10 - 10: TERM_SESSION_ID=w0t0p1:D3D230F7-7E75-4A5C-B793-6A5C4DAD3F83 + 10: TERM_SESSION_ID=w0t0p0:162D7F62-BEB1-405A-B3D5-E18A8A96E577 11: ZSH=/Users/ariard/.oh-my-zsh 12: USER=ariard - 13: SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.u4JR4EZzBG/Listeners + 13: SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.zEo8Maujhn/Listeners 14: __CF_USER_TEXT_ENCODING=0x4A15:0x0:0x0 15: PAGER=less - 16: TMUX=/private/tmp/tmux-18965/default,73780,2 + 16: TMUX=/private/tmp/tmux-18965/default,22653,2 17: HOMEBREW_CACHE=/tmp/ariard/Homebrew/Caches 18: LSCOLORS=Gxfxcxdxbxegedabagacad 19: PATH=/Users/ariard/.brew/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/munki://Users/ariard/local/bin @@ -101,7 +101,7 @@ 27: SHLVL=4 28: HOME=/Users/ariard 29: COLORFGBG=7;0 - 30: ITERM_SESSION_ID=w0t0p1:D3D230F7-7E75-4A5C-B793-6A5C4DAD3F83 + 30: ITERM_SESSION_ID=w0t0p0:162D7F62-BEB1-405A-B3D5-E18A8A96E577 31: LOGNAME=ariard 32: LESS=-R 33: LC_CTYPE=en_US.UTF-8 @@ -144,15 +144,15 @@ 05: SHELL=/bin/zsh 06: HOMEBREW_TEMP=/tmp/ariard/Homebrew/Temp 07: TMPDIR=/var/folders/zz/zyxvpxvq6csfxvn_n0002_2m000khn/T/ - 08: Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.LmcFivfwkY/Render + 08: Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.UJksyURLXc/Render 09: TERM_PROGRAM_VERSION=3.0.10 - 10: TERM_SESSION_ID=w0t0p1:D3D230F7-7E75-4A5C-B793-6A5C4DAD3F83 + 10: TERM_SESSION_ID=w0t0p0:162D7F62-BEB1-405A-B3D5-E18A8A96E577 11: ZSH=/Users/ariard/.oh-my-zsh 12: USER=ariard - 13: SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.u4JR4EZzBG/Listeners + 13: SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.zEo8Maujhn/Listeners 14: __CF_USER_TEXT_ENCODING=0x4A15:0x0:0x0 15: PAGER=less - 16: TMUX=/private/tmp/tmux-18965/default,73780,2 + 16: TMUX=/private/tmp/tmux-18965/default,22653,2 17: HOMEBREW_CACHE=/tmp/ariard/Homebrew/Caches 18: LSCOLORS=Gxfxcxdxbxegedabagacad 19: PATH=/Users/ariard/.brew/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/munki://Users/ariard/local/bin @@ -166,7 +166,7 @@ 27: SHLVL=4 28: HOME=/Users/ariard 29: COLORFGBG=7;0 - 30: ITERM_SESSION_ID=w0t0p1:D3D230F7-7E75-4A5C-B793-6A5C4DAD3F83 + 30: ITERM_SESSION_ID=w0t0p0:162D7F62-BEB1-405A-B3D5-E18A8A96E577 31: LOGNAME=ariard 32: LESS=-R 33: LC_CTYPE=en_US.UTF-8 @@ -261,26 +261,24 @@ ---------------------------------------------------------------- -minishell/builtins/env/005-set-variables (FAILED) +minishell/builtins/cd/options/002-oldpwd (FAILED) Description: - The purpose of this test is to check that the builtin `env` can modify or set multiple environment variables before executing the given command. - - Before test: - 01: export VARTEST1="OLD_VALUE" + The purpose of this test is to check that using `-` as first argument with the builtin `cd` results in moving the previous current directory. STDIN: - 01: env VARTEST1=TOKEN201703241735_1 VARTEST2=TOKEN201703241735_2 VARTEST3=TOKEN201703241735_3 ./display_env + 01: cd / + 02: cd - + 03: /Users/ariard/Projects/42sh/42ShellTester/tmp/display_pwd STDOUT: - FAILURE expected_to match_regex `VARTEST1=TOKEN201703241735_1` - FAILURE expected_to match_regex `VARTEST2=TOKEN201703241735_2` - FAILURE expected_to match_regex `VARTEST3=TOKEN201703241735_3` - (no output) + FAILURE expected_to match_regex `PWD:/Users/ariard/Projects/42sh/42ShellTester/tmp:PWD` + 01: /Users/ariard + 02: PWD:/Users/ariard:PWD STDERR: - FAILURE expected_to be_empty - 01: ../../42sh: env: VARTEST1=TOKEN201703241735_1: No such file or directory + SUCCESS expected_to be_empty + (no output) ---------------------------------------------------------------- @@ -308,31 +306,6 @@ ---------------------------------------------------------------- -minishell/builtins/env/errors/002-illegal-option (FAILED) - - Description: - The purpose of this test is to check that using the builtin `env` with an invalid option results in an error and failure exit status. - - Before test: - 01: rm -f -- "-w" - - STDIN: - 01: env -w - - STDOUT: - (no output) - - STDERR: - SUCCESS expected_to_not be_empty - SUCCESS might match_regex `([Ii]nvalid|[Ii]llegal) (option|argument)` - 01: env: invalid option -w - 02: ../../42sh: usage: env [-i] [name=value]... [utility [argument...]] - - MISC: - FAILURE expected_to_not exit_with_status `0` - ----------------------------------------------------------------- - minishell/builtins/exit/errors/001-too-many-args (FAILED) Description: @@ -340,10 +313,10 @@ STDIN:  01: exit 21 42 - 02: ./write_on_stdout TOKEN201703241735 + 02: ./write_on_stdout TOKEN201703242314 STDOUT: - FAILURE expected_to match_regex `TOKEN201703241735` + FAILURE expected_to match_regex `TOKEN201703242314`  (no output) STDERR: @@ -354,209 +327,6 @@ MISC:  FAILURE expected_to exit_with_status `0` ----------------------------------------------------------------- - -minishell/builtins/exit/errors/002-non-numeric-argument (FAILED) - - Description: - The purpose of this test is to check that using a non-numeric argument with the builtin `exit` results in the Shell termination and an error on standard error. - - STDIN: - 01: exit abc - 02: ./write_on_stdout TOKEN201703241735 - - STDOUT: - SUCCESS expected_to_not match_regex `TOKEN201703241735` - (no output) - - STDERR: - SUCCESS might_not be_empty - SUCCESS might match_regex `[Nn]umeric argument required` - 01: ../../42sh: exit: numeric argument required - - MISC: - FAILURE expected_to_not exit_with_status `0` - ----------------------------------------------------------------- - -minishell/builtins/mixed/001-setenv-unsetenv (FAILED) - - Description: - The purpose of this test is to check that setting and unsetting environment variable with the builtins `setenv` and `unsetenv` (or `export` and `unset`) works together. - - Before test: - 01: # unset all environment variables - 02: for VARIABLE in $(env | awk 'BEGIN {FS="="} {print $1}'); do unset "${VARIABLE}"; done; - - STDIN: - 01: setenv TEST1 - 02: setenv TEST2 - 03: unsetenv TEST1 - 04: unsetenv TEST2 - 05: ./display_env - 06: - 07: export TEST1 - 08: export TEST2 - 09: unset TEST1 - 10: unset TEST2 - 11: ./display_env - - STDOUT: - FAILURE expected_to_not match_regex `TEST1=` - FAILURE expected_to_not match_regex `TEST2=` - 01: ------------------------------ - 02: _=../../42sh - 03: ?=0 - 04: SHLVL=1 - 05: TEST1= - 06: TEST2= - 07: ------------------------------ - 08: TOTAL ENVIRONMENT VARIABLES: 5 - 09: ------------------------------ - 10: _=../../42sh - 11: ?=0 - 12: SHLVL=1 - 13: TEST1= - 14: TEST2= - 15: ------------------------------ - 16: TOTAL ENVIRONMENT VARIABLES: 5 - - STDERR: - (no output) - ----------------------------------------------------------------- - -minishell/builtins/setenv/004-invalid-identifier (WARNING) - - Description: - The purpose of this test is to check that using a wrong variable name with the builtin `setenv` (or `export`) results in error. - - STDIN: - 01: setenv 42 - 02: export 42 - - STDOUT: - SUCCESS might be_empty - (no output) - - STDERR: - SUCCESS expected_to_not be_empty - WARNING might match_regex `(not.*identifier|must begin.*letter)` - 01: ../../42sh: setenv: 42: invalid variable name - 02: ../../42sh: export: 42: invalid variable name - ----------------------------------------------------------------- - -minishell/builtins/unsetenv/001-unsetenv-first-elem (FAILED) - - Description: - This test was made to control if the Head of the env list was set correctly. - So we unset all the environment variables inside the tester environment and set a new one. - Thereafter we are unseting inside the tested shell. We are using env to check if the last head was remove correctly. - - Before test: - 01: # unset all environment variables - 02: for VARIABLE in $(env | awk 'BEGIN {FS="="} {print $1}'); do unset "${VARIABLE}"; done; - 03: - 04: export VARTEST="TOKEN201703241735" - - STDIN: - 01: unsetenv VARTEST - 02: unset VARTEST - 03: ./display_env - - STDOUT: - FAILURE expected_to_not match_regex `VARTEST=` - 01: ------------------------------ - 02: VARTEST=TOKEN201703241735 - 03: _=../../42sh - 04: ?=0 - 05: SHLVL=1 - 06: ------------------------------ - 07: TOTAL ENVIRONMENT VARIABLES: 4 - - STDERR: - (no output) - ----------------------------------------------------------------- - -minishell/builtins/unsetenv/002-unsetenv-mult-envp (FAILED) - - Description: - This test was made to check if we can unset multiple arguments. - So we unset all the environment variables inside the tester environment and set a 3 new variables. - Thereafter we are unseting all of them inside the tested shell. - - Before test: - 01: # unset all environment ariables - 02: for VARIABLE in $(env | awk 'BEGIN {FS="="} {print $1}'); do unset "${VARIABLE}"; done; - 03: - 04: export ONE="TOKEN201703241735_1" - 05: export TWO="TOKEN201703241735_2" - 06: export THREE="TOKEN201703241735_3" - - STDIN: - 01: unsetenv ONE - 02: unsetenv TWO - 03: unsetenv THREE - 04: unset ONE - 05: unset TWO - 06: unset THREE - 07: ./display_env - - STDOUT: - SUCCESS expected_to_not match_regex `ONE=` - SUCCESS expected_to_not match_regex `TWO=` - FAILURE expected_to_not match_regex `THREE=` - 01: ------------------------------ - 02: THREE=TOKEN201703241735_3 - 03: _=../../42sh - 04: ?=0 - 05: SHLVL=1 - 06: ------------------------------ - 07: TOTAL ENVIRONMENT VARIABLES: 4 - - STDERR: - (no output) - ----------------------------------------------------------------- - -minishell/builtins/unsetenv/003-unsetenv-mult-envp-inline (FAILED) - - Description: - This test was made to check if we can unset multiple arguments INLINE. - So we unset all the environment variables inside the tester environment and set a 3 new variables. - Thereafter we are unseting all of them INLINE inside the tested shell. - - Before test: - 01: # unset all variables - 02: for VARIABLE in $(env | awk 'BEGIN {FS="="} {print $1}'); do unset "${VARIABLE}"; done; - 03: - 04: export ONE="TOKEN201703241735_1" - 05: export TWO="TOKEN201703241735_2" - 06: export THREE="TOKEN201703241735_3" - - STDIN: - 01: unsetenv ONE TWO THREE - 02: unset ONE TWO THREE - 03: ./display_env - - STDOUT: - SUCCESS expected_to_not match_regex `ONE=` - FAILURE expected_to_not match_regex `TWO=` - FAILURE expected_to_not match_regex `THREE=` - 01: ------------------------------ - 02: THREE=TOKEN201703241735_3 - 03: TWO=TOKEN201703241735_2 - 04: _=../../42sh - 05: ?=0 - 06: SHLVL=1 - 07: ------------------------------ - 08: TOTAL ENVIRONMENT VARIABLES: 5 - - STDERR: - (no output) - Total tests: 54 -Total failed tests: 12 +Total failed tests: 6 Total pending tests: 0 diff --git a/42sh/sample/brace/brace_01.sh b/42sh/sample/brace similarity index 100% rename from 42sh/sample/brace/brace_01.sh rename to 42sh/sample/brace diff --git a/42sh/sample/case/case.sh b/42sh/sample/case.sh similarity index 100% rename from 42sh/sample/case/case.sh rename to 42sh/sample/case.sh diff --git a/42sh/sample/comment.sh b/42sh/sample/comment.sh index 9d021c74..0680845f 100644 --- a/42sh/sample/comment.sh +++ b/42sh/sample/comment.sh @@ -1,2 +1,2 @@ -ls | cat -pwd ; cd +ls # Da comment +pwd diff --git a/42sh/sample/dir.sh b/42sh/sample/dir.sh deleted file mode 100644 index f413e465..00000000 --- a/42sh/sample/dir.sh +++ /dev/null @@ -1 +0,0 @@ -file1 +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/03 11:57:53 by jhalford #+# #+# */ -/* Updated: 2017/03/24 23:03:58 by jhalford ### ########.fr */ +/* Updated: 2017/03/25 00:52:32 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" -#define CDOPT_L (1 << 0) -#define CDOPT_P (1 << 1) -#define HAS_CDOPT_P(x) (x & CD_OPT_P) -#define HAS_CDOPT_L(x) (x & CD_OPT_L) -#define CDERR_1 "cd: no such file or directory: %s" -#define CDERR_2 "cd: HOME not set" -#define CDERR_3 "cd: too many arguments{eoc}" +#define BT_CD_L (1 << 0) +#define BT_CD_P (1 << 1) +#define CD_USAGE "usage: cd [-L|-P] [dir]" +#define CDERR_1 "cd: no such file or directory: %s" +#define CDERR_2 "cd: %s not set" +#define CDERR_3 "cd: too many arguments" -static g_cliopts g_cdotps = +static t_cliopts g_cdopts[] = { - {'P', NULL, CD_OPT_P, CD_OPT_L, NULL}, - {'L', NULL, CD_OPT_L, CD_OPT_P, NULL}, + {'P', NULL, BT_CD_P, BT_CD_L, NULL}, + {'L', NULL, BT_CD_L, BT_CD_P, NULL}, {0, NULL, 0, 0, NULL}, -} +}; -static char *builtin_cd_special(char *const av[], char *const env[]) +static char *bt_cd_target(char *arg) { char *target; - if (!*av) + if (!arg) { - if (!(target = ft_getenv((char**)env, "HOME"))) - { - SH_ERR(CDERR_2); - return (NULL); - } + if (!(target = ft_getenv(data_singleton()->env, "HOME"))) + SH_ERR(CDERR_2, "HOME"); } - else if (*av && *(av + 1)) + else if (ft_strcmp(arg, "-") == 0) { - SH_ERR(CDERR_3); - return (NULL); + DG("doing -"); + if (!(target = ft_getenv(data_singleton()->env, "OLDPWD"))) + SH_ERR(CDERR_2, "OLDPWD"); + DG("found OLDPWD %s", target); } - else if (ft_strcmp(*av, "-") == 0) - target = ft_strdup(ft_getenv((char**)env, "OLDPWD")); else - target = *av; + target = arg; return (target); } @@ -56,32 +52,30 @@ void setwd(char *var) char *cwd; cwd = getcwd(NULL, 0); - builtin_setenv(path, (char*[4]){"setenv", var, cwd, NULL}, envp); + builtin_setenv(NULL, (char*[]){"cd", var, cwd, NULL}, NULL); free(cwd); } int builtin_cd(const char *path, char *const av[], char *const envp[]) { - int i; - int opts; - char *target; + char *target; + t_data_template data; - data->flag = CD_OPT_L; - if (cliopts(av, g_cdopts, &data)) - i = builtin_cd_opts(av, &opts); + (void)path; + (void)envp; + data.flag = BT_CD_L; + if (cliopts_get((char**)av, g_cdopts, &data)) + return (ft_perror("cd") && SH_ERR(CD_USAGE)); + if (data.av_data[0] && data.av_data[1]) + return (SH_ERR(CDERR_3) && SH_ERR(CD_USAGE)); + if (!(target = bt_cd_target(*data.av_data))) + return (1); setwd("OLDPWD"); - if (!(target = builtin_cd_special(av + i, envp))) - return (1); if (chdir(target)) - { - SH_ERR(CDERR_1, target); - return (1); - } - else if (target != av[i]) + return (SH_ERR(CDERR_1, target)); + else if (target != *data.av_data) ft_printf("%s\n", target); setwd("PWD"); - if (!ft_strcmp(*(av + i), "-")) - free(target); return (0); } diff --git a/42sh/src/builtin/builtin_env.c b/42sh/src/builtin/builtin_env.c index b0771237..b23d5773 100644 --- a/42sh/src/builtin/builtin_env.c +++ b/42sh/src/builtin/builtin_env.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/22 16:20:31 by gwojda #+# #+# */ -/* Updated: 2017/03/25 01:15:38 by wescande ### ########.fr */ +/* Updated: 2017/03/25 01:19:51 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/builtin/builtin_exit.c b/42sh/src/builtin/builtin_exit.c index f9625fc9..8ef2c609 100644 --- a/42sh/src/builtin/builtin_exit.c +++ b/42sh/src/builtin/builtin_exit.c @@ -6,13 +6,14 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/28 14:28:41 by jhalford #+# #+# */ -/* Updated: 2017/03/21 18:10:58 by ariard ### ########.fr */ +/* Updated: 2017/03/24 23:35:26 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" #define EXITERR_0 "exit: numeric argument required" +#define EXITERR_1 "exit: too many argument required" int builtin_exit(const char *path, char *const av[], char *const envp[]) { @@ -27,9 +28,12 @@ int builtin_exit(const char *path, char *const av[], char *const envp[]) if (has_stopped_job() || has_running_job()) return (SH_ERR("There are running and/or stopped jobs")); } - if (av && av[1] && !ft_stris(av[1], ft_isdigit)) + if (av && av[1] && !ft_stris(av[1], ft_isdigit) && (status = 255)) SH_ERR(EXITERR_0); - status = (av && av[1]) ? + else if (av && av[0] && av[1] && av[2]) + return (SH_ERR(EXITERR_1)); + else + status = (av && av[1]) ? ft_atoi(av[1]) : ft_atoi(ft_getenv(data_singleton()->env, "?")); if (SH_IS_INTERACTIVE(data_singleton()->opts)) tcsetattr(STDIN, TCSANOW, &data_singleton()->jobc.shell_tmodes); diff --git a/42sh/src/builtin/builtin_export.c b/42sh/src/builtin/builtin_export.c index e2fa3f8d..04021737 100644 --- a/42sh/src/builtin/builtin_export.c +++ b/42sh/src/builtin/builtin_export.c @@ -6,12 +6,15 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/15 11:39:37 by gwojda #+# #+# */ -/* Updated: 2017/03/24 19:33:00 by wescande ### ########.fr */ +/* Updated: 2017/03/25 00:57:26 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" +#define BT_EXPORT_LP (1 << 0) +#define EXPORT_USAGE "usage: export [name[=value] ...] or export -p" + static t_cliopts g_export_opts[] = { {'p', NULL, BT_EXPORT_LP, 0, NULL}, @@ -44,7 +47,7 @@ int builtin_export( (void)path; data.flag = 0; if (cliopts_get((char**)av, g_export_opts, &data)) - return (ft_perror("export") ? 1 : 1); + return (ft_perror("export") && SH_ERR(EXPORT_USAGE)); if (data.flag & BT_EXPORT_LP) return (bt_export_print()); av = data.av_data; @@ -57,7 +60,8 @@ int builtin_export( *(equal++) = 0; else equal = ft_getenv(data_singleton()->local_var, *av); - data.flag += builtin_setenv("internal", (char*[]){"export", *av, equal}, envp); + data.flag += builtin_setenv("internal", (char*[]){"export", *av, + equal}, envp); builtin_unsetenv("internal", (char*[]){"local", *av, NULL}, NULL); av++; } diff --git a/42sh/src/builtin/builtin_read.c b/42sh/src/builtin/builtin_read.c index c250a9b5..899b4f80 100644 --- a/42sh/src/builtin/builtin_read.c +++ b/42sh/src/builtin/builtin_read.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/20 15:01:45 by jhalford #+# #+# */ -/* Updated: 2017/03/24 16:23:51 by gwojda ### ########.fr */ +/* Updated: 2017/03/24 23:30:45 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/builtin/builtin_setenv.c b/42sh/src/builtin/builtin_setenv.c index 6b410230..3f79f8e2 100644 --- a/42sh/src/builtin/builtin_setenv.c +++ b/42sh/src/builtin/builtin_setenv.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/28 14:25:17 by jhalford #+# #+# */ -/* Updated: 2017/03/24 23:08:13 by wescande ### ########.fr */ +/* Updated: 2017/03/24 23:14:52 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/builtin/is_builtin.c b/42sh/src/builtin/is_builtin.c index dd931eba..a86f6cd6 100644 --- a/42sh/src/builtin/is_builtin.c +++ b/42sh/src/builtin/is_builtin.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 13:09:57 by jhalford #+# #+# */ -/* Updated: 2017/03/24 15:12:42 by wescande ### ########.fr */ +/* Updated: 2017/03/24 23:29:53 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/exec_reset.c b/42sh/src/exec/exec_reset.c index 07ab4d0b..b9330b38 100644 --- a/42sh/src/exec/exec_reset.c +++ b/42sh/src/exec/exec_reset.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/08 14:31:42 by jhalford #+# #+# */ -/* Updated: 2017/03/24 20:09:13 by jhalford ### ########.fr */ +/* Updated: 2017/03/24 23:29:00 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,7 +22,7 @@ int exec_reset_job(t_job *job) return (0); } -int exec_pushfds() +int exec_pushfds(void) { int i; t_exec *exec; @@ -34,7 +34,7 @@ int exec_pushfds() return (0); } -int exec_popfds() +int exec_popfds(void) { int i; t_exec *exec; diff --git a/42sh/src/exec/redirect_great.c b/42sh/src/exec/redirect_great.c index 8f4fe029..eeb03b91 100644 --- a/42sh/src/exec/redirect_great.c +++ b/42sh/src/exec/redirect_great.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/06 22:03:53 by jhalford #+# #+# */ -/* Updated: 2017/03/24 20:09:09 by jhalford ### ########.fr */ +/* Updated: 2017/03/25 00:57:59 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,7 +22,7 @@ int redirect_great(t_redir *redir) O_WRONLY | O_CREAT | O_TRUNC, 0644)) < 0) { SH_ERR("open(): %s", strerror(errno)); - exit (1); + exit(1); } fd_replace(fdold, fdnew); return (0); diff --git a/42sh/src/job_control/builtin_jobs.c b/42sh/src/job_control/builtin_jobs.c index a23b8184..7ef0e117 100644 --- a/42sh/src/job_control/builtin_jobs.c +++ b/42sh/src/job_control/builtin_jobs.c @@ -6,12 +6,14 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/15 17:43:01 by jhalford #+# #+# */ -/* Updated: 2017/03/24 18:48:46 by jhalford ### ########.fr */ +/* Updated: 2017/03/24 23:33:03 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" +#define JOBS_USAGE "usage: jobs [-l] [id ...]" + t_cliopts g_jobs_opts[] = { {'l', NULL, JOBS_OPT_L, 0, NULL}, @@ -67,14 +69,11 @@ int builtin_jobs(const char *path, char *const av[], char *const envp[]) (void)path; (void)envp; if (!SH_HAS_JOBC(data_singleton()->opts)) - { - DG("no job control :("); return (SH_ERR("jobs: %s", SH_MSG_NOJOBC)); - } do_job_notification(); ft_bzero(&data, sizeof(t_data_template)); if (cliopts_get((char**)av, g_jobs_opts, &data)) - return (ft_perror("jobs")); + return (ft_perror("jobs") && SH_ERR(JOBS_USAGE)); if (!*data.av_data) bt_jobs_all(data.flag); else if (bt_jobs_spec(data.av_data, data.flag)) diff --git a/42sh/src/job_control/put_job_in_foreground.c b/42sh/src/job_control/put_job_in_foreground.c index 14878ae5..aa28235c 100644 --- a/42sh/src/job_control/put_job_in_foreground.c +++ b/42sh/src/job_control/put_job_in_foreground.c @@ -6,12 +6,14 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 14:58:36 by jhalford #+# #+# */ -/* Updated: 2017/03/24 17:26:50 by gwojda ### ########.fr */ +/* Updated: 2017/03/24 23:27:51 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" +#define FGERR_0 "kill(SIGCONT) failed" + int put_job_in_foreground(t_job *j, int cont) { t_jobc *jobc; @@ -23,8 +25,7 @@ int put_job_in_foreground(t_job *j, int cont) { tcsetattr(STDIN, TCSADRAIN, &j->tmodes); if (kill(-j->pgid, SIGCONT) < 0) - DG("kill(SIGCONT) failed"); - //msg d'erreur a changer ici + SH_ERR(FGERR_0); } job_wait(j->id); if (SH_IS_INTERACTIVE(data_singleton()->opts)) diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index d96b37c6..de3ee0de 100644 --- a/42sh/src/main/main.c +++ b/42sh/src/main/main.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/20 14:45:40 by gwojda #+# #+# */ -/* Updated: 2017/03/24 20:02:55 by jhalford ### ########.fr */ +/* Updated: 2017/03/24 22:52:56 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -52,12 +52,12 @@ static int handle_instruction(t_list **token, t_btree **ast) else if (ret > 0) break ; } + if (SH_IS_INTERACTIVE(data->opts) && data->lexer.str) + ft_add_str_in_history(data->lexer.str); if (data->parser.state == SUCCESS && ft_exec(ast) < 0) exit(1); else if (data->parser.state != SUCCESS) set_exitstatus(1, 1); - if (SH_IS_INTERACTIVE(data->opts) && data->lexer.str) - ft_add_str_in_history(data->lexer.str); return (0); } diff --git a/42sh/src/parser/add_func.c b/42sh/src/parser/add_func.c index 7517b705..9a4e85d5 100644 --- a/42sh/src/parser/add_func.c +++ b/42sh/src/parser/add_func.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/24 23:43:07 by ariard #+# #+# */ -/* Updated: 2017/03/24 16:51:13 by ariard ### ########.fr */ +/* Updated: 2017/03/24 23:23:35 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -59,7 +59,7 @@ int add_func_cmd(t_btree **ast, t_list **lst) if ((token->type == TK_CASE || token->type == TK_WHILE || token->type == TK_IF || token->type == TK_UNTIL || token->type == TK_FOR || token->type == SUBSHELL - || token->type == TK_LBRACE || token->type == TK_PAREN_OPEN) + || token->type == TK_LBRACE || token->type == TK_PAREN_OPEN) && node->type == FNAME) node->nest++; if ((token->type == TK_DONE || token->type == TK_ESAC diff --git a/42sh/src/parser/aggregate_sym.c b/42sh/src/parser/aggregate_sym.c index 0a2dd092..d589639d 100644 --- a/42sh/src/parser/aggregate_sym.c +++ b/42sh/src/parser/aggregate_sym.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/11 15:58:38 by ariard #+# #+# */ -/* Updated: 2017/03/24 19:26:26 by ariard ### ########.fr */ +/* Updated: 2017/03/24 23:26:22 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -397,7 +397,3 @@ int aggregate_sym(t_list **stack, t_sym *new_sym, t_parstate *state) } return (0); } - -// DG("aggregate head %s && sym %s", read_state(*head), read_state(*new_sym)); -// DG("MATH: %s", read_state(g_aggrematch[i].new_sym)); -// DG("stack after pop %s", read_state(*head)); diff --git a/42sh/src/parser/eval_sym.c b/42sh/src/parser/eval_sym.c index dfd9e6cb..a8582698 100644 --- a/42sh/src/parser/eval_sym.c +++ b/42sh/src/parser/eval_sym.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/11 16:11:21 by ariard #+# #+# */ -/* Updated: 2017/03/24 19:25:44 by ariard ### ########.fr */ +/* Updated: 2017/03/24 23:26:06 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -1296,5 +1296,3 @@ int eval_sym(t_list **stack, t_sym new_sym) } return (1); } - -//DG("eval head %s && sym %s", read_state(*head), read_state(new_sym)); diff --git a/42sh/test.c b/42sh/test.c new file mode 100644 index 00000000..4a4f1bfd --- /dev/null +++ b/42sh/test.c @@ -0,0 +1,7 @@ +#include "stdio.h" + +int main(void) +{ + printf("hello"); + return (0); +}