diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-25 21:46:45 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-25 21:46:45 +0200 |
commit | d05cc52ae73d3daf54b71d030e7bce659b159f7d (patch) | |
tree | ad4517c4acf273c7f8c7415891984a9a063ebbf8 | |
parent | sqb in progress (diff) | |
download | 42-minishell-d05cc52ae73d3daf54b71d030e7bce659b159f7d.tar.gz 42-minishell-d05cc52ae73d3daf54b71d030e7bce659b159f7d.tar.bz2 42-minishell-d05cc52ae73d3daf54b71d030e7bce659b159f7d.tar.xz 42-minishell-d05cc52ae73d3daf54b71d030e7bce659b159f7d.tar.zst 42-minishell-d05cc52ae73d3daf54b71d030e7bce659b159f7d.zip |
New todo, in progress
-rw-r--r-- | TODO.org | 1 | ||||
-rw-r--r-- | src/b_sqb.c | 23 | ||||
-rw-r--r-- | src/d_define.h | 62 | ||||
-rw-r--r-- | src/e_builtins.c | 2 |
4 files changed, 85 insertions, 3 deletions
@@ -15,6 +15,7 @@ ** DONE [#C] leaks on builtins (same as above man) ** TODO [#C] Handle memory ** TODO [#C] Go full stack to ken dash in the ass +** TODO [#C] Handle comments better # * Stuff to add ** DONE [#A] builtins to pipes diff --git a/src/b_sqb.c b/src/b_sqb.c index 312fd90..9e7015c 100644 --- a/src/b_sqb.c +++ b/src/b_sqb.c @@ -17,17 +17,36 @@ #include "s_struct.h" #include "u_utils.h" +/* static uint8_t */ +/* b_get_sqb_id(uint64_t argc, */ +/* char *argv[],) */ +/* { */ +/* } */ + +static uint8_t + b_eval_sqb(uint64_t argc, + char *argv[], + t_msh *msh) +{ + (void)argc; + (void)argv; + (void)msh; + + return (0); +} + uint8_t b_sqb(char *args[], t_msh *msh) { const uint64_t argc = u_builtins_get_argc((const char**)args); - (void)msh; if (ft_strncmp(args[argc - 1], "]", 2) != 0) { ft_dprintf(STDERR_FILENO, "[: missing ]\n"); return (2); } - return (0); + if (argc == 1) + return (1); + return (b_eval_sqb(argc, args, msh)); } diff --git a/src/d_define.h b/src/d_define.h index 9042037..e094df1 100644 --- a/src/d_define.h +++ b/src/d_define.h @@ -68,4 +68,66 @@ #define FT_MINISHELLRC ".minishellrc" #define FT_DEFAULT_HISTFILE ".minishell_history" +/* +** ====== SQB OPTIONS ====== +*/ + +#define FT_SQB_B "-b" +#define FT_SQB_C "-c" +#define FT_SQB_D "-d" +#define FT_SQB_E "-e" +#define FT_SQB_F "-f" +#define FT_SQB_G "-g" +#define FT_SQB_H "-h" +#define FT_SQB_K "-k" +#define FT_SQB_N "-n" +#define FT_SQB_S "-s" +#define FT_SQB_U "-u" +#define FT_SQB_W "-w" +#define FT_SQB_X "-x" +#define FT_SQB_Z "-z" +#define FT_SQB_L_MAJ "-L" +#define FT_SQB_S_MAJ "-b" +#define FT_SQB_NT "-nt" +#define FT_SQB_OT "-ot" +#define FT_SQB_EQUALS "=" +#define FT_SQB_DIFF "!=" +#define FT_SQB_EQ "-eq" +#define FT_SQB_NE "-ne" +#define FT_SQB_GT "-gt" +#define FT_SQB_GE "-ge" +#define FT_SQB_LT "-lt" +#define FT_SQB_LE "-le" + +enum +{ + FT_ID_SQB_B, + FT_ID_SQB_C, + FT_ID_SQB_D, + FT_ID_SQB_E, + FT_ID_SQB_F, + FT_ID_SQB_G, + FT_ID_SQB_H, + FT_ID_SQB_K, + FT_ID_SQB_N, + FT_ID_SQB_S, + FT_ID_SQB_U, + FT_ID_SQB_W, + FT_ID_SQB_X, + FT_ID_SQB_Z, + FT_ID_SQB_L_MAJ, + FT_ID_SQB_S_MAJ, + FT_ID_SQB_NT, + FT_ID_SQB_OT, + FT_ID_SQB_EQUALS, + FT_ID_SQB_DIFF, + FT_ID_SQB_EQ, + FT_ID_SQB_NE, + FT_ID_SQB_GT, + FT_ID_SQB_GE, + FT_ID_SQB_LT, + FT_ID_SQB_LE, + FT_ID_SQB_COUNT +}; + #endif diff --git a/src/e_builtins.c b/src/e_builtins.c index 18abc16..b94c328 100644 --- a/src/e_builtins.c +++ b/src/e_builtins.c @@ -75,7 +75,7 @@ static void b_export_mute(ptr->argv + 1, msh); else if (bu_id == FT_ID_UNSET) msh->bu_ptr[bu_id](ptr->argv + 1, msh); - else if (bu_id == FT_ID_EXIT && ret == 0) + else if (bu_id == FT_ID_EXIT) { s_line_clear(&msh->curr); s_destroy(msh); |