From d6c6103bc40339ecaf526cc854ef64027e2ff807 Mon Sep 17 00:00:00 2001 From: Gautier WOJDA Date: Fri, 27 Jan 2017 17:42:46 +0100 Subject: [PATCH] avant de merge --- 42sh/includes/ft_readline.h | 3 ++- 42sh/src/builtin/is_builtin.c | 5 +++-- 42sh/src/line-editing/builtin_history.c | 10 +++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/42sh/includes/ft_readline.h b/42sh/includes/ft_readline.h index af343cd1..852800a7 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/01/26 13:36:59 by gwojda ### ########.fr */ +/* Updated: 2017/01/26 14:58:14 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -71,6 +71,7 @@ typedef struct s_line t_list_history *list_beg; } t_line; +int builtin_history(const char *path, char *const av[], char *const envp[]); void ft_check_backslash(char **str); char *ft_strget_history(char *str); void ft_surch_in_history(char **str, size_t *pos); diff --git a/42sh/src/builtin/is_builtin.c b/42sh/src/builtin/is_builtin.c index 7dbdda0c..ce8f22c5 100644 --- a/42sh/src/builtin/is_builtin.c +++ b/42sh/src/builtin/is_builtin.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* is_builtin.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: jhalford +#+ +:+ +#+ */ +/* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 13:09:57 by jhalford #+# #+# */ -/* Updated: 2017/01/09 16:58:13 by jhalford ### ########.fr */ +/* Updated: 2017/01/26 14:58:02 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,6 +22,7 @@ t_stof g_builtin[] = { {"jobs", &builtin_jobs}, {"fg", &builtin_fg}, {"bg", &builtin_bg}, + {"history", &builtin_history}, {NULL, NULL}, }; diff --git a/42sh/src/line-editing/builtin_history.c b/42sh/src/line-editing/builtin_history.c index 76b99fa1..019af98e 100644 --- a/42sh/src/line-editing/builtin_history.c +++ b/42sh/src/line-editing/builtin_history.c @@ -6,21 +6,24 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/24 14:54:53 by gwojda #+# #+# */ -/* Updated: 2017/01/25 15:48:52 by gwojda ### ########.fr */ +/* Updated: 2017/01/26 14:58:41 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" -void ft_history_builtin(void) +int builtin_history(const char *path, char *const av[], char *const envp[]) { size_t len; t_list_history *head; + (void)path; + (void)av; + (void)envp; head = data_singleton()->line.list_end; len = 1; if (!head) - return ; + return (0); if (head && !head->str) head = head->next; while (head && head->str) @@ -31,4 +34,5 @@ void ft_history_builtin(void) ++len; head = head->next; } + return (0); }