diff --git a/42sh/Makefile b/42sh/Makefile index b39cae83..ed8d6f20 100644 --- a/42sh/Makefile +++ b/42sh/Makefile @@ -6,7 +6,7 @@ # By: wescande +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2016/08/29 21:32:58 by wescande #+# #+# # -# Updated: 2017/03/27 16:09:37 by jhalford ### ########.fr # +# Updated: 2017/03/27 17:02:38 by gwojda ### ########.fr # # # # **************************************************************************** # diff --git a/42sh/includes/completion.h b/42sh/includes/completion.h index dcd66200..c2ac1d27 100644 --- a/42sh/includes/completion.h +++ b/42sh/includes/completion.h @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/02/18 11:13:04 by alao #+# #+# */ -/* Updated: 2017/03/27 09:30:01 by alao ### ########.fr */ +/* Updated: 2017/03/27 17:42:17 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -189,5 +189,6 @@ int ft_sstrlen(char **s); char *ft_sstrtostr(char **s, char *sep); char *ft_add_escape(char *str, char to_escape); void c_lst_id(t_comp *c); +char *c_strdupi(char *s, int (*f)(char)); #endif diff --git a/42sh/includes/ft_readline.h b/42sh/includes/ft_readline.h index e4412ffc..f08d88b2 100644 --- a/42sh/includes/ft_readline.h +++ b/42sh/includes/ft_readline.h @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/23 10:35:44 by gwojda #+# #+# */ -/* Updated: 2017/03/23 16:16:57 by gwojda ### ########.fr */ +/* Updated: 2017/03/27 18:00:07 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -134,6 +134,7 @@ int ft_nb_of_line(char *str, size_t pos); int ft_get_size_prev(char *str, size_t pos); void sigwinch_resize(int sig); size_t ft_hist_len(void); +int hist_is_delim(char c); int underline_right(char **str, size_t *pos, size_t pos_ref); int underline_left(char **str, size_t *pos, size_t pos_ref); diff --git a/42sh/libft/includes/cliopts.h b/42sh/libft/includes/cliopts.h index 60ec9ec3..17bbfcc7 100644 --- a/42sh/libft/includes/cliopts.h +++ b/42sh/libft/includes/cliopts.h @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* cliopts.h :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: jhalford +#+ +:+ +#+ */ +/* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/14 20:22:56 by jhalford #+# #+# */ -/* Updated: 2017/03/27 17:59:47 by jhalford ### ########.fr */ +/* Updated: 2017/03/27 18:08:04 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/libft/src/lst/ft_lst_delif.c b/42sh/libft/src/lst/ft_lst_delif.c index 7580ea7d..768272b5 100644 --- a/42sh/libft/src/lst/ft_lst_delif.c +++ b/42sh/libft/src/lst/ft_lst_delif.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* ft_lst_delif.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: jhalford +#+ +:+ +#+ */ +/* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/04 11:09:12 by jhalford #+# #+# */ -/* Updated: 2017/03/13 15:36:19 by jhalford ### ########.fr */ +/* Updated: 2017/03/27 17:45:01 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/builtin/builtin_cd.c b/42sh/src/builtin/builtin_cd.c index 99160c42..12f0aca6 100644 --- a/42sh/src/builtin/builtin_cd.c +++ b/42sh/src/builtin/builtin_cd.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/25 18:20:42 by ariard #+# #+# */ -/* Updated: 2017/03/27 18:00:06 by jhalford ### ########.fr */ +/* Updated: 2017/03/27 18:08:13 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/completion/c_match.c b/42sh/src/completion/c_match.c index 77fe9600..36adb113 100644 --- a/42sh/src/completion/c_match.c +++ b/42sh/src/completion/c_match.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/10/15 13:27:14 by alao #+# #+# */ -/* Updated: 2017/03/23 19:02:28 by gwojda ### ########.fr */ +/* Updated: 2017/03/27 17:48:25 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,7 +19,7 @@ static int c_is_delim(char c) return (0); } -static char *c_strdupi(char *s, int (*f)(char)) +char *c_strdupi(char *s, int (*f)(char)) { int i; char *str; diff --git a/42sh/src/completion/completion.c b/42sh/src/completion/completion.c index 74201f51..c3fbae3e 100644 --- a/42sh/src/completion/completion.c +++ b/42sh/src/completion/completion.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/09/20 14:50:33 by alao #+# #+# */ -/* Updated: 2017/03/27 18:01:09 by jhalford ### ########.fr */ +/* Updated: 2017/03/27 18:08:24 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/redirect_dgreat.c b/42sh/src/exec/redirect_dgreat.c index 62e79888..b780e390 100644 --- a/42sh/src/exec/redirect_dgreat.c +++ b/42sh/src/exec/redirect_dgreat.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/06 22:07:37 by jhalford #+# #+# */ -/* Updated: 2017/03/27 18:00:35 by jhalford ### ########.fr */ +/* Updated: 2017/03/27 18:08:33 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/redirect_less.c b/42sh/src/exec/redirect_less.c index bb5cc083..296a9179 100644 --- a/42sh/src/exec/redirect_less.c +++ b/42sh/src/exec/redirect_less.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* redirect_less.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: jhalford +#+ +:+ +#+ */ +/* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/06 22:09:53 by jhalford #+# #+# */ -/* Updated: 2017/03/27 18:00:45 by jhalford ### ########.fr */ +/* Updated: 2017/03/27 18:08:38 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/history/history_parsing.c b/42sh/src/history/history_parsing.c index 45e9eba7..644cda32 100644 --- a/42sh/src/history/history_parsing.c +++ b/42sh/src/history/history_parsing.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/25 11:39:47 by gwojda #+# #+# */ -/* Updated: 2017/03/27 18:01:51 by jhalford ### ########.fr */ +/* Updated: 2017/03/27 18:08:45 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -65,7 +65,7 @@ static int history_parsing_nb_and_name(char *str, int *i) ft_strdupi_w(str + *i + 2)); else if (str[*i + 1] && str[*i + 1] != ' ') ft_realloc_str_history_2(&(data_singleton()->line.input), *i, - ft_strdupi_w(str + *i + 1)); + c_strdupi(str + *i + 1, hist_is_delim)); else return (0); return (1); diff --git a/42sh/src/history/history_parsing_toolz.c b/42sh/src/history/history_parsing_toolz.c index 4c2f00b7..3c384222 100644 --- a/42sh/src/history/history_parsing_toolz.c +++ b/42sh/src/history/history_parsing_toolz.c @@ -6,12 +6,19 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/25 14:09:39 by gwojda #+# #+# */ -/* Updated: 2017/03/16 11:58:10 by gwojda ### ########.fr */ +/* Updated: 2017/03/27 17:59:50 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" +int hist_is_delim(char c) +{ + if (c == ' ' || c == '"') + return (1); + return (0); +} + static char *ft_nget_histo(size_t nb_his) { t_list_history *list; diff --git a/42sh/src/line_editing/copy_cut_paste/copy_cut_paste.c b/42sh/src/line_editing/copy_cut_paste/copy_cut_paste.c index cec171fb..6fb8f6c2 100644 --- a/42sh/src/line_editing/copy_cut_paste/copy_cut_paste.c +++ b/42sh/src/line_editing/copy_cut_paste/copy_cut_paste.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/19 12:45:06 by gwojda #+# #+# */ -/* Updated: 2017/03/24 11:57:45 by gwojda ### ########.fr */ +/* Updated: 2017/03/27 16:59:59 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -104,7 +104,7 @@ int ft_v(char **str, size_t *pos) } ft_current_str(*str, *pos); ft_get_next_str(*str, pos); - ft_putnc('\b', *pos - tmp_pos); + ft_putnc('\b', *pos - tmp_pos + (((*str)[*pos]) ? 1 : 0)); *pos = tmp_pos; return (0); } diff --git a/42sh/src/line_editing/init_line/init_termcaps.c b/42sh/src/line_editing/init_line/init_termcaps.c index b8b2dbdb..475bf580 100644 --- a/42sh/src/line_editing/init_line/init_termcaps.c +++ b/42sh/src/line_editing/init_line/init_termcaps.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 17:33:41 by gwojda #+# #+# */ -/* Updated: 2017/03/21 18:11:13 by gwojda ### ########.fr */ +/* Updated: 2017/03/27 17:37:40 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/line_editing/readline.c b/42sh/src/line_editing/readline.c index 82856a6f..32788265 100644 --- a/42sh/src/line_editing/readline.c +++ b/42sh/src/line_editing/readline.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/15 14:19:48 by gwojda #+# #+# */ -/* Updated: 2017/03/25 18:17:57 by ariard ### ########.fr */ +/* Updated: 2017/03/27 17:38:51 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -35,6 +35,7 @@ int readline(int has_prompt, char **input) if (has_prompt) ret = ft_history_parsing(has_prompt, input); ft_strdel(&data_singleton()->line.copy_tmp); + DG("ret = \"%s\"", *input); if (tcsetattr(0, TCSANOW, ft_save_termios(0)) == -1) return (-1); return (ret); diff --git a/42sh/src/main/shell_init.c b/42sh/src/main/shell_init.c index b3336442..542f1780 100644 --- a/42sh/src/main/shell_init.c +++ b/42sh/src/main/shell_init.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/12 17:23:59 by jhalford #+# #+# */ -/* Updated: 2017/03/27 18:06:12 by jhalford ### ########.fr */ +/* Updated: 2017/03/27 18:08:56 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */