fix errors. Remaining errors:

- segfault when empty command
- doesn't wait for the end of the command before prompting
This commit is contained in:
mcolonna 2024-04-25 18:15:37 +02:00
parent 6066d0529b
commit 7df3184578
7 changed files with 35 additions and 33 deletions

View file

@ -6,7 +6,7 @@
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/23 14:15:12 by mcolonna #+# #+# */
/* Updated: 2024/04/25 17:47:02 by mcolonna ### ########.fr */
/* Updated: 2024/04/25 18:04:46 by mcolonna ### ########.fr */
/* */
/* ************************************************************************** */
@ -38,7 +38,7 @@ typedef struct s_call
{
const char *program; // path of the program to call.
int argc; // number of arguments given
const char *const *argv; // arguments given
char *const *argv; // arguments given
// (argc and argv must include the program name)
} t_call;
@ -58,7 +58,7 @@ t_command parse_command(const t_memclass mc, const char *command);
///// EXECUTE COMMAND /////
// Execute the command given. Return the exit status.
int execute_command(t_command command);
int execute_command(t_memclass mc, t_command command, char *const envp[]);
///// ERROR /////
@ -73,6 +73,11 @@ void fatal_error(const char *msg);
// Get the PATH values.
// Return a list of strings ended by NULL.
char **get_path(const char **envp);
char **get_path(char *const envp[]);
// Search the program in PATH.
// Returns the path of the program to use, or NULL if there is none.
const char *search_path(
const t_memclass mc, const char **path, const char *prog);
#endif