aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-04-05 15:04:23 +0200
committerCharles <sircharlesaze@gmail.com>2020-04-05 15:04:23 +0200
commit4aeba6d2f03706fa21281709a138a7d3ea9797dc (patch)
treebe8938b8cbd06b647f927cc3e38eceee01720ca1 /include
parentdb122618b7dd0e1c2b9432e3f470c880e0d4422e (diff)
downloadminishell-4aeba6d2f03706fa21281709a138a7d3ea9797dc.tar.gz
minishell-4aeba6d2f03706fa21281709a138a7d3ea9797dc.tar.bz2
minishell-4aeba6d2f03706fa21281709a138a7d3ea9797dc.zip
Preprocessing (glob and iterpolation) draft (not tested)
Diffstat (limited to 'include')
-rw-r--r--include/minishell.h14
-rw-r--r--include/ms_glob.h32
-rw-r--r--include/utils.h31
3 files changed, 65 insertions, 12 deletions
diff --git a/include/minishell.h b/include/minishell.h
index ed332c4..9551c1f 100644
--- a/include/minishell.h
+++ b/include/minishell.h
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/26 15:33:51 by cacharle #+# #+# */
-/* Updated: 2020/04/04 14:50:21 by charles ### ########.fr */
+/* Updated: 2020/04/05 14:52:20 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -71,6 +71,7 @@ t_path path_update(t_path path, char *path_var);
t_env env_from_array(char **envp);
char *env_search(t_env env, char *key);
+char *env_search_first_match(t_env env, const char *haystack);
/*
** builtin*.c - directory with all builtin commands
@@ -108,17 +109,6 @@ int builtin_exit(char **argv, t_env env);
** preprocess.c
*/
-char *ms_glob(char *pattern);
char *preprocess(char *input, t_env env);
-/*
-** util.c - various utilitary functions
-*/
-
-int utils_directory_iter(
- char *dirname,
- void *param,
- int (*f)(char*, struct dirent*, void*)
- );
-
#endif
diff --git a/include/ms_glob.h b/include/ms_glob.h
new file mode 100644
index 0000000..774d3be
--- /dev/null
+++ b/include/ms_glob.h
@@ -0,0 +1,32 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ms_glob.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/04/05 11:45:11 by charles #+# #+# */
+/* Updated: 2020/04/05 13:05:10 by charles ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef MS_GLOB_H
+# define MS_GLOB_H
+
+# include <dirent.h>
+# include <unistd.h>
+# include <stddef.h>
+# include "libft_str.h"
+# include "libft_vec.h"
+# include "utils.h"
+
+struct s_glob_param
+{
+ char *pattern;
+ t_ftvec *matches;
+};
+
+t_ftvec *glob_matches(char *pattern);
+char *ms_glob(char *pattern);
+
+#endif
diff --git a/include/utils.h b/include/utils.h
new file mode 100644
index 0000000..6f2fbc9
--- /dev/null
+++ b/include/utils.h
@@ -0,0 +1,31 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* utils.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/04/05 12:05:49 by charles #+# #+# */
+/* Updated: 2020/04/05 14:51:38 by charles ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef UTILS_H
+# define UTILS_H
+
+/*
+** \file utils.h
+** \brief Various utilitary functions
+*/
+
+typedef int (*t_directory_iter_func)(char*, struct dirent*, void*);
+
+int utils_directory_iter(
+ char *dirname,
+ void *param,
+ t_directory_iter_func f
+);
+
+size_t utils_var_end(char *name);
+
+#endif