From 8eb4df24eb30353bea82268440396e50ed8b1bbc Mon Sep 17 00:00:00 2001 From: gramanas Date: Fri, 16 Nov 2018 18:05:57 +0200 Subject: Fix bugs in test-ck and simplify clparser --- src/clparser.h | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/clparser.h') diff --git a/src/clparser.h b/src/clparser.h index 9b22b87..f6818fa 100644 --- a/src/clparser.h +++ b/src/clparser.h @@ -20,19 +20,20 @@ #include "cklist.h" -#define CK_ACTIONS \ - X(INIT) \ - X(ADD) \ - X(DEL) \ - X(EDIT) \ - X(LIST) \ - X(SEARCH) \ - X(RESTORE) \ - X(HELP) +/* NAME | MIN ACCEPTED ARGS | MAX ACCEPTED ARGS */ +#define CK_ACTIONS \ + X(INIT, 2 , 2) \ + X(ADD, 2, 4) \ + X(DEL, 1, 2) \ + X(EDIT, 1, 2) \ + X(LIST, 1, 6) \ + X(SEARCH, 1, 1) \ + X(RESTORE, 1, 2) \ + X(HELP, 1, 1) enum ParseErrors { PERR_NOERR = 0, -#define X(ACTION) \ +#define X(ACTION, MIN, MAX) \ PERR_##ACTION##_WRONG, CK_ACTIONS #undef X @@ -42,7 +43,7 @@ typedef enum ParseErrors ParseError; enum CkActions { CK_WRONG_ACTION, -#define X(ACTION) \ +#define X(ACTION, MIN, MAX) \ CKA_##ACTION, CK_ACTIONS #undef X -- cgit v1.2.3