avant de merge

This commit is contained in:
Gautier WOJDA 2017-01-27 17:42:46 +01:00
parent bd33e1c9f2
commit d6c6103bc4
3 changed files with 12 additions and 6 deletions

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/23 10:35:44 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_list_history *list_beg;
} t_line; } t_line;
int builtin_history(const char *path, char *const av[], char *const envp[]);
void ft_check_backslash(char **str); void ft_check_backslash(char **str);
char *ft_strget_history(char *str); char *ft_strget_history(char *str);
void ft_surch_in_history(char **str, size_t *pos); void ft_surch_in_history(char **str, size_t *pos);

View file

@ -3,10 +3,10 @@
/* ::: :::::::: */ /* ::: :::::::: */
/* is_builtin.c :+: :+: :+: */ /* is_builtin.c :+: :+: :+: */
/* +:+ +:+ +:+ */ /* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 13:09:57 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}, {"jobs", &builtin_jobs},
{"fg", &builtin_fg}, {"fg", &builtin_fg},
{"bg", &builtin_bg}, {"bg", &builtin_bg},
{"history", &builtin_history},
{NULL, NULL}, {NULL, NULL},
}; };

View file

@ -6,21 +6,24 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/24 14:54:53 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" #include "minishell.h"
void ft_history_builtin(void) int builtin_history(const char *path, char *const av[], char *const envp[])
{ {
size_t len; size_t len;
t_list_history *head; t_list_history *head;
(void)path;
(void)av;
(void)envp;
head = data_singleton()->line.list_end; head = data_singleton()->line.list_end;
len = 1; len = 1;
if (!head) if (!head)
return ; return (0);
if (head && !head->str) if (head && !head->str)
head = head->next; head = head->next;
while (head && head->str) while (head && head->str)
@ -31,4 +34,5 @@ void ft_history_builtin(void)
++len; ++len;
head = head->next; head = head->next;
} }
return (0);
} }