Skip to content

Commit

Permalink
Merge pull request #84 from facetint/main
Browse files Browse the repository at this point in the history
merge with main
  • Loading branch information
facetint authored Apr 2, 2024
2 parents c5adf8c + c913734 commit 4808bff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
22 changes: 11 additions & 11 deletions includes/minishell.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: facetint <facetint@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/31 09:14:38 by hamza #+# #+# */
/* Updated: 2024/04/01 17:49:31 by facetint ### ########.fr */
/* Updated: 2024/04/01 18:55:44 by facetint ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -118,6 +118,8 @@ void expand_string(char **string);
char *replace_string(char *input, int p_start,
int p_len, char *replacement);
int is_nameless_variable(t_token *token);
void expand_token(t_token *token, t_token **head,
t_token **token_ptr, t_token **prev_ptr);

// parser
t_command *parse(t_token *lexer_data);
Expand All @@ -135,41 +137,39 @@ void handle_memory_error(void);
int is_valid(t_token *lexer_data);

// debug
void debug(t_token *token, t_command *cmd);
char *ft_str_arr_join(char **str_list, unsigned int str_count);

// executer
void execute(t_command *cmds);
void handle_command(t_command *cmd, int *prev_p, int *next_p);
char *find_path(char *cmd);
void pid_error(int *prev_pipe, int *next_pipe);
void close_fds(t_file_descriptors fds);
void close_redirections(t_file_descriptors fds);
int get_input_fd(int *pipe, t_command *cmd);
int get_output_fd(int *pipe, t_command *cmd);
void close_pipe(int *pipe);
void path_error(char *cmd);

// builtin

void execute_builtin(t_command *cmd, int fd[2]);
int isbuiltin(char *cmd);
void builtin_exit(t_command *cmd);
void builtin_echo(t_command *cmd, int fd[2]);
void builtin_pwd(t_command *cmd);
void builtin_export(t_command *cmd, int fd[2]);
void export_env(char *format);
void builtin_unset(t_command *cmd, int fd[2]);
int ft_strcmp(char *s1, char *s2);
int should_run_in_child(t_command *cmd);
int ft_strcmp(char *s1, char *s2);

// cd
void builtin_cd(t_command *cmd);
void execute_cd(char *str, t_command *cmd);
void change_pwd(t_command *cmd);
void change_old(char *str);

// heredocs
// heredocs and redirections
int read_heredoc_input(char *delimiter);
void handle_file_redirections(t_command *cur);

//signal
void register_signal_handler(void);
Expand All @@ -181,11 +181,11 @@ int *get_exit_status(void);
// abort
void abort_function(void);

// utils
char *ft_unsafe_strdup(const char *str);
void export_env(char *format);
void handle_file_redirections(t_command *cur);

void expand_token(t_token *token, t_token **head,
t_token **token_ptr, t_token **prev_ptr);
// error
void path_error(char *cmd);
void pid_error(int *prev_pipe, int *next_pipe);

#endif
4 changes: 2 additions & 2 deletions src/redirections/redirections.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: facetint <facetint@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/01 11:32:58 by facetint #+# #+# */
/* Updated: 2024/04/01 15:44:19 by facetint ### ########.fr */
/* Updated: 2024/04/02 10:52:59 by facetint ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -50,7 +50,7 @@ int get_flags(t_redirection *redir)
flags = O_WRONLY | O_CREAT;
if (redir->flags & APPEND)
flags |= O_APPEND;
else
else if (!(redir->flags & INPUT))
flags |= O_TRUNC;
return (flags);
}
Expand Down
3 changes: 1 addition & 2 deletions src/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: facetint <facetint@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/30 02:37:53 by hamza #+# #+# */
/* Updated: 2024/04/01 15:47:04 by facetint ### ########.fr */
/* Updated: 2024/04/02 10:30:32 by facetint ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -24,7 +24,6 @@ void handle_signal(int signum)
*get_exit_status() = 1;
if (g_signal_type == PROMPT)
{
printf("%s%s \n", get_prompt(), rl_line_buffer);
rl_replace_line("", 0);
rl_on_new_line();
rl_redisplay();
Expand Down

0 comments on commit 4808bff

Please sign in to comment.