From 38574e73fee93cd7201990fcf80fc63fcb95565e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 25 Jun 2013 14:03:22 +0200 Subject: add function for add option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/argparser.c | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 93 insertions(+), 3 deletions(-) diff --git a/src/argparser.c b/src/argparser.c index 348e1f6..e1d8825 100644 --- a/src/argparser.c +++ b/src/argparser.c @@ -33,6 +33,46 @@ static void sort(char** list, long count); static long cmp(char* a, char* b); + +/** + * Option structure + */ +typedef struct +{ + /** + * The type of the option, either of: `ARGUMENTLESS`, `ARGUMENTED`, `VARIADIC` + */ + long type; + + /** + * Alterative option names + */ + char** alternatives; + + /** + * Number of elements in `alternatives` + */ + long alternatives_count; + + /** + * Standard option name + */ + char* standard; + + /** + * Argument name, not for argumentless options + */ + char* argument; + + /** + * Help text, multi-line + */ + char* help; + +} args_Option; + + + /** * Whether the Linux VT is being used */ @@ -103,13 +143,25 @@ long args_files_count; */ void** args_freequeue; -// Options, in order -// ArrayList