Re: CLIL source code from book "Firmware demystified"
- From: mojaveg@xxxxxxxxxxxxxxxxxx (Everett M. Greene)
- Date: Wed, 29 Jun 2005 10:16:16 PST
"Roman Mashak" <mrv@xxxxxxxx> writes:
> Lanarcam wrote on 29 Jun 2005 02:02:52 -0700:
>
> ??>> parsing it, than calls appropriate function (for example, which shows
> ??>> env. variables: show_env()) and pass 'argc' and 'argv[]' to that
> ??>> function (assuming that in CLI prompt you enter some arguments, like
> ??>> 'show env current'). How is it possible to work?
>
> L> What exactly do you not understand?
> L> - main function getting command line from user?
> L> - parsing it?
> L> - calls appropriate function?
> L> - pass 'argc' and 'argv[]'?
> Main function gets command line (comman and its arguments) from user and
> than pass it to appropriate function handling all functionality. I don't
> understand why is 'argc' and 'argv[]' is passed, because I used to think
> 'argc' and 'argv[]' are valid only with a program running, not function.
You certainly can pass argc and argv to another function.
One of my standard programming techniques is to have a
function such as:
int valid_options(int argc, char *argv[], )
which processes the CLI arguments and places the results
in a location where the rest of the program can use them.
No muss, no fuss.
.
- Follow-Ups:
- Re: CLIL source code from book "Firmware demystified"
- From: Roman Mashak
- Re: CLIL source code from book "Firmware demystified"
- References:
- CLIL source code from book "Firmware demystified"
- From: Roman Mashak
- Re: CLIL source code from book "Firmware demystified"
- From: Lanarcam
- Re: CLIL source code from book "Firmware demystified"
- From: Roman Mashak
- CLIL source code from book "Firmware demystified"
- Prev by Date: Re: Serial ADC Recommendation
- Next by Date: Anyone ever use a Jeteye IR with a PIC?
- Previous by thread: Re: CLIL source code from book "Firmware demystified"
- Next by thread: Re: CLIL source code from book "Firmware demystified"
- Index(es):
Relevant Pages
|