Create header file for builtins
authorLukáš Jiřiště <jiriste@icpf.cas.cz>
Mon, 26 Aug 2024 09:46:19 +0000 (11:46 +0200)
committerLukáš Jiřiště <jiriste@icpf.cas.cz>
Mon, 26 Aug 2024 09:52:11 +0000 (11:52 +0200)
inc/builtins.h [new file with mode: 0644]
inc/execution.h
src/builtins/cd.c
src/builtins/echo.c
src/builtins/env.c
src/builtins/export.c
src/builtins/pwd.c
src/execution.c

diff --git a/inc/builtins.h b/inc/builtins.h
new file mode 100644 (file)
index 0000000..752d10a
--- /dev/null
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   builtins.h                                         :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2024/08/26 11:39:54 by ljiriste          #+#    #+#             */
+/*   Updated: 2024/08/26 11:51:32 by ljiriste         ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef BUILTINS_H
+# define BUILTINS_H
+
+#include "minishell_structs.h"
+
+int            cd(int argc, char **argv, t_execution_env *env);
+int            echo(int argc, char **argv);
+int            pwd(void);
+int            ft_env(int argc, t_execution_env *env);
+int            export(int argc, char **argv, t_execution_env *env);
+
+#endif // BUILTINS_H
index 5e4d6a54691fe17de623fbdbba3caa2a39dd8aa8..9aa5207f32ed23f778d36b5d18b061c6c436ac27 100644 (file)
@@ -6,19 +6,11 @@
 /*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/08/02 17:40:19 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/08/26 11:41:25 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/08/26 11:42:37 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #ifndef EXECUTION_H
 # define EXECUTION_H
 
-#include "minishell.h"
-
-int            cd(int argc, char **argv, t_execution_env *env);
-int            echo(int argc, char **argv);
-int            pwd(void);
-int            ft_env(int argc, t_execution_env *env);
-int            export(int argc, char **argv, t_execution_env *env);
-
 #endif // EXECUTION_H
index 31979b632a5f38601822a07ad66b3f0183aab573..ba1fa719d286abbc9a634c343e47fd9b884de736 100644 (file)
@@ -6,12 +6,12 @@
 /*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/08/02 16:37:48 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/08/23 16:54:38 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/08/26 11:45:11 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
-#include "minishell.h"
-#include "execution.h"
+#include "builtins.h"
+#include "minishell_structs.h"
 #include <unistd.h>
 #include <stdlib.h>
 
index f00219bbb6af8cb677e4d5fdb996126224c4fd11..1a21600522d51888289d3f0c20dfb940b6dde3f6 100644 (file)
@@ -1,6 +1,18 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   echo.c                                             :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2024/08/26 11:43:48 by ljiriste          #+#    #+#             */
+/*   Updated: 2024/08/26 11:45:17 by ljiriste         ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "builtins.h"
+#include "minishell_structs.h"
 #include <stdio.h>
-#include "minishell.h"
-#include "execution.h"
 #include <unistd.h>
 
 int    ft_check_n(char *str)
index ebfc66f13cfccb2a65cca2fc8e9bbbb859e0b585..5caf116009179286e472b4483935d4c8351d02fe 100644 (file)
@@ -1,8 +1,20 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   env.c                                              :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2024/08/26 11:44:01 by ljiriste          #+#    #+#             */
+/*   Updated: 2024/08/26 11:44:23 by ljiriste         ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "builtins.h"
+#include "minishell_structs.h"
+#include "libft.h"
 #include <stdio.h>
 #include <unistd.h>
-#include "minishell.h"
-#include "execution.h"
-#include "libft.h"
 
 int    env_exec(const t_execution_env *env)
 {
index de808e23427badc9d74188951e7ff4a1cf809a9b..c0ea1b046ab75a7604d218af6ce9d2c0b155445a 100644 (file)
@@ -6,12 +6,12 @@
 /*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/08/23 09:40:38 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/08/23 18:06:00 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/08/26 11:44:35 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
-#include "execution.h"
-#include "minishell.h"
+#include "builtins.h"
+#include "minishell_structs.h"
 #include <stdlib.h>
 
 static void            unset_single(const char *name, t_execution_env *env)
index 7176bec9bfb5ebb98440ff825f9fcde12df7d27c..71e85b1c00fc8c29e16fffa755f94a8c730bb0ca 100644 (file)
@@ -1,7 +1,19 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   pwd.c                                              :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2024/08/26 11:44:43 by ljiriste          #+#    #+#             */
+/*   Updated: 2024/08/26 11:44:47 by ljiriste         ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "builtins.h"
+#include "minishell_structs.h"
 #include <stdio.h>
 #include <unistd.h>
-#include "minishell.h"
-#include "execution.h"
 
 int    pwd(void)
 {
index 3a8efda05feb9390f776c114c2c1e1565b4acfcb..2c42b31366a03a39dca387b657792ebc8e02bdf3 100644 (file)
@@ -6,12 +6,13 @@
 /*   By: lnikolov <lnikolov@student.42prague.com    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/07/21 08:57:54 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/08/26 09:40:31 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/08/26 11:50:12 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
-#include "minishell_structs.h"
 #include "execution.h"
+#include "builtins.h"
+#include "minishell_structs.h"
 #include "minishell.h"
 #include "libft.h"
 #include <stdlib.h>