---------------------------------------------------------------------
slimopt
---------------------------------------------------------------------
slimopt is a command line parser.
This function is for the use on the poor environment such as the serial console
on the embedded OS or non-OS.

 * Small code size: It is easy to customize that 160 lines of C code.
 * Reentrant
 * Not supported long options
 
Please refer /test/sample_opt.c
---------------------------------------------------------------------
To use it

1. include slimopt.h in your "console command" source.
2. prepares the needed valiables and defines the options 
   such as the following example:
---------------------------------------------------------------------
#include "slimopt.h"

int main (int argc, char **argv)
{
	int err;   <------- The return value from slimopt()
    int next_arg_idx; <-- Just next non-argument argv[] index will be returned from slimopt()
    enum opt{  <---- Defines the reference index for the options.
        OPT_f = 0,   The order must be same as OPTSPEC table.
        OPT_b,
        OPT_a,
        OPT_d,
        OPT_num,
    };
    void *opt_val[OPT_num]; <-- The option values will be returned from slimopt() 
    static const OPTSPEC opt_tbl[] ={ <-- Defines the each option spec.
        {'f',  OPT_STR, NULL},            /* string defaut is NULL */
        {'b',  OPT_FLG, (void *)0},       /* flag default false */
        {'a',  OPT_STR, (void *)"foo"},   /* string default is "foo" */
        {'d',  OPT_FLG, (void *)0},       /* flag default false */
        {'\0', OPT_FLG, (void *)0},       /* terminater */
    };
    
	err = slimopt(argc, argv, opt_tbl, opt_val, &next_arg_idx);
----------------------------------------------------------------------------
(1) return value "err" from slim_opt() 
     0 OK
    -1 error:no argment
    -2 error:unmathed with the defined options
    -3 error:spec table may be illegal

(2) OPTSPEC table
  You must specify the each option spec.
  #define OPT_FLG   0  // no argument. It means the option is exist or not
  #define OPT_STR   1  // The option has the string argument

  typedef struct opt_spec {
  	  const char  short_name; /* one charactor option -? */
	  const int   type;       /* 0:OPT_FLG, 1:OPT_STR */
	  const void *def_val;    /* default value */
  } OPTSPEC;

(3) how to refer the option values
  slim_opt() returns the option values in void *opt_val[].
  You can refer the value unsing the index OPT_x defined enum value.
  For example:

  /* flag option */
  if((int)opt_val[OPT_b] != 0) {
     /* The option "-b" has been specified */
  }

  /* string option */
  printf("option string -a is %s\n", (char *)opt_val[OPT_a]);


