MiniDevil
As beautiful as a shell
Execution utilities. More...
#include <sys/wait.h>#include <stdio.h>#include "executor.h"#include "builtins.h"#include "libft.h"
Include dependency graph for exec_utils.c:Execution utilities.
Definition in file exec_utils.c.
Functions | |
| int | exec_cmd_not_found (char *cmd) |
| Print "command not found" to STDERR. More... | |
| int | is_builtin (char *cmd) |
| Check if a command is a shell builtin. More... | |
| int | exec_builtin (char **args, t_shell *shell) |
| Dispatch a builtin command to its function. More... | |
| int | exec_simple_command (char **args, t_shell *shell) |
| Execute a simple command (builtin or external) More... | |
| int | pipe_fork_error (int pipe_fd[2], pid_t left_pid) |
| Clean up pipe fds and wait for left child on fork failure. More... | |
| int exec_cmd_not_found | ( | char * | cmd | ) |
Print "command not found" to STDERR.
| cmd | Command name that wasn't found |
Definition at line 25 of file exec_utils.c.
Referenced by prepare_exec().
Here is the caller graph for this function:| int is_builtin | ( | char * | cmd | ) |
Check if a command is a shell builtin.
| cmd | Command name to check |
Definition at line 39 of file exec_utils.c.
Referenced by exec_simple_command().
Here is the caller graph for this function:| int exec_builtin | ( | char ** | args, |
| t_shell * | shell | ||
| ) |
Dispatch a builtin command to its function.
| args | Argument array with arg[0] being the command name |
| shell | Shell context |
Definition at line 67 of file exec_utils.c.
References builtin_cd(), builtin_echo(), builtin_env(), builtin_exit(), builtin_export(), builtin_pwd(), builtin_unset(), and t_shell::env.
Referenced by exec_simple_command().
Here is the call graph for this function:
Here is the caller graph for this function:| int exec_simple_command | ( | char ** | args, |
| t_shell * | shell | ||
| ) |
Execute a simple command (builtin or external)
| args | NULL terminated argument array |
| shell | Shell context |
Definition at line 95 of file exec_utils.c.
References exec_builtin(), exec_external(), and is_builtin().
Referenced by exec_command_node().
Here is the call graph for this function:
Here is the caller graph for this function:| int pipe_fork_error | ( | int | pipe_fd[2], |
| pid_t | left_pid | ||
| ) |
Clean up pipe fds and wait for left child on fork failure.
| pipe_fd | Pipe file descriptors to close |
| left_pid | PID of left child (0 if wasn't yet forked) |
Definition at line 111 of file exec_utils.c.
Referenced by handle_pipe().
Here is the caller graph for this function: