![]() |
tgrekov-pipex
HIVE pipex May 2024
|
Definition in file main.c.
#include <fcntl.h>#include <string.h>#include <errno.h>#include <stdlib.h>#include "../mandatory/utils/utils.h"#include <libft.h>#include <ft_printf.h>Go to the source code of this file.
Functions | |
| int | here_doc (char *limiter, int *in_out) |
Capture multiline input from stdin and write to a pipe readable from in_out[0] until a line containing only limiter is reached. | |
| char ** | get_paths (char **envp) |
Create a null-terminated, unique array of paths from the environment pointer envp. Trailing forward slashes included free of charge. | |
| int | dispatcher (int n, char ***str_arrs, int *in_out) |
Dispatch n child processes with argument strings str_arrs[1][i], environment pointer str_arrs[2], where stdin for the first process is in_out[0] and stdout for the last process is in_out[1]. | |
| static void | _input (int argc, char **argv, int *is_here_doc, int *trunc_append) |
| Check if in here_doc mode, verify arguments count accordingly, and set append or truncate accordingly. | |
|
static |
Check if in here_doc mode, verify arguments count accordingly, and set append or truncate accordingly.
| argc | |
| argv | |
| is_here_doc | |
| trunc_append |
Definition at line 41 of file main.c.
References ft_printf(), and ft_strncmp().
| int dispatcher | ( | int | n, |
| char *** | str_arrs, | ||
| int * | in_out | ||
| ) |
Dispatch n child processes with argument strings str_arrs[1][i], environment pointer str_arrs[2], where stdin for the first process is in_out[0] and stdout for the last process is in_out[1].
| n | Number of processes |
| str_arrs | Null-terminated arrays paths, argv, and envp |
| in_out | stdin for the first process and stdout for the last process |
| int | Exit code of the last process, if available, else 1, or if an error was encountered in the parent process, 1. |
Definition at line 85 of file dispatcher.c.
References err().
| char ** get_paths | ( | char ** | envp | ) |
Create a null-terminated, unique array of paths from the environment pointer envp. Trailing forward slashes included free of charge.
| envp | Environment pointer |
| char** | Null-terminated, deduplicated array of paths from envp, with trailing / |
Definition at line 73 of file get_paths.c.
References arr_free(), compare(), copy(), dedupe(), err(), ft_split(), and ft_strncmp().
| int here_doc | ( | char * | limiter, |
| int * | in_out | ||
| ) |
Capture multiline input from stdin and write to a pipe readable from in_out[0] until a line containing only limiter is reached.
| limiter | Character to stop reading on |
| in_out | Input filedes, output filedes |
| int | 0 on failure, 1 on success |
Definition at line 46 of file here_doc.c.
References err(), ft_printf(), ft_strlen(), and get_next_line().