Functions used in exec that are simple utils.
More...
Functions used in exec that are simple utils.
◆ count_commands()
Cound the number of commands in the command structure.
- Parameters
-
- Returns
- size_t number of commands
◆ dup_and_close()
void dup_and_close |
( |
t_garbage * | garbage, |
|
|
int | oldfd, |
|
|
int | newfd ) |
Special dup2 that also closes the old fd.
- Parameters
-
garbage | garbage structure |
oldfd | fd that will overwrite newfd and will be close |
newfd | fd to overwrite by oldfd |
◆ execute_pipeline()
void execute_pipeline |
( |
t_data * | data, |
|
|
pid_t * | pids, |
|
|
size_t * | count ) |
Execute all the command that are followed by pipes.
- Parameters
-
data | data structure |
pids | array of pids of childs |
count | pointer to count the number of commands |
◆ fill_toks_into_commands()
◆ safe_close()
int safe_close |
( |
int * | fd | ) |
|
Safely close fd.
- Parameters
-
fd | file descriptor to close |
- Returns
- 0 no error, 1 ERROR
◆ search_path()
Search path for the designated command.
- Parameters
-
data | data structure |
command | command structure |
◆ search_paths()
Search Path for all commands.
- Parameters
-
data | data structure |
command | command structure |
◆ wait_all_childs()
void wait_all_childs |
( |
t_command * | command, |
|
|
pid_t * | pids ) |
Waits for all the childs with their pids.
- Parameters
-
command | command structure |
pids | array of pids of childs |