merge
This commit is contained in:
commit
08710f9e6b
13 changed files with 14 additions and 44 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */
|
||||
/* Updated: 2017/02/03 15:35:01 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/02/03 17:31:08 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/09 13:30:57 by alao #+# #+# */
|
||||
/* Updated: 2017/02/03 13:30:59 by alao ### ########.fr */
|
||||
/* Updated: 2017/02/03 17:31:46 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -23,18 +23,15 @@ int c_seek_binary(t_data *s, t_comp *c)
|
|||
char **paths;
|
||||
int i;
|
||||
|
||||
DG("SB: Start");
|
||||
i = 0;
|
||||
tmp = NULL;
|
||||
if (!(tmp = ft_strdup(ft_getenv(s->env, "PATH"))))
|
||||
return (-1);
|
||||
DG("SB: Path extracted [%s]", tmp);
|
||||
paths = ft_strsplit(tmp, ':');
|
||||
c->match = ft_strdup(c->rcmd);
|
||||
while (paths[i])
|
||||
c_parser(c, paths[i++], c->rcmd);
|
||||
tmp ? ft_memdel((void *)&tmp) : (0);
|
||||
paths ? ft_sstrfree(paths) : (0);
|
||||
DG("SB: End");
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/10 11:37:43 by alao #+# #+# */
|
||||
/* Updated: 2017/01/31 18:55:16 by alao ### ########.fr */
|
||||
/* Updated: 2017/02/03 17:32:05 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/09 13:31:21 by alao #+# #+# */
|
||||
/* Updated: 2017/02/03 13:30:50 by alao ### ########.fr */
|
||||
/* Updated: 2017/02/03 17:32:20 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -39,7 +39,6 @@ static char *c_slicer(t_comp *c)
|
|||
rt = ft_strsub(tmp, 0, i);
|
||||
if (i <= (int)ft_strlen(tmp) - i + 1)
|
||||
c->match = ft_strsub(tmp, i, ft_strlen(tmp) - i);
|
||||
DG("From [%s] to path [%s] and match [%s]", tmp, rt, c->match);
|
||||
tmp ? ft_memdel((void *)&tmp) : (0);
|
||||
return (rt);
|
||||
}
|
||||
|
|
@ -52,13 +51,10 @@ int c_seek_files(t_data *s, t_comp *c)
|
|||
{
|
||||
char *path;
|
||||
|
||||
DG("SF: Start");
|
||||
(void)s;
|
||||
path = c_slicer(c);
|
||||
c->cpath = path_solver(c, path, NULL);
|
||||
DG("Solved as [%s]", c->cpath);
|
||||
path ? ft_memdel((void *)&path) : (0);
|
||||
c_parser(c, c->cpath, c->match);
|
||||
DG("SF: End");
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/09 11:21:16 by alao #+# #+# */
|
||||
/* Updated: 2017/02/03 13:38:53 by alao ### ########.fr */
|
||||
/* Updated: 2017/02/03 17:32:24 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/03 13:10:38 by alao #+# #+# */
|
||||
/* Updated: 2017/02/03 16:12:00 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/02/03 17:32:36 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -26,8 +26,6 @@ int c_updater(t_comp *c, char *select)
|
|||
char *rt;
|
||||
int new_pos;
|
||||
|
||||
DG("\tUpdater");
|
||||
DG("RCMD [%s] match [%s] Candidat [%s]", c->rcmd, c->match, select);
|
||||
tmp = NULL;
|
||||
rt = NULL;
|
||||
new_pos = c->ircmd + (ft_strlen(select) - ft_strlen(c->match)) + 1;
|
||||
|
|
@ -39,7 +37,6 @@ int c_updater(t_comp *c, char *select)
|
|||
else
|
||||
data_singleton()->line.input = ft_strdup(rt);
|
||||
data_singleton()->line.pos = new_pos;
|
||||
DG("Resulting RCMD [%s] with pos [%d] from [%d]", rt, new_pos, c->ircmd);
|
||||
rt ? ft_memdel((void *)&rt) : (0);
|
||||
c_clear(data_singleton());
|
||||
return (1);
|
||||
|
|
@ -54,7 +51,6 @@ int c_gtfo(t_comp *c, long int keypress)
|
|||
{
|
||||
t_clst *ptr;
|
||||
|
||||
DG("It's time to GTFO. Keypress [%d]", keypress);
|
||||
if (keypress != 10)
|
||||
{
|
||||
c_clear(data_singleton());
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/09 13:52:07 by alao #+# #+# */
|
||||
/* Updated: 2017/02/03 13:40:14 by alao ### ########.fr */
|
||||
/* Updated: 2017/02/03 17:35:47 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
static void c_add_to_lst(t_comp *c, t_clst *node)
|
||||
{
|
||||
DG("PARSER: Adding node [%s]", node->name);
|
||||
if (c->lst == NULL)
|
||||
{
|
||||
c->lst = node;
|
||||
|
|
@ -71,7 +70,7 @@ int c_parser(t_comp *c, char *path, char *name)
|
|||
DIR *rep;
|
||||
struct dirent *dirc;
|
||||
|
||||
DG("PARSER: Search for [%s] in [%s]", name, path);
|
||||
(void)name;
|
||||
if (!(rep = opendir(path)))
|
||||
return (-1);
|
||||
while ((dirc = readdir(rep)))
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/10/25 18:21:54 by alao #+# #+# */
|
||||
/* Updated: 2017/01/11 14:14:09 by alao ### ########.fr */
|
||||
/* Updated: 2017/02/03 17:32:50 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/10 12:55:39 by alao #+# #+# */
|
||||
/* Updated: 2017/01/19 15:49:34 by alao ### ########.fr */
|
||||
/* Updated: 2017/02/03 17:35:15 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
static void c_printer_node(t_clst *lst)
|
||||
{
|
||||
DG("File [%s] type [%d]", lst->name, (int)lst->type);
|
||||
lst->cursor ? ft_putstr(tgetstr("us", NULL)) : (0);
|
||||
lst->cursor ? (ft_putstr_fd("\033[31m", 2)) : (0);
|
||||
lst->type == 4 ? ft_putstr_fd("\e[1;31m", 2) : (0);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/10/11 10:44:40 by alao #+# #+# */
|
||||
/* Updated: 2017/02/03 13:40:41 by alao ### ########.fr */
|
||||
/* Updated: 2017/02/03 17:33:08 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -23,7 +23,6 @@ void c_term_mv_back(t_comp *c)
|
|||
int lcmd;
|
||||
|
||||
i = 0;
|
||||
DG("Terminal back up");
|
||||
while (i != (c->c_line))
|
||||
{
|
||||
ft_putstr(tgetstr("up", NULL));
|
||||
|
|
@ -50,7 +49,6 @@ void c_term_mv_down(t_comp *c)
|
|||
int i;
|
||||
|
||||
i = 0;
|
||||
DG("Terminal down");
|
||||
while (i < c->c_line)
|
||||
{
|
||||
ft_putstr(tgetstr("do", NULL));
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/09/20 14:50:33 by alao #+# #+# */
|
||||
/* Updated: 2017/02/03 15:47:19 by alao ### ########.fr */
|
||||
/* Updated: 2017/02/03 17:33:41 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -21,33 +21,20 @@ int test(t_comp *c)
|
|||
t_clst *tmp;
|
||||
int i;
|
||||
|
||||
DG("\tAutocompletion dump");
|
||||
i = 1;
|
||||
if (!(c->lst))
|
||||
{
|
||||
DG("Empty list");
|
||||
return (0);
|
||||
}
|
||||
if (c->lst && c->lst->cursor)
|
||||
DG("Node [x] ID [%d] [%s]", c->lst->id, c->lst->name);
|
||||
else
|
||||
DG("Node [ ] ID [%d] [%s]", c->lst->id, c->lst->name);
|
||||
if (c->lst->prev != c->lst)
|
||||
{
|
||||
tmp = c->lst->next;
|
||||
while (tmp != c->lst)
|
||||
{
|
||||
if (tmp->cursor)
|
||||
DG("Node [x] ID [%d] [%s]", tmp->id, tmp->name);
|
||||
else
|
||||
DG("Node [ ] ID [%d] [%s]", tmp->id, tmp->name);
|
||||
i++;
|
||||
tmp = tmp->next;
|
||||
}
|
||||
}
|
||||
DG("List configuration as:");
|
||||
DG("Max value: Length (X) %d Number (Y) %d", c->c_sx, c->c_sy);
|
||||
DG("Translated to [%d] Lines and [%d] Column", c->c_line, c->c_pline);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +66,6 @@ static int c_dispatcher(t_data *s)
|
|||
{
|
||||
if (s->comp && s->comp->lst == NULL)
|
||||
{
|
||||
DG("Empty list, flushing autocompletion");
|
||||
c_clear(s);
|
||||
}
|
||||
else if (s->comp && s->comp->lst == s->comp->lst->next)
|
||||
|
|
@ -117,7 +103,6 @@ int completion(long int keypress)
|
|||
t_data *s;
|
||||
|
||||
s = data_singleton();
|
||||
DG("\n\n\t\tAutocompletion input key [%d]\n", (int)keypress);
|
||||
if (s->comp == NULL)
|
||||
{
|
||||
if (s->line.pos == 0)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/14 17:28:14 by jhalford #+# #+# */
|
||||
/* Updated: 2017/02/03 15:47:38 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/02/03 17:30:08 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
|
||||
/* Updated: 2017/02/03 15:17:56 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/02/03 17:33:56 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue