fixed signal and removed infloop after unicode nofix

This commit is contained in:
whaffman 2025-02-19 17:56:57 +01:00
parent 49d3a8232b
commit 450add4cb7
8 changed files with 90 additions and 17 deletions

29
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,29 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug minishell",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/minishell",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "Build minishell",
"miDebuggerPath": "/usr/bin/gdb",
"logging": {
"engineLogging": true
}
}
]
}

34
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,34 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Build minishell",
"type": "shell",
"command": "make",
"args": [],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": ["$gcc"],
"detail": "Generated task for building minishell"
},
{
"label": "Run minishell",
"type": "shell",
"command": "./minishell",
"args": [],
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
},
"problemMatcher": []
}
]
}

View File

@ -6,7 +6,7 @@
# By: qmennen <qmennen@student.codam.nl> +#+ #
# +#+ #
# Created: 2024/10/15 11:48:46 by whaffman #+# #+# #
# Updated: 2025/02/19 12:18:18 by whaffman ######## odam.nl #
# Updated: 2025/02/19 17:43:13 by whaffman ######## odam.nl #
# #
# **************************************************************************** #
@ -32,7 +32,7 @@ CC = cc
RM = rm -rf
INCLUDES = -I./$(INC_PATH) -I./$(LIBFT_INC_PATH)
CFLAGS = -Wall -Wextra -Werror -fsanitize=address,undefined -MMD
CFLAGS = -Wall -Wextra -Werror -fsanitize=address,undefined -MMD -g3
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)

View File

@ -6,7 +6,7 @@
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/02/04 16:13:13 by whaffman #+# #+# */
/* Updated: 2025/02/19 12:38:57 by whaffman ######## odam.nl */
/* Updated: 2025/02/19 14:46:53 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
@ -41,4 +41,6 @@
# define PROMPT RESET "🐚" GREEN "minishell" RESET ": "
# define PROMPT_LEN 51
void token_print(void *param);
#endif

View File

@ -6,7 +6,7 @@
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/02/19 12:26:09 by whaffman #+# #+# */
/* Updated: 2025/02/19 13:39:58 by whaffman ######## odam.nl */
/* Updated: 2025/02/19 17:30:12 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
@ -17,6 +17,7 @@
void sigint_heredoc_handler(int signum);
void sigint_minishell_handler(int signum);
void sig_parent_handler(int signum);
void signal_init_child(void);
void signal_init_parent(void);
void signal_init_minishell(void);

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* lexer_parse_input.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/05 19:09:20 by qmennen #+# #+# */
/* Updated: 2025/02/05 19:09:26 by qmennen ### ########.fr */
/* :::::::: */
/* lexer_parse_input.c :+: :+: */
/* +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/02/05 19:09:20 by qmennen #+# #+# */
/* Updated: 2025/02/19 17:53:12 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
@ -32,7 +32,7 @@ t_list *ft_parse_input(t_lexer *lexer)
while (TRUE)
{
token = ft_token_next(lexer);
if (token->type == T_EOF)
if (token->type == T_EOF || token->type == T_ERROR) //TODO T_ERROR removes the inf loop
break ;
ft_lstadd_back(&list, ft_lstnew(token));
}

View File

@ -6,7 +6,7 @@
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/02/04 16:19:22 by whaffman #+# #+# */
/* Updated: 2025/02/19 12:48:13 by whaffman ######## odam.nl */
/* Updated: 2025/02/19 14:46:41 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
@ -14,7 +14,7 @@
#include "minishell.h"
#include "utils.h"
static void token_print(void *param)
void token_print(void *param)
{
t_token *token;

View File

@ -6,7 +6,7 @@
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/02/19 12:18:47 by whaffman #+# #+# */
/* Updated: 2025/02/19 13:42:55 by whaffman ######## odam.nl */
/* Updated: 2025/02/19 17:30:12 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
@ -31,6 +31,13 @@ void sigint_heredoc_handler(int signum)
exit(130);
}
void sig_parent_handler(int signum)
{
(void)signum;
ft_putstr_fd("\n", 1);
}
void signal_init_minishell(void)
{
signal(SIGINT, sigint_minishell_handler);
@ -39,8 +46,8 @@ void signal_init_minishell(void)
void signal_init_parent(void)
{
signal(SIGINT, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
signal(SIGINT, sig_parent_handler);
signal(SIGQUIT, sig_parent_handler);
}