diff options
-rw-r--r-- | extlibs/arg.c | 60 | ||||
-rw-r--r-- | extlibs/arg.h | 2 |
2 files changed, 56 insertions, 6 deletions
diff --git a/extlibs/arg.c b/extlibs/arg.c index 7a34641..2a35b60 100644 --- a/extlibs/arg.c +++ b/extlibs/arg.c @@ -291,15 +291,65 @@ arg_t* arg_load( int argc, char **argv, def_arg *argl ) i++; } - //printf("arg "); - for (i=1;i<argc;i++) + /*if some arguments wherent used then add default value*/ + i = 0; + while(argl[i].param != NULL) { - if (used[i] == 0) + if (argl[i].used == 0) + { + switch(argl[i].type) + { + case ARGT_IP: + { + //printf("Not yet\n"); + break; + } + case ARGT_RANGE: + { + //printf("Not yet\n"); + break; + } + case ARGT_FLOAT: + { + //printf("Not yet\n"); + break; + } + case ARGT_LIST: + { + //printf("Not yet\n"); + break; + } + case ARGT_FILE: + { + //printf("Not yet\n"); + break; + } + case ARGT_VAL: + { + printf("VAL default\n"); + arg_val *val= __create_arg( argl[i].type, argl[i].def ); + val->ptr = ((s_arg_val *)argl[i].def)->default_ptr; + ((s_arg_val *)argl[i].def)->result = val; + break; + } + case ARGT_FLAG: + { + printf("FLAG default\n"); + arg_flag *flag= __create_arg( argl[i].type, argl[i].def ); + //flag->flag = ((s_arg_flag *)argl[i].def)->flag; + flag->flag = 0; + ((s_arg_flag *)argl[i].def)->result = flag; + break; + } + default: { - //printf("%d ",i); + printf("Unknown type\n"); } + } + } + + i++; } - //printf("\n"); free(used); diff --git a/extlibs/arg.h b/extlibs/arg.h index 98c4681..dc11f47 100644 --- a/extlibs/arg.h +++ b/extlibs/arg.h @@ -200,7 +200,7 @@ typedef struct arg_flag typedef struct s_arg_flag { int used; - int flag; + int flag; //do we need it? arg_flag *result; } s_arg_flag; |