tgrekov-pipex
HIVE pipex May 2024
|
Definition in file get_paths.c.
#include <libft.h>
#include "../utils/utils.h"
Go to the source code of this file.
Functions | |
static int | compare (void *a, void *b) |
Compare path string a against path string b , which will always have a trailing forward slash. | |
static void * | copy (void *str) |
Duplicate a path string and append a forward slash. | |
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. | |
|
static |
Compare path string a
against path string b
, which will always have a trailing forward slash.
a | Path string |
b | Previously copied path string with trailing forward slash |
int | 0 if identical |
Definition at line 31 of file get_paths.c.
References ft_strlen(), and ft_strncmp().
|
static |
Duplicate a path string and append a forward slash.
str | Path string |
void* | Path string with trailing / |
Definition at line 53 of file get_paths.c.
References err(), and ft_strjoin().
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().