mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
Expansion: one fix to make sur $? is handled correctly
This commit is contained in:
parent
2a61706f1a
commit
d5415d978c
1 changed files with 3 additions and 3 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/03/19 17:28/29 by khais #+# #+# */
|
/* Created: 2025/03/19 17:28/29 by khais #+# #+# */
|
||||||
/* Updated: 2025/03/21 17:38:16 by jguelen ### ########.fr */
|
/* Updated: 2025/03/24 10:47:12 by jguelen ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -93,6 +93,7 @@ static char *calculate_replacement(t_worddesc *word, t_minishell *app, size_t i,
|
||||||
*id_len = ft_strlen(id);
|
*id_len = ft_strlen(id);
|
||||||
if (*id_len == 0 && word->word[i + 1] == '?')
|
if (*id_len == 0 && word->word[i + 1] == '?')
|
||||||
{
|
{
|
||||||
|
*id_len = 1;
|
||||||
rep = expand_question_mark(app);
|
rep = expand_question_mark(app);
|
||||||
if (!rep)
|
if (!rep)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
@ -107,8 +108,7 @@ static char *calculate_replacement(t_worddesc *word, t_minishell *app, size_t i,
|
||||||
if (!rep)
|
if (!rep)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
free(id);
|
return (free(id), rep);
|
||||||
return (rep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue