maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
ft_strdup.c File Reference
#include "libft.h"
Include dependency graph for ft_strdup.c:

Go to the source code of this file.

Functions

char * ft_strdup (const char *s)
 

Function Documentation

◆ ft_strdup()

char * ft_strdup ( const char *  s)

Definition at line 23 of file ft_strdup.c.

24{
25 size_t n;
26 char *new;
27
28 n = ft_strlen(s);
29 if (!s)
30 return (NULL);
31 new = malloc((n + 1) * sizeof(char));
32 if (!new)
33 return (NULL);
34 ft_strlcpy(new, s, n + 1);
35 return (new);
36}
size_t ft_strlcpy(char *dest, const char *src, size_t size)
Definition ft_strlcpy.c:25
size_t ft_strlen(const char *s)
Definition ft_strlen.c:15

References ft_strlcpy(), and ft_strlen().

Referenced by add_env_node(), add_new_env(), add_shell_var_node(), append_expanded_var(), child_process(), create_pipe_node(), create_redir_node(), expand_env_and_loc_var(), expand_variable(), finalize_token(), ft_find_path(), ft_itoa(), ft_remove_all_edge_quotes(), ft_remove_quotes(), get_env_variable(), get_exit_status(), list_to_array(), new_token(), process_argument(), redirect_here_doc(), set_command_args(), set_env(), set_shell_var(), split_loc_vars(), tmp_adj(), and token_adj().

Here is the call graph for this function:
Here is the caller graph for this function: