This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Res: Res: The init_opts method


It helped me a lot and yes, it is 3.
Thanks Gary!


----- Mensagem original ----
De: Gary Thomas <gary@mlbassoc.com>
Para: Temp Account <dlpguard2000-spam@yahoo.com.br>
Cc: eCos Discussion <ecos-discuss@ecos.sourceware.org>
Enviadas: Segunda-feira, 27 de Novembro de 2006 13:08:22
Assunto: Re: Res: [ECOS] The init_opts method


*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 **)&paramA, (bool *)&bparamA, "<a> - A Parameter");
> init_opts(&opts[1], 'b', true, 1, (void **)&paramB, (bool *)&bparamB, "<b> - B Parameter");
> init_opts(&opts[2], 'c', true, 1, (void **)&paramC, (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 <gary@mlbassoc.com>
> Para: Temp Account <dlpguard2000-spam@yahoo.com.br>
> Cc: ecos-discuss@ecos.sourceware.org
> 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
------------------------------------------------------------


		
_______________________________________________________ 
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale 
o discador agora! 
http://br.acesso.yahoo.com

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]