summaryrefslogtreecommitdiffstats
path: root/src/b_sqb_err.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-08-26 18:26:44 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-08-26 18:26:44 +0200
commitf7ed540c183e6a20f1956901ee6ebd908745ccb8 (patch)
treefef209f6347ad666086bfcc46bb6838610f57618 /src/b_sqb_err.c
parentErr check in progress (diff)
download42-minishell-f7ed540c183e6a20f1956901ee6ebd908745ccb8.tar.gz
42-minishell-f7ed540c183e6a20f1956901ee6ebd908745ccb8.tar.bz2
42-minishell-f7ed540c183e6a20f1956901ee6ebd908745ccb8.tar.xz
42-minishell-f7ed540c183e6a20f1956901ee6ebd908745ccb8.tar.zst
42-minishell-f7ed540c183e6a20f1956901ee6ebd908745ccb8.zip
Err check in progress
Diffstat (limited to '')
-rw-r--r--src/b_sqb_err.c35
1 files changed, 12 insertions, 23 deletions
diff --git a/src/b_sqb_err.c b/src/b_sqb_err.c
index 1755082..eac6a8a 100644
--- a/src/b_sqb_err.c
+++ b/src/b_sqb_err.c
@@ -18,8 +18,8 @@
#include "u_utils.h"
static uint8_t
- b_file_err(const uint64_t argc,
- char *argv[])
+ b_single_op(const uint64_t argc,
+ char *argv[])
{
if (argc > 3)
{
@@ -30,8 +30,8 @@ static uint8_t
}
static uint8_t
- b_double_file_err(const uint64_t argc,
- char *argv[])
+ b_double_op(const uint64_t argc,
+ char *argv[])
{
if (argc > 4)
{
@@ -47,19 +47,9 @@ static uint8_t
}
static uint8_t
- b_str_err(const uint64_t argc,
- char *argv[])
+ b_bad_nbr(char *argv[])
{
- if (argc > 4)
- {
- ft_dprintf(STDERR_FILENO, "[: %s: unexpected operator\n", argv[2]);
- return (1);
- }
- else if (argc == 3)
- {
- ft_dprintf(STDERR_FILENO, "[: %s: argument expected\n", argv[1]);
- return (1);
- }
+ (void)argv;
return (0);
}
@@ -69,20 +59,19 @@ uint8_t
{
const uint64_t argc = u_builtins_get_argc((const char**)argv);
- if (id < FT_ID_SQB_NT && id != FT_ID_SQB_Z && id != FT_ID_SQB_N)
+ if (id < FT_ID_SQB_NT)
{
- if (b_file_err(argc, argv) != 0)
+ if (b_single_op(argc, argv) != 0)
return (1);
}
- else if (id == FT_ID_SQB_NT || id == FT_ID_SQB_OT)
+ else if (id >= FT_ID_SQB_NT)
{
- if (b_double_file_err(argc, argv) != 0)
+ if (b_double_op(argc, argv) != 0)
return (1);
}
- else if (id == FT_ID_SQB_N || id == FT_ID_SQB_Z ||
- id == FT_ID_SQB_EQUA || id == FT_ID_SQB_DIFF)
+ if (id >= FT_ID_SQB_EQ)
{
- if (b_str_err(argc, argv) != 0)
+ if (b_bad_nbr(argv) != 0)
return (1);
}
return (0);