MiniDevil As beautiful as a shell
builtins.h
Go to the documentation of this file.
1 /* ************************************************************************** */
2 /* */
3 /* ::: :::::::: */
4 /* builtins.h :+: :+: :+: */
5 /* +:+ +:+ +:+ */
6 /* By: baelgadi <baelgadi@student.42.fr> +#+ +:+ +#+ */
7 /* +#+#+#+#+#+ +#+ */
8 /* Created: 2025/12/11 05:03:44 by baelgadi #+# #+# */
9 /* Updated: 2026/03/11 02:52:37 by baelgadi ### ########.fr */
10 /* */
11 /* ************************************************************************** */
12 
13 #ifndef BUILTINS_H
14 # define BUILTINS_H
15 
16 # include "structs.h"
17 
18 /* ────────────── builtin_echo.c ──────────────── */
19 
20 int builtin_echo(char **args);
21 
22 /* ────────────── builtin_pwd.c ──────────────── */
23 
24 int builtin_pwd(void);
25 
26 /* ────────────── builtin_cd.c ──────────────── */
27 
28 int builtin_cd(char **args, t_env **env);
29 
30 /* ────────────── builtin_exit.c ──────────────── */
31 
32 int builtin_exit(char **args, t_shell *shell);
33 
34 /* ────────────── builtin_env.c ──────────────── */
35 
36 int builtin_env(char **args, t_env *env);
37 
38 /* ────────────── builtin_export.c ──────────────── */
39 
40 int builtin_export(char **args, t_env **env);
41 
42 /* ────────────── export_utils.c ──────────────── */
43 
44 void print_sorted_export(t_env *env);
45 
46 /* ────────────── export_ops.c ──────────────── */
47 
48 void export_assign(t_env **env, char *arg);
49 
50 void export_append(t_env **env, char *arg);
51 
52 void export_no_value(t_env **env, char *key);
53 
54 /* ────────────── builtin_unset.c ──────────────── */
55 
56 int builtin_unset(char **args, t_env **env);
57 
58 #endif
void print_sorted_export(t_env *env)
Print all env vars sorted in alphabetical order, in declare -x format.
Definition: export_utils.c:120
int builtin_echo(char **args)
Implement the echo command.
Definition: builtin_echo.c:52
int builtin_cd(char **args, t_env **env)
Implement the cd command.
Definition: builtin_cd.c:101
void export_no_value(t_env **env, char *key)
Export a variable with no value (export KEY)
Definition: export_ops.c:26
void export_assign(t_env **env, char *arg)
Export a variable with a value (export KEY=value)
Definition: export_ops.c:55
int builtin_unset(char **args, t_env **env)
Implement the unset command.
Definition: builtin_unset.c:86
int builtin_env(char **args, t_env *env)
Implement the env command.
Definition: builtin_env.c:26
int builtin_exit(char **args, t_shell *shell)
Implement the exit command.
Definition: builtin_exit.c:29
int builtin_pwd(void)
Implement the pwd command.
Definition: builtin_pwd.c:24
int builtin_export(char **args, t_env **env)
Implement the export command.
void export_append(t_env **env, char *arg)
Export a variable with append (export KEY+=value)
Definition: export_ops.c:104
Central type definitions for mandatory part.
Environment variable (doubly linked list)
Definition: structs.h:87
Shell state.
Definition: structs.h:164