mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
norm: put cmdlist_builder functions in correct file
This commit is contained in:
parent
f3a38fb430
commit
7595562597
3 changed files with 28 additions and 23 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/24 17:49:46 by khais #+# #+# */
|
||||
/* Updated: 2025/03/04 15:05:08 by khais ### ########.fr */
|
||||
/* Updated: 2025/03/04 15:23:00 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -18,26 +18,6 @@
|
|||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
** Advance the state to the next word
|
||||
*/
|
||||
static void cmdlist_builder_next_word(
|
||||
t_cmdlist_builder *builder,
|
||||
t_wordlist **words)
|
||||
{
|
||||
builder->current_wordlist
|
||||
= wordlist_push(builder->current_wordlist, builder->current_word);
|
||||
builder->current_word = wordlist_pop(words);
|
||||
}
|
||||
|
||||
/*
|
||||
** return true if we are currently adding the last pipeline in the chain
|
||||
*/
|
||||
static bool cmdlist_builder_at_last_pipeline(t_cmdlist_builder *builder)
|
||||
{
|
||||
return (builder->idx == builder->cmdlist->num_pipelines - 1);
|
||||
}
|
||||
|
||||
/*
|
||||
** Frees all memory associated with this builder and set error to true.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/26 13:51:18 by khais #+# #+# */
|
||||
/* Updated: 2025/03/04 13:19:51 by khais ### ########.fr */
|
||||
/* Updated: 2025/03/04 15:23:06 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -82,3 +82,23 @@ t_cmdlist_builder *setup_cmdlist_builder(
|
|||
builder->idx = 0;
|
||||
return (builder);
|
||||
}
|
||||
|
||||
/*
|
||||
** Advance the state to the next word
|
||||
*/
|
||||
void cmdlist_builder_next_word(
|
||||
t_cmdlist_builder *builder,
|
||||
t_wordlist **words)
|
||||
{
|
||||
builder->current_wordlist
|
||||
= wordlist_push(builder->current_wordlist, builder->current_word);
|
||||
builder->current_word = wordlist_pop(words);
|
||||
}
|
||||
|
||||
/*
|
||||
** return true if we are currently adding the last pipeline in the chain
|
||||
*/
|
||||
bool cmdlist_builder_at_last_pipeline(t_cmdlist_builder *builder)
|
||||
{
|
||||
return (builder->idx == builder->cmdlist->num_pipelines - 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/26 13:50:25 by khais #+# #+# */
|
||||
/* Updated: 2025/02/26 14:05:36 by khais ### ########.fr */
|
||||
/* Updated: 2025/03/04 15:23:55 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -43,5 +43,10 @@ typedef struct s_cmdlist_builder
|
|||
t_cmdlist_builder *setup_cmdlist_builder(
|
||||
t_cmdlist_builder *builder,
|
||||
t_wordlist **words);
|
||||
bool cmdlist_builder_at_last_pipeline(
|
||||
t_cmdlist_builder *builder);
|
||||
void cmdlist_builder_next_word(
|
||||
t_cmdlist_builder *builder,
|
||||
t_wordlist **words);
|
||||
|
||||
#endif // COMMAND_LIST_BUILDER_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue