*PLEASE* keep replies on the mailing lists. Private email is for
contract customers only.
Temp Account wrote:
Hello Gary...
Thanks for the quick reply.
I am creating a new Red_Boot command which should look like this:
create_stuff -a AAA -b BBB -c CCC
where: AAA is the first parameter, BBB second and CCC third.
The point is that -b and -c parameters are not mandatory, I mean, the user may
enter:
create_stuff -a AAA
Currently, if I use the last command I get the error!
This is part of my code:
init_opts(&opts[0], 'a', true, 1, (void **)¶mA, (bool *)&bparamA, "<a> - A
Parameter");
init_opts(&opts[1], 'b', true, 1, (void **)¶mB, (bool *)&bparamB, "<b> - B
Parameter");
init_opts(&opts[2], 'c', true, 1, (void **)¶mC, (bool *)&bparamC, "<c> - C
Parameter");
if (!scan_opts(argcent, argvent, 1, opts, num_opts, (void **)0, 0, ""))
{
(void)diag_printf("ERROR - Invalid option specified\n");
return;
}
Please, let me know if I confused you anymore.
Thanks again.
Douglas
This is very common in RedBoot - look at how the various commands
are implemented (e.g. 'load') which have optional parameters.
In your example, what is 'num_opts' set to? It should be 3.
----- Mensagem original ----
De: Gary Thomas <[EMAIL PROTECTED]>
Para: Temp Account <[EMAIL PROTECTED]>
Cc: [email protected]
Enviadas: Segunda-feira, 27 de Novembro de 2006 10:13:51
Assunto: Re: [ECOS] The init_opts method
Temp Account wrote:
Is it possible to have an optional parameter?
What is the bool takes_arg purpose?
thnks,
Douglas
Perhaps you can explain your questions in more detail?
Give examples of what you'd like explained.
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss