clear is back

This commit is contained in:
whaffman 2025-03-05 13:35:03 +01:00
parent 9160d8bbdd
commit 097ab702b5
5 changed files with 40 additions and 15 deletions

View File

@ -6,7 +6,7 @@
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/02/20 11:09:02 by whaffman #+# #+# */
/* Updated: 2025/02/26 15:44:47 by whaffman ######## odam.nl */
/* Updated: 2025/03/05 13:33:28 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
@ -18,6 +18,7 @@ int is_builtin(char *cmd);
int builtin_router(t_minishell *msh, t_command *cmd);
int builtin_echo(t_minishell *msh, t_command *cmd);
int builtin_cd(t_minishell *msh, t_command *cmd);
int builtin_clear(t_minishell *msh, t_command *cmd);
int builtin_pwd(t_minishell *msh, t_command *cmd);
int builtin_export(t_minishell *msh, t_command *cmd);
int builtin_unset(t_minishell *msh, t_command *cmd);

View File

@ -8,20 +8,22 @@ error_msg.c free_command_list.c ft_strdup_safe.c malloc_safe.c \
free_minishell.c lexer_read_char.c lexer_new.c lexer_parse_quotes.c \
lexer_parse_input.c lexer_read_word.c lexer_token_next.c token_new.c \
token_char_convert.c token_parse.c token_type_convert.c \
environment_del.c environment_free.c environment_get.c \
environment_free_list.c environment_parse.c environment_add.c \
environment_get_arr.c environment_print.c environment_update.c \
executor_close_fds.c executor_open_fds.c executor_count_fds.c \
executor_create_pipes.c executor_create_redirects.c executor_fork.c \
token_from_list.c environment_del.c environment_free.c \
environment_get.c environment_free_list.c environment_parse.c \
environment_add.c environment_get_arr.c environment_print.c \
environment_update.c executor_close_fds.c executor_open_fds.c \
executor_count_fds.c executor_create_pipes.c \
executor_create_redirects.c executor_fork.c \
executor_execute_pipeline.c executor_absolute_path.c executor_child.c \
parser_create_command.c parser_validate_command.c \
parser_alloc_command.c parser_get_commands.c parser_get_arguments.c \
parser_sanitize_string.c signal.c signal_init.c.c print_freelist.c \
print_commands.c expander_expand_dollar.c expander_is_character.c \
parser_alloc_command.c parser_get_commands.c parser_sanitize_string.c \
parser_count_arguments.c parser_get_arguments.c signal.c \
signal_init.c.c print_freelist.c print_commands.c \
expander_expand_dollar.c expander_is_character.c \
expander_parse_variables.c expander_get_variable.c \
expander_allocate_memory.c expander_parse_string.c builtin_unset.c \
builtin_pwd.c builtin_cd.c builtin_echo.c builtin_env.c \
builtin_exit.c builtin_export.c builtin_router.c is_builtin.c \
simple_builtins.c redirect_process_heredoc.c redirect_get_inputs.c \
redirect_get_outputs.c redirect_new.c redirect_new_error.c \
redirect_valid_type.c main.c \
simple_builtins.c builtin_clear.c redirect_process_heredoc.c \
redirect_get_inputs.c redirect_get_outputs.c redirect_new.c \
redirect_new_error.c redirect_valid_type.c main.c \

View File

@ -0,0 +1,21 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* builtin_clear.c :+: :+: */
/* +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/03/05 13:30:18 by whaffman #+# #+# */
/* Updated: 2025/03/05 13:34:28 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
#include "minishell.h"
int builtin_clear(t_minishell *msh, t_command *cmd)
{
(void)msh;
(void)cmd;
ft_putstr_fd("\033[2J\033[H", STDOUT_FILENO);
return (0);
}

View File

@ -6,7 +6,7 @@
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/02/20 11:12:38 by whaffman #+# #+# */
/* Updated: 2025/03/04 16:19:15 by whaffman ######## odam.nl */
/* Updated: 2025/03/05 13:33:21 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
@ -17,6 +17,7 @@ int builtin_router(t_minishell *msh, t_command *cmd)
const t_builtin_fn builtin_fn[] = {
builtin_echo,
builtin_cd,
builtin_clear,
builtin_pwd,
builtin_export,
builtin_unset,

View File

@ -6,7 +6,7 @@
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/02/20 11:03:33 by whaffman #+# #+# */
/* Updated: 2025/03/04 15:45:38 by whaffman ######## odam.nl */
/* Updated: 2025/03/05 13:33:11 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
@ -14,7 +14,7 @@
int is_builtin(char *cmd)
{
const char *builtins[] = {"echo", "cd", "pwd", "export",
const char *builtins[] = {"echo", "cd", "clear", "pwd", "export",
"unset", "env", "exit", NULL};
int i;