pipeline: parse basic pipeline commands with two commands

This commit is contained in:
Khaïs COLIN 2025-02-21 14:13:51 +01:00
parent 2b8bb859d1
commit 5f1485d1d5
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
4 changed files with 97 additions and 9 deletions

View file

@ -6,7 +6,7 @@
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/13 17:07:01 by khais #+# #+# */
/* Updated: 2025/02/14 16:47:04 by khais ### ########.fr */
/* Updated: 2025/02/21 14:04:50 by khais ### ########.fr */
/* */
/* ************************************************************************** */
@ -91,3 +91,22 @@ t_wordlist *wordlist_push(t_wordlist *wordlist, t_worddesc *worddesc)
return (wordlist_destroy(start), NULL);
return (start);
}
/*
** remove and return the first element in the given wordlist
**
** If wordlist is empty, return null.
*/
t_worddesc *wordlist_pop(t_wordlist **wordlist)
{
t_wordlist *first;
t_worddesc *word;
if ((*wordlist) == NULL)
return (NULL);
first = *wordlist;
(*wordlist) = first->next;
word = first->word;
free(first);
return (word);
}