******************************************************
HOW TO USE (this assumes that you are knowledgeable in linking the file)
******************************************************

01. setup the variables

int  year  = 2004;
          \    \
           \    initial value
         user declaration


02.  set the flag for the variable

ARGUMENTS arg_settings[] = {{"y", INTEGER,   &year,  "description"}};
             /               /         /        /          /
        user declared       /         /        /          /
  flag to be used(user declared)     /        /          /
                          type of flag       /          /
                        address of the variable        /
                        description of the flag(used during errors)


03.  call init_arg
    init_arg(argc, argv, arg_settings, TAB_SIZE, ARG_DASH, 0);
               \      \       \             \          \    \
         argc of main  \       \             \          \    \
             argv of main       \             \          \    \
                              see #02.         \          \    \
                                        size of struct     \    \
                                     dash is used in arguments   \
                                                            zero (special options not used)

04. sample with no error handling

#include <stdio.h>
#include "getargs.h"

int  year  = 2004;
ARGUMENTS arg_settings[] = {{"y", INTEGER,   &year,  "description"}};

int main(int argc, char **argv)
{
    init_arg(argc, argv, arg_settings, TAB_SIZE, ARG_DASH, 0);
    printf("the year is %d\n", year);
    return 0;
}

05. sample with error handling

#include <stdio.h>
#include <stdlib.h>
#include "getargs.h"

int  year  = 2004;
ARGUMENTS arg_settings[] = {{"y", INTEGER,   &year,  "description"}};

int main(int argc, char **argv)
{
    int status;
    init_arg(argc, argv, arg_settings, TAB_SIZE, ARG_DASH, 0);
    if(status != 0)
    {
        printf("ERROR: %s\n", arg_error(status));
        exit(1);
    }
    printf("the year is %d\n", year);
    return 0;
}



******************************************************
FLAG TYPE
******************************************************
currently supported flags
01. BOOLEAN
02. INTEGER
03. CHAR
04. STRING


******************************************************
DASH OR SLASH
******************************************************
init_arg 5th parameter

01. ARG_DASH a dash is used to signify a flag
     sample:
           program -b -size 500 -x string
02. ARG_SLASH a slash is used to signify a flag         
     sample:
           program /b /size 500 /x string


******************************************************
ARG_OPTIONS
******************************************************
    ARG_OPTIONS arg;
    
    arg.option = SHOW_FLAGS;
    status = init_arg(argc, argv, arg_settings, TAB_SIZE, ARG_DASH, &arg);


01. SHOW_FLAGS
    if an error is encountered, a description is displayed.

ARGUMENTS arg_settings[] = {{"y", INTEGER,   &year,  "description"}};
                                                           /
                                                    used by SHOW_FLAGS


02. CHAIN_STR
    this option allows us to process addtional arguments after the flags.


    sample:
       program -size 789 a.txt b.txt c.txt d.bin
                 \     \   \
  integer type flag     \   \
  integer for INTEGER FLAG   \
                       no flag needed a.txt to d.bin. it uses the CHAIN_STR option. it is always at the end. 
                       notice no flags till the end.

TIP: run the complete sample provided, it also uses the special options parameter           
