summaryrefslogtreecommitdiff
path: root/extlibs/arg.c
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2017-06-07 00:24:14 +0100
committerFreeArtMan <dos21h@gmail.com>2017-06-07 00:24:14 +0100
commit07f86a3d78720f616c5417da8b937e0d7691072d (patch)
tree2a5babb26877cee22cd9e30381abb0e58782d237 /extlibs/arg.c
parent7cacc613a897b65114eea4dd379d07273938ecef (diff)
downloadagni-07f86a3d78720f616c5417da8b937e0d7691072d.tar.gz
agni-07f86a3d78720f616c5417da8b937e0d7691072d.zip
Updated libarg
Diffstat (limited to 'extlibs/arg.c')
-rw-r--r--extlibs/arg.c60
1 files changed, 55 insertions, 5 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);