pr compiler
This commit is contained in:
parent
0c8e9b930c
commit
b8e9a9e094
6 changed files with 5 additions and 60 deletions
|
|
@ -44,7 +44,6 @@ builtin/builtin_setenv.c\
|
|||
builtin/builtin_unset.c\
|
||||
builtin/builtin_unsetenv.c\
|
||||
builtin/is_builtin.c\
|
||||
c_seek_env.c\
|
||||
completion/c_abs_path.c\
|
||||
completion/c_arrow.c\
|
||||
completion/c_binary.c\
|
||||
|
|
@ -59,6 +58,7 @@ completion/c_parser.c\
|
|||
completion/c_pathsolver.c\
|
||||
completion/c_printer.c\
|
||||
completion/c_rematch.c\
|
||||
completion/c_seek_env.c\
|
||||
completion/c_sizing.c\
|
||||
completion/c_terminal.c\
|
||||
completion/completion.c\
|
||||
|
|
|
|||
|
|
@ -1,55 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* c_seek_env.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/09 15:50:24 by gwojda #+# #+# */
|
||||
/* Updated: 2017/03/09 16:52:57 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
static int c_storing(t_comp *c, char *value)
|
||||
{
|
||||
t_clst *tmp;
|
||||
|
||||
if (!(tmp = (t_clst *)malloc(sizeof(t_clst))))
|
||||
return (-1);
|
||||
tmp->name = value;
|
||||
tmp->len = ft_strlen(tmp->name);
|
||||
tmp->type = 10;
|
||||
tmp->cursor = 0;
|
||||
c_add_to_lst(c, tmp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void c_maj_rcmd(t_comp *c, char *current_word)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
tmp = c->rcmd;
|
||||
c->rcmd = ft_strndup(c->rcmd, current_word - c->rcmd + 1);
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
int c_seek_env(t_comp *c, char *current_word)
|
||||
{
|
||||
char *match;
|
||||
char **env;
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
env = data_singleton()->env;
|
||||
match = ft_strdupi_w(current_word + 1);
|
||||
c_maj_rcmd(c, current_word);
|
||||
while (env[i])
|
||||
{
|
||||
if (!ft_strncmp(match, env[i], ft_strlen(match)))
|
||||
c_storing(c, ft_strndup(env[i], ft_strchr(env[i], '=') - env[i]));
|
||||
++i;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/10/15 13:27:14 by alao #+# #+# */
|
||||
/* Updated: 2017/03/09 17:35:01 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/03/10 17:20:20 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/15 12:03:30 by alao #+# #+# */
|
||||
/* Updated: 2017/02/17 14:57:22 by alao ### ########.fr */
|
||||
/* Updated: 2017/03/10 17:27:06 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/10/11 10:44:40 by alao #+# #+# */
|
||||
/* Updated: 2017/03/10 12:06:22 by alao ### ########.fr */
|
||||
/* Updated: 2017/03/10 16:07:36 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/09/20 14:50:33 by alao #+# #+# */
|
||||
/* Updated: 2017/03/10 08:46:26 by alao ### ########.fr */
|
||||
/* Updated: 2017/03/10 17:20:04 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue