Skip to content

Commit

Permalink
[BUG] fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rclanget committed Dec 26, 2016
1 parent bb93230 commit 8c50759
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 6 additions & 4 deletions srcs/execution/builtin_history_optps.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: ulefebvr <ulefebvr@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/14 12:41:32 by ulefebvr #+# #+# */
/* Updated: 2016/12/02 20:42:07 by rclanget ### ########.fr */
/* Updated: 2016/12/26 14:47:08 by rclanget ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -37,13 +37,15 @@ char *history_add_args(char **cmd)
{
char *tmp;
char *tmp1;
char *tmp2;

tmp = NULL;
while (cmd && *cmd)
{
tmp1 = ft_strjoin_custom(tmp, *cmd);
ft_free_them_all(1, &tmp);
tmp = tmp1;
tmp1 = ft_strjoin(tmp, " ");
tmp2 = ft_strjoin_custom(tmp1, *cmd);
ft_free_them_all(1, &tmp, &tmp1);
tmp = tmp2;
cmd++;
}
return (tmp);
Expand Down
10 changes: 9 additions & 1 deletion srcs/termcaps_readline/parser_var.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: zipo <zipo@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/22 23:40:27 by zipo #+# #+# */
/* Updated: 2016/12/15 22:30:48 by rclanget ### ########.fr */
/* Updated: 2016/12/26 14:31:49 by rclanget ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -73,6 +73,13 @@ static int isquote(char c)
static int dquote = 0;
static int mquote = 0;

if (!c)
{
backslash = 0;
quote = 0;
dquote = 0;
mquote = 0;
}
if (c == '\'' && !backslash && !dquote && !mquote)
quote = !quote;
else if (c == '\"' && !backslash && !quote && !mquote)
Expand All @@ -97,5 +104,6 @@ char *parse_var(t_info *info, char *cmd)
tmp = replace_var(info, tmp, i);
i += tmp[i] ? 1 : 0;
}
isquote(0);
return (tmp);
}

0 comments on commit 8c50759

Please sign in to comment.