summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO.org2
-rw-r--r--src/b_alias.c29
2 files changed, 19 insertions, 12 deletions
diff --git a/TODO.org b/TODO.org
index 640f3af..e3374ab 100644
--- a/TODO.org
+++ b/TODO.org
@@ -40,7 +40,7 @@
** TODO [#B] history builtin
** TODO [#C] Norm
** DONE [#C] [ builtin <=== pretty cool yet simple stuff ( [ $a -eq 1 ] )
-** TODO [#C] alias
+** DONE [#C] alias
** DONE [#C] Read scripts
** DONE [#C] PSX rice
** TODO [#C] Termcaps
diff --git a/src/b_alias.c b/src/b_alias.c
index badd281..daa6e99 100644
--- a/src/b_alias.c
+++ b/src/b_alias.c
@@ -23,20 +23,10 @@
#include "u_utils.h"
static uint8_t
- b_print_arg(const char arg[], t_msh *msh)
+ b_print_arg_next(char *ptr, const char arg[], t_bool invalid, t_msh *msh)
{
- char *ptr;
char val[ARG_MAX];
- t_bool invalid;
- ptr = (char*)arg;
- invalid = FALSE;
- while (*ptr != C_NUL && *ptr != C_EQUALS)
- {
- if (ft_iswhitespace(*ptr) == TRUE)
- invalid = TRUE;
- ptr++;
- }
if (*ptr == C_NUL)
{
if (u_get_alias_value(val, arg, ARG_MAX, msh) != 0)
@@ -61,6 +51,23 @@ static uint8_t
return (0);
}
+static uint8_t
+ b_print_arg(const char arg[], t_msh *msh)
+{
+ char *ptr;
+ t_bool invalid;
+
+ ptr = (char*)arg;
+ invalid = FALSE;
+ while (*ptr != C_NUL && *ptr != C_EQUALS)
+ {
+ if (ft_iswhitespace(*ptr) == TRUE)
+ invalid = TRUE;
+ ptr++;
+ }
+ return (b_print_arg_next(ptr, arg, invalid, msh));
+}
+
static void
b_register_arg(const char arg[], t_msh *msh)
{