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

Go to the source code of this file.

Functions

char * ft_remove_quotes (char *str, char quote_type)
 

Function Documentation

◆ ft_remove_quotes()

char * ft_remove_quotes ( char *  str,
char  quote_type 
)

Definition at line 15 of file ft_remove_quotes.c.

16{
17 int len;
18 char *new_str;
19
20 len = ft_strlen(str);
21 new_str = NULL;
22 if (len > 1 && str[0] == quote_type && str[len - 1] == quote_type)
23 {
24 new_str = ft_strndup(str + 1, len - 2);
25 return (new_str);
26 }
27 return (ft_strdup(str));
28}
char * ft_strndup(const char *s, size_t n)
Definition ft_strndup.c:23
size_t ft_strlen(const char *s)
Definition ft_strlen.c:15
char * ft_strdup(const char *s)
Definition ft_strdup.c:23

References ft_strdup(), ft_strlen(), and ft_strndup().

Referenced by handle_add_set_shell_variable(), and post_process_command_args().

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