libcfg+ - Viewing Bug Advanced Details [ Go Back ]
88 library core feature always 2003-04-24 16:28 2003-04-25 00:38
rajo  
rajo  
normal  
resolved  
not a bug  
none  
none  
can't mix multiple CFG_LINE_LONG_OPTION_PREFIXes
Considering this part of code:
<pre>
struct cfg_option options[] = {
{ "help", 'h', NULL, CFG_BOOL, (void *) &help, 0 },
CFG_END_OF_LIST
}
cfg_clear_property(con, CFG_LINE_LONG_OPTION_PREFIX);
cfg_add_properties(con, CFG_LINE_LONG_OPTION_PREFIX, "--", "@@", CFG_EOT);
</pre>
In other words:I will support "./program --help" and "./program @@help" in my program. It seems to be impossible use both prefixes at one time.

I will use this behaviour in my program (Monte Carlo simulation of symetric charge-exchange collision -- diploma thesis). I will support:
<pre>
./hotGas N=1e6 lambda=3e-7 time=10.0 help
./hotGas N=1e6 lambda=3e-7 time=10.0 --help
./hotGas help
./hotGas --help
</pre>
Source code of program is attached.
0000088-hotGas.c.txt (22 KB) 1970-01-01 01:33

Bug Notes
rajo   
2003-04-25 00:38   
There was bug only in documentation. And also in compiled program.
The proper usage of libcfg+ is:

struct cfg_option options[] = {
{ "help", 'h', NULL, CFG_BOOL, (void *) &help, 0 },
{ "Nx", 'X', NULL, CFG_LONG, (void *) &Nx, 0 },
CFG_END_OF_LIST
};


/* Creating context */
con = cfg_get_context(options);
if (con == NULL) {
puts("Not enough memory");
return 1;
}
cfg_clear_property(con, CFG_LINE_LONG_OPTION_PREFIX);
cfg_add_properties_type(con, CFG_LINE_LONG_OPTION_PREFIX, "--", "", NULL);
...