Skip to content

Commit

Permalink
Fix norme errors
Browse files Browse the repository at this point in the history
  • Loading branch information
arzelcm committed Jul 16, 2024
1 parent 20277f2 commit e3b21e9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 24 deletions.
15 changes: 8 additions & 7 deletions inc/execute_forked.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,25 @@
/* ::: :::::::: */
/* execute_forked.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cfidalgo <cfidalgo@student.42barcelona. +#+ +:+ +#+ */
/* By: arcanava <arcanava@student.42barcel> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/15 17:58:08 by cfidalgo #+# #+# */
/* Updated: 2024/07/15 18:13:37 by cfidalgo ### ########.fr */
/* Updated: 2024/07/16 12:21:40 by arcanava ### ########.fr */
/* */
/* ************************************************************************** */

#ifndef EXECUTE_FORKED_H
# define EXECUTE_FORKED_H

#include "pdata_helpers.h"
#include <stdlib.h>
# include "pdata_helpers.h"
# include <stdlib.h>
# include <sys/types.h>

void execute_forked_subshell(
t_token *curr_token, t_token *token, t_pdata *pdata, t_context *context);
void execute_forked_subshell(t_token *curr_token, t_token *token,
t_pdata *pdata, t_context *context);

void execute_forked_pipe(
pid_t *pids, t_pdata *pdata, t_token *token, t_context *context);
pid_t *pids, t_pdata *pdata, t_token *token, t_context *context);

void clean_pipe(pid_t *pids, t_token *token, t_context *context);

Expand Down
6 changes: 3 additions & 3 deletions src/executor/builtins/utils_builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* ::: :::::::: */
/* utils_builtins.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cfidalgo <cfidalgo@student.42barcelona. +#+ +:+ +#+ */
/* By: arcanava <arcanava@student.42barcel> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/29 21:58:46 by arcanava #+# #+# */
/* Updated: 2024/07/15 18:04:53 by cfidalgo ### ########.fr */
/* Updated: 2024/07/16 12:29:04 by arcanava ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -54,7 +54,7 @@ void execute_cmd_builtin(t_pdata *pdata, t_token *token, t_context *context)
{
t_pdata new_pdata;

ft_bzero(&new_pdata, sizeof(t_pdata*));
ft_bzero(&new_pdata, sizeof(t_pdata *));
set_pdata(&new_pdata, &pdata);
listen_signals(SUBPROCESS, SUBPROCESS);
save_backup_stdfds(pdata);
Expand Down
7 changes: 4 additions & 3 deletions src/executor/execute_forked.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* ::: :::::::: */
/* execute_forked.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cfidalgo <cfidalgo@student.42barcelona. +#+ +:+ +#+ */
/* By: arcanava <arcanava@student.42barcel> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/15 17:53:54 by cfidalgo #+# #+# */
/* Updated: 2024/07/15 18:16:46 by cfidalgo ### ########.fr */
/* Updated: 2024/07/16 12:29:53 by arcanava ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -45,6 +45,7 @@ void clean_pipe(pid_t *pids, t_token *token, t_context *context)
int last_cmd_idx;

last_cmd_idx = token->tokens.amount - 1;
context->err_code = wait_child_processes(pids[last_cmd_idx], token->tokens.amount);
context->err_code = wait_child_processes(pids[last_cmd_idx],
token->tokens.amount);
free(pids);
}
6 changes: 3 additions & 3 deletions src/executor/executor.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* ::: :::::::: */
/* executor.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cfidalgo <cfidalgo@student.42barcelona. +#+ +:+ +#+ */
/* By: arcanava <arcanava@student.42barcel> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/29 21:58:56 by arcanava #+# #+# */
/* Updated: 2024/07/15 18:13:23 by cfidalgo ### ########.fr */
/* Updated: 2024/07/16 12:29:15 by arcanava ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -30,7 +30,7 @@ void execute_subshell(t_pdata *pdata, t_token *token, t_context *context)
t_pdata new_pdata;
pid_t pid;

ft_bzero(&new_pdata, sizeof(t_pdata*));
ft_bzero(&new_pdata, sizeof(t_pdata *));
set_pdata(&new_pdata, &pdata);
save_backup_stdfds(pdata);
if (!open_files(pdata, token->redirections, token->here_docs, context))
Expand Down
11 changes: 3 additions & 8 deletions src/tokenizer/words.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: arcanava <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/09 19:50:27 by arcanava #+# #+# */
/* Updated: 2024/07/15 23:04:00 by arcanava ### ########.fr */
/* Updated: 2024/07/16 12:28:42 by arcanava ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -126,14 +126,9 @@ void set_words(t_words *words, char **src, t_context *context)
while (src[i][j])
{
word = get_word(src[i], &j, context, &expansion);
if (!*word && expansion.expanded && !expansion.quoted)
{
free(word);
continue ;
}
else if (!expansion.quoted && ft_stroccurrences(word, '*'))
if (*word && !expansion.quoted && ft_stroccurrences(word, '*'))
push_wildcard_results(word, words);
else
else if (*word || !expansion.expanded || expansion.quoted)
push_word(&new_word, word, &expansion, words);
free(word);
}
Expand Down

0 comments on commit e3b21e9

Please sign in to comment.