Skip to content

Commit c70aed8

Browse files
authored
Merge pull request #28 from cuajarsaki/fix/#22-segmentation-fault-redirections
Fix/#22 segmentation fault redirections
2 parents c488058 + b8359cf commit c70aed8

16 files changed

+352
-877
lines changed

shell.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include <termios.h>
2020

2121
#define HISTORY_SIZE 10
22+
#define NOTSIG 1
23+
#define RSTSIG 0
2224

2325
extern volatile sig_atomic_t g_signal_received;
2426

@@ -66,12 +68,12 @@ t_ast *get_ast(const char *input, t_env *env_list, int *exit_status);
6668
t_env *init_env_list(char ** environ);
6769

6870
// Utility Functions
69-
void run_shell(t_env *env_list);
71+
void run_shell(t_env *env_list, char **envp);
7072
char *get_env_value(t_env *env_list, const char *key);
7173
void set_env_value(t_env **env_list, const char *key, const char *value);
7274
void unset_env_value(t_env **env_list, const char *key);
7375
void free_env_list(t_env *env_list);
74-
int exec_ast(t_ast *ast, t_env *env_list);
76+
int exec_ast(t_ast *ast, t_env *env_list, char **envp);
7577
char **convert_env_list_to_array(t_env *env_list);
7678
void free_env_array(char **envp);;
7779
void shell_unknown_command(char *cmd);

src/buildin_commands/shell_exit.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: pchung <[email protected]> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2025/03/02 16:13:52 by pchung #+# #+# */
9-
/* Updated: 2025/03/04 02:03:17 by pchung ### ########.fr */
9+
/* Updated: 2025/03/05 13:40:31 by pchung ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -51,5 +51,5 @@ int shell_exit(char **argv)
5151
}
5252
// when the argument is not a number
5353
perror("exit: numeric argument required");
54-
exit(255);
54+
exit(2);
5555
}

0 commit comments

Comments
 (0)