Skip to content

Commit

Permalink
Complete (#34)
Browse files Browse the repository at this point in the history
* add: get local_vars using $

* add: heredoc now returns expanded env_arvs and loc_args

* fix: norminette for heredoc env_var functionality

* fix: working on interpreting $a$b together

* fix: done echo a$a$b

* fix: norminette after a$a$b fix

* refactoring

* new: errors

* add: exit_status

* fix:compilation issues

* fix: removed error check for | at end of input

* fix: removed error check for | at end of input

* fix: opened 'ls -la |' readline functionality

* fix: opened 'ls -la |' readline functionality

* add: CTRL+C sigint in heredocs

* fix: CTRL+C in heredocs, working on norminette

* fix: CTRL+D functionality passing norminette

* fix: heredoc norminette

* Dnew backup branch

* Dev (#29)

* merge: merge_dev into main

* merge: merge_dev into main

* Merge dev (#28)

* add: get local_vars using $

* add: heredoc now returns expanded env_arvs and loc_args

* fix: norminette for heredoc env_var functionality

* fix: working on interpreting $a$b together

* fix: done echo a$a$b

* fix: norminette after a$a$b fix

* refactoring

* new: errors

* add: exit_status

* fix:compilation issues

* fix: builtin_exit

* fix

* fix:exit

* add: norm, fix: issues

---------

Co-authored-by: ¨Roman <¨roman.mikhaylenko14@hotmail.com¨>
Co-authored-by: Dmitry Demirkylych <dmdemirk@c2r5s7.42london.com>
Co-authored-by: Dmitry Demirkylych <dmdemirk@c1r3s4.42london.com>

---------

Co-authored-by: ¨Roman <¨roman.mikhaylenko14@hotmail.com¨>
Co-authored-by: Dmitry Demirkylych <dmdemirk@c2r5s7.42london.com>
Co-authored-by: Dmitry Demirkylych <dmdemirk@c1r3s4.42london.com>

* Dev (#29) (#30)

* merge: merge_dev into main

* merge: merge_dev into main

* Merge dev (#28)

* add: get local_vars using $

* add: heredoc now returns expanded env_arvs and loc_args

* fix: norminette for heredoc env_var functionality

* fix: working on interpreting $a$b together

* fix: done echo a$a$b

* fix: norminette after a$a$b fix

* refactoring

* new: errors

* add: exit_status

* fix:compilation issues

* fix: builtin_exit

* fix

* fix:exit

* add: norm, fix: issues

---------





---------

Co-authored-by: ¨Roman <¨roman.mikhaylenko14@hotmail.com¨>
Co-authored-by: Dmitry Demirkylych <dmdemirk@c2r5s7.42london.com>
Co-authored-by: Dmitry Demirkylych <dmdemirk@c1r3s4.42london.com>

* fix: cat << eof (issue 4)

* fix: exit statuses showing again

* fix: error codes (issue 1)

* fix: history file deleted on exit or sig quit

* fix: single and double quotes workgit add .git add .! in heredocs toogit add .git add .git add .!

* fix: heredoc quotation marks match bash behaviour

* fix: echo rocky 'rocky' rocky USER 0 0 '0'

* fix: echo rocky 'rocky' rocky USER 0 0 '0'

* fix: CTRL+C add new line after on grep 'we'

* Dimadem valgrind (#31)

* fix: valgrind

* fix: valgrind

* fix: ls > output.txt > new.txt

---------

Co-authored-by: Dmitry Demirkylych <dmdemirk@c2r5s7.42london.com>

* fix: 5. message for CTRL+\ on exit.

* merged branches

* fix: 3 memory leaks with no input, only exit after start

* reset to working version (exit error)

* fix: 2 leaks, (signal and path in execute.c

* fix:valgrind exit

* fix: add_env leak, add_shell_var leak

* SAFE TO REVERT TO - improved structuring of files only

* mid-debugging, still works well. Revert to here if necessary

* about to refactor new_ast_node & tree, safe to RESET to here

* restructured AST, safe to roll back to here

* restructured AST, safe to roll back to here

* restructured AST, safe to roll back to here

* pipe giving double free but I think this is the right way forward

* pipe giving double free but I think this is the right way forward

* got through tokenizer, pipe still doesn't work but made changes i wan tot keep

* I think I'm close but there are errors. Fixing ast vs tokens list free conflict

* AST & TOKENS FREE CONFLICT RESOLVED BITCHEZZZZZZZZZZ

* debugging pipe malloc (and mayeb functionality) issue

* FIXED PIPE & TOKEN AST DISCONTINUITYYYYYYYY

* FIXED PIPE & TOKEN AST DISCONTINUITYYYYYYYY

* fix: many things. I have become one with minishell. Tomorrow we fix env & loc vars.

* Roman 7sept (#32)

* SAFE TO REVERT TO - improved structuring of files only

* mid-debugging, still works well. Revert to here if necessary

* about to refactor new_ast_node & tree, safe to RESET to here

* restructured AST, safe to roll back to here

* restructured AST, safe to roll back to here

* restructured AST, safe to roll back to here

* pipe giving double free but I think this is the right way forward

* pipe giving double free but I think this is the right way forward

* got through tokenizer, pipe still doesn't work but made changes i wan tot keep

* I think I'm close but there are errors. Fixing ast vs tokens list free conflict

* AST & TOKENS FREE CONFLICT RESOLVED BITCHEZZZZZZZZZZ

* debugging pipe malloc (and mayeb functionality) issue

* FIXED PIPE & TOKEN AST DISCONTINUITYYYYYYYY

* FIXED PIPE & TOKEN AST DISCONTINUITYYYYYYYY

* fix: many things. I have become one with minishell. Tomorrow we fix env & loc vars.

---------

Co-authored-by: Roman Mikhaylenko <roman.mikhaylenko14@hotmail.com>

* fix: env valgrind

* fix: valgrind shell_var

* fix

* merged with dimas work from today (9th) from dev

* added malloc debugger statements

* no leak checks with echo simple arg

* fixed memory leaks for echo multiple simple args

* env vars are working (without echo)

* Dimadem norminette (#33)

* fix:norm backend

* fix: norminette

* fix: norm

* delete: printf

---------

Co-authored-by: Dmitry Demirkylych <dmdemirk@c2r5s7.42london.com>

* fix:issues

* rmikhayl 'rmikhayl' rmikhayl USER 0 0 '0' worksgit add . loc args, let's see

* almost there, just some env/loc/exit vars to iron out in heredoc

* holy shit I think all the memory leaks are fixed

* everything works except for loc vars in heredocs

* EVERY MEMORY LEAK FIXED OH MAA GAAAWD

* YAAAAAAAAAAAAAAAAAAS THIS IS ALL HEALTHY

* only norminette for the 2 loc_env files left to dogit add .git add .git add .git add .git add .

* working on norminette, so far no leaks

* split functions across files, preparing for refactoring. Reset to here if needed

* loc_env_var_heredoc_utils norminette passing! safe to revert to here

* new checkpoint, loc_env_car_handler is fine

* new checkpoint, loc_env_car_handler is fine

* new checkpoint, loc_env_car_handler & utils_utils are fine

* one function left to go

* one function left to go

* think all checks are still passed, manually split up expand_variable

* is it done?

* its done

* tidied up non-ft functions

---------

Co-authored-by: ¨Roman <¨roman.mikhaylenko14@hotmail.com¨>
Co-authored-by: Dmitry Demirkylych <dmdemirk@c2r5s7.42london.com>
Co-authored-by: Dmitry Demirkylych <dmdemirk@c1r3s4.42london.com>
Co-authored-by: Roman Mikhaylenko <roman.mikhaylenko14@hotmail.com>
  • Loading branch information
5 people authored Sep 10, 2024
1 parent 5522038 commit c803dc2
Show file tree
Hide file tree
Showing 50 changed files with 1,427 additions and 731 deletions.
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ NAME = minishell
# Comands
COMPILER = cc
DFLAGS = -g3 -gdwarf-2
CFLAGS = -Wall -Wextra -Werror $(DFLAGS)
CFLAGS = -Wall -Wextra -Werror $(DFLAGS) -g -O0
AR = ar rcs
RM = rm -rf
MAKEFLAGS += --silent
Expand All @@ -51,6 +51,7 @@ EXECUTE_DIR = $(SRC_DIR)/execute
EXIT_STATUS_DIR = $(SRC_DIR)/exit_status
TEST_DIR = $(SRC_DIR)/test
SIGNALS_DIR = $(SRC_DIR)/signals
CHECK_TOKENISE_DIR = $(SRC_DIR)/check_tokenise

INCLUDES = -I./inc \
-I $(LIB_DIR)/libft/inc \
Expand All @@ -73,6 +74,8 @@ BUILTINS_SOURCES = $(wildcard $(BUILTINS_DIR)/*.c)
EXECUTE_SOURCES = $(wildcard $(EXECUTE_DIR)/*.c)
EXIT_STATUS_SOURCES = $(wildcard $(EXIT_STATUS_DIR)/*.c)
SIGNALS_SOURCES = $(wildcard $(SIGNALS_DIR)/*.c)
CHECK_TOKENISE_SOURCES = $(wildcard $(CHECK_TOKENISE_DIR)/*.c)


MAIN_TEST_SOURCE = $(wildcard $(TEST_DIR)/*.c)
ENV_TEST_SOURCES = $(wildcard $(TEST_DIR)/env/*.c)
Expand All @@ -94,7 +97,8 @@ SOURCES = $(MAIN_SOURCE) \
$(ENV_TEST_SOURCES) \
$(PIPE_TEST_SOURCES) \
$(REDIRECTION_SOURCES) \
$(SIGNALS_SOURCES)
$(SIGNALS_SOURCES) \
$(CHECK_TOKENISE)
# Building
BUILD_DIR = ./build
MAIN_OBJECT = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/src/%.o, $(MAIN_SOURCE))
Expand All @@ -113,6 +117,7 @@ SIGNALS_OBJECTS = $(patsubst $(SIGNALS_DIR)/%.c, $(BUILD_DIR)/src/signals/%.o
MAIN_TEST_OBJECT = $(patsubst $(TEST_DIR)/%.c, $(BUILD_DIR)/src/test/%.o, $(MAIN_TEST_SOURCE))
ENV_TEST_OBJECTS = $(patsubst $(TEST_DIR)/env/%.c, $(BUILD_DIR)/src/test/env/%.o, $(ENV_TEST_SOURCES))
PIPE_TEST_OBJECTS = $(patsubst $(TEST_DIR)/pipe/%.c, $(BUILD_DIR)/src/test/pipe/%.o, $(PIPE_TEST_SOURCES))
CHECK_TOKENISE_OBJECTS = $(patsubst $(CHECK_TOKENISE_DIR)/check_tokenise/%.c, $(BUILD_DIR)/src/check_tokenise/%.o, $(CHECK_TOKENISE_SOURCES))

OBJECTS = $(MAIN_OBJECT) \
$(APP_OBJECTS) \
Expand All @@ -127,7 +132,8 @@ OBJECTS = $(MAIN_OBJECT) \
$(PARSER_OBJECTS) \
$(PIPE_OBJECTS) \
$(REDIRECTION_OBJECTS) \
$(SIGNALS_OBJECTS)
$(SIGNALS_OBJECTS) \
$(CHECK_TOKENISE_OBJECTS)

TEST_OBJECTS = $(APP_OBJECTS) \
$(ENV_OBJECTS) \
Expand All @@ -139,7 +145,8 @@ TEST_OBJECTS = $(APP_OBJECTS) \
$(PIPE_OBJECTS) \
$(MAIN_TEST_OBJECT) \
$(ENV_TEST_OBJECTS) \
$(PIPE_TEST_OBJECTS)
$(PIPE_TEST_OBJECTS) \
$(CHECK_TOKENISE_OBJECTS)

# Processing
all: $(NAME)
Expand Down Expand Up @@ -234,6 +241,6 @@ test: $(TEST_OBJECTS) $(LIBFT)
@./test

valgrind: $(NAME)
@valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --suppressions=readline.supp --log-file=valgrind-out.txt ./minishell
@valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --track-fds=yes --trace-children=yes --suppressions=readline.supp --num-callers=20 --log-file=valgrind-out.txt ./minishell

.PHONY: all bonus clean fclean re test
File renamed without changes.
3 changes: 2 additions & 1 deletion inc/execute.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: dmdemirk <dmdemirk@student.42london.c +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/03 16:34:42 by dmdemirk #+# #+# */
/* Updated: 2024/09/06 12:31:40 by dmdemirk ### ########.fr */
/* Updated: 2024/09/09 13:19:58 by dmdemirk ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -26,6 +26,7 @@ void ft_free_2d_arr(char **arr);
int ft_perror(char *str);
void close_fds(int in, int out);
void handle_io_fd(t_ms_data *data);
void handle_std_io(int *std_io, int std_fileno);

/* shell variable execution */
int handle_shell_variable(t_ast *node, t_ms_data *data);
Expand Down
3 changes: 2 additions & 1 deletion inc/exit_status.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: dmdemirk <dmdemirk@student.42london.c +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/06 12:29:24 by dmdemirk #+# #+# */
/* Updated: 2024/09/06 12:31:02 by dmdemirk ### ########.fr */
/* Updated: 2024/09/09 13:20:14 by dmdemirk ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -37,5 +37,6 @@ void set_exit_status(int *exit_status, int status_code);
/* exit_status_utils */
int ft_perror(char *str);
int ft_isnumber(char *str);
void free_shell_var_list(t_env *shell_var);

#endif
14 changes: 8 additions & 6 deletions inc/redirection.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: dmdemirk <dmdemirk@student.42london.c +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/11 14:59:47 by dmdemirk #+# #+# */
/* Updated: 2024/07/11 15:00:25 by dmdemirk ### ########.fr */
/* Updated: 2024/09/09 13:49:13 by dmdemirk ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -17,12 +17,14 @@
# include "tokens.h"

/* redirect_in */
int redirect_in(t_ast *node, t_ms_data *data);
int redirect_out(t_ast *node, t_ms_data *data);
int redirect_append(t_ast *node, t_ms_data *data);
int redirect_here_doc(t_ast *node, t_ms_data *data);
int redirect_in(t_ast *node, t_ms_data *data);
int redirect_out(t_ast *node, t_ms_data *data);
int redirect_append(t_ast *node, t_ms_data *data);
int redirect_here_doc(t_ast *node, t_ms_data *data);
char *process_and_reassemble(char *line, t_ms_data *data);

/* utils */
int open_file(t_ast *node, char *direction);
int open_file(t_ast *node, char *direction);
int open_tmp_file(const char *type);

#endif
7 changes: 6 additions & 1 deletion inc/signals.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: dmdemirk <dmdemirk@student.42london.c +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/17 14:07:19 by dmdemirk #+# #+# */
/* Updated: 2024/07/18 15:59:38 by dmdemirk ### ########.fr */
/* Updated: 2024/09/09 13:20:52 by dmdemirk ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -19,12 +19,17 @@
# include <signal.h>
# include "shell.h"

// GLOBAL VAR
extern volatile sig_atomic_t g_heredoc_interrupted;

/* signals */
void signal_reset_prompt(int signo);
void set_signals_interactive(void);
void signal_print_newline(int signal);
void sigquit_ignore(void);
void set_signals_noninteractive(void);
void handle_sigint_heredoc(int signo);

int ft_perror(char *str);

#endif
36 changes: 25 additions & 11 deletions inc/tokens.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ typedef enum e_token_type
REDIR_IN,
REDIR_OUT,
REDIR_APPEND,
REDIR_HEREDOC
REDIR_HEREDOC,
NONE
} t_token_type;

typedef struct s_token
Expand Down Expand Up @@ -73,26 +74,22 @@ int calc_stack_size(t_token *stack);
char **list_to_array(t_token *head);
void build_linked_list(t_token **tokens, char **argv);
void handle_quotes(char **tokens, int *pos, char **input);
void handle_special_chars(char **str, t_token **tokens);
void handle_regular_chars(char **tokens, int *pos, char **input, \
char *delim);
char *handle_special_chars(char *str, t_token **tokens);
void skip_delimiters(char **input, char *delim);
void reallocate_tokens(char ***tokens, int *bufsize);
void parse_loop(char **input, char **tokens, int *pos, int *bufsize);
char **parse_input(char *input);
// char *generate_prompt(void);
char *generate_prompt(t_ms_data *data);
void make_history(char *line);
void loop_cleanup(char *line, t_token *tokens, \
char *prompt, t_ast *tree);
void loop_cleanup(t_loop_data *loop_data, t_token *tokens_head);
void free_ms_data(t_ms_data *data);
char *check_heredoc(char *line);
char *heredoc(char *eof);
void init_ms_data(t_ms_data *data, char **argv, char **envp);
void initialise(int argc, char **argv);
void execute_command(char **parsed_text, t_token **tokens);
void print_maxishell(void);
int input_error_checks(const char *str);
int input_error_checks(t_loop_data *loop_data);
t_token *tokenise(char *str);
void print_tokens(t_token *tokens);
t_ast *parse_tokens(t_token **tokens, t_ms_data *data);
Expand All @@ -103,11 +100,11 @@ void free_all_tokens(t_token *tokens);
t_token *new_token(char *value, t_token_type type);
void append_token(t_token **tokens, t_token *new_token);
int valid_operator(const char **str);
t_ast *new_ast_node(t_token_type type);
t_ast *new_ast_node(void);
t_ast *create_redir(t_token **tokens, t_token *tmp, t_ms_data *data);
int arg_len(t_token *current);
void set_command_args(t_ast *command_node, t_token **tokens, \
int arg_count);
int arg_count);
t_ast *manage_commands(t_token **tokens, t_ms_data *data);
t_ast *create_redir_node(t_token *token);
int is_redir_node(t_token *tokens);
Expand All @@ -119,5 +116,22 @@ void execute_tree(t_ast *node, t_ms_data *data);
char *expand_env_and_loc_var(char *arg, t_ms_data *data);
char *append_literal(char **start, char *processed_arg);
char *process_argument(char *arg, t_ms_data *data);
char *expand_variable(char **start, t_ms_data *data);
void clear_history_file(void);
int is_in_single_quotes(char *arg);
void print_ast_args(t_ast *node);
void append_word_if_valid(char *start, char *str, t_token **tokens);
char *exit_status_adj(char *arg);
char *str_start_adj(char *arg);
char *tmp_adj(char *arg);
int cmd_arg_len(t_token *current);
char *exit_status_adj(char *arg);
int is_in_single_quotes(char *arg);
char *str_start_adj(char *arg);
char *tmp_adj(char *arg);
char *append_literal(char **start, char *processed_arg);
char *expand_variable(char **start, t_ms_data *data);
char *expand_env_and_loc_var(char *arg, t_ms_data *data);
void final_quote_removal(int arg_count, t_ast *command_node);

#endif
#endif
6 changes: 5 additions & 1 deletion lib/libft/inc/libft.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,19 @@ char *ft_strchr(const char *s, int c);
char *ft_strcat(char *dest, char *src);
char *ft_strrchr(const char *s, int c);
char **ft_split(char const *s, char c);
char *ft_strcpy(char *dest, const char *src);
char *ft_strndup(const char *s, size_t n);
char *ft_strjoin_free(char *s1, char *s2);
char *ft_strcpy(char *dest, const char *src);
char *ft_strjoin(char const *s1, char const *s2);
char *ft_strtrim(char const *s1, char const *set);
char *ft_strstr(const char *big, const char *little);
char *ft_strcat_const(const char *dest, const char *src);
char *ft_strmapi(char const *s, char (*f)(unsigned int, char));
char *ft_substr(char const *s, unsigned int start, size_t len);
char *ft_strnstr(const char *haystack, const char *needle, size_t len);

void ft_free_2d_arr(char **arr);
void ft_print_2d_arr(char **arr);
void ft_bzero(void *s, size_t n);
void ft_putnbr_fd(int n, int fd);
void ft_putchar_fd(char c, int fd);
Expand Down
25 changes: 25 additions & 0 deletions lib/libft/src/ft_free_2d_arr.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_free_2d_arr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rmikhayl <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/09 19:37:13 by rmikhayl #+# #+# */
/* Updated: 2024/09/09 19:37:16 by rmikhayl ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

void ft_free_2d_arr(char **arr)
{
int i;

if (!arr)
return ;
i = -1;
while (arr[++i] != NULL)
free(arr[i]);
free(arr);
}
22 changes: 22 additions & 0 deletions lib/libft/src/ft_print_2d_arr.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_2d_arr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rmikhayl <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/09 19:37:13 by rmikhayl #+# #+# */
/* Updated: 2024/09/09 19:37:16 by rmikhayl ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

void ft_print_2d_arr(char **arr)
{
int i;

i = -1;
while (arr[++i] != NULL)
ft_printf("arr[%d]: %s at add: %p \n", i, arr[i], arr[i]);
}
48 changes: 20 additions & 28 deletions src/parser/tokeniser_helpers.c → lib/libft/src/ft_strcat_const.c
Original file line number Diff line number Diff line change
@@ -1,46 +1,38 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* tokeniser_helpers.c :+: :+: :+: */
/* ft_strcat_const.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rocky <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/14 10:38:28 by rocky #+# #+# */
/* Updated: 2024/06/14 10:38:30 by rocky ### ########.fr */
/* Created: 2024/09/06 12:15:55 by rocky #+# #+# */
/* Updated: 2024/09/06 12:15:59 by rocky ### ########.fr */
/* */
/* ************************************************************************** */

#include "tokens.h"
#include "libft.h"

t_token *new_token(char *value, t_token_type type)
char *ft_strcat_const(const char *dest, const char *src)
{
t_token *token;
int i;
int j;
char *result;

token = malloc(sizeof(t_token));
if (!token)
result = malloc(sizeof(char) * (ft_strlen(dest) + ft_strlen(src) + 1));
if (!result)
return (NULL);
token->data = ft_strdup(value);
if (!token->data)
i = 0;
while (dest[i] != '\0')
{
free(token);
return (NULL);
result[i] = dest[i];
i++;
}
token->type = type;
token->next = NULL;
return (token);
}

void append_token(t_token **tokens, t_token *new_token)
{
t_token *prev;

if (!*tokens)
*tokens = new_token;
else
j = 0;
while (src[j] != '\0')
{
prev = *tokens;
while (prev->next)
prev = prev->next;
prev->next = new_token;
result[i + j] = src[j];
j++;
}
result[i + j] = '\0';
return (result);
}
Loading

0 comments on commit c803dc2

Please sign in to comment.