aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-09-15 17:54:48 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-09-15 17:54:48 +0200
commitf626f2715ab696fdb326ed67256d012d86faef9f (patch)
treef25f2d95688a89c662622e3c2f11786f27689713 /src/utils.c
parent170d0b74fa725196bca0fa549520d0d8bfa07576 (diff)
downloadminishell-f626f2715ab696fdb326ed67256d012d86faef9f.tar.gz
minishell-f626f2715ab696fdb326ed67256d012d86faef9f.tar.bz2
minishell-f626f2715ab696fdb326ed67256d012d86faef9f.zip
Refactoring env, Removing bloat from utils, exec and env
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c57
1 files changed, 4 insertions, 53 deletions
diff --git a/src/utils.c b/src/utils.c
index 9fd47c0..b9231c5 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -6,7 +6,7 @@
/* By: cacharle <cacharle@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/28 11:56:31 by cacharle #+# #+# */
-/* Updated: 2020/09/12 16:30:43 by charles ### ########.fr */
+/* Updated: 2020/09/15 17:42:00 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -17,58 +17,9 @@
#include "minishell.h"
-
-/* bool utils_is_var_name(char *name) */
-/* { */
-/* if (!(ft_isalpha(*name) || *name == '_')) */
-/* return (false); */
-/* name++; */
-/* while (*name != '\0) */
-/* if (!(ft_isalnum(*name) || *name == '_')) */
-/* return (false); */
-/* return (true); */
-/* } */
-
-size_t utils_var_end(char *name)
-{
- size_t i;
-
- if (*name == '?')
- return (2);
- if (ft_isdigit(*name))
- return (0);
- i = 0;
- while (ft_isalnum(name[i]) || name[i] == '_')
- i++;
- return (i + 1);
-}
-
-bool utils_valid_identifier(char *name)
-{
- if (ft_isdigit(*name) || *name == '\0')
- return (false);
- while (*name != '\0')
- {
- if (!ft_isalnum(*name) && *name != '_')
- return (false);
- name++;
- }
- return (true);
-}
-
-bool utils_start_with_valid_identifier(char *name)
-{
- char *equal_ptr;
- bool ret;
-
- equal_ptr = ft_strchr(name, '=');
- if (equal_ptr == NULL)
- return (false);
- *equal_ptr = '\0';
- ret = utils_valid_identifier(name);
- *equal_ptr = '=';
- return (ret);
-}
+/*
+** \brief Print the shell prompt, tries to display the current directory
+*/
void print_prompt(void)
{