Re: CLIL source code from book "Firmware demystified"



"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.
.



Relevant Pages

  • Re: CLIL source code from book "Firmware demystified"
    ... ??>> parsing it, than calls appropriate function (for example, which shows ... ??>> 'show env current'). ... L> - main function getting command line from user? ... 'argc' and 'argv' are valid only with a program running, ...
    (comp.arch.embedded)
  • Re: rpmbuild and whitespace in path names
    ... | directory/file name well. ... think about how you enter a command: ... However, things get hinky when adding arguements, or parsing remotely. ... quotations going to end up and what are the parsing rules? ...
    (Fedora)
  • Re: Cant get DOS "for" loop to return full filenames with spaces
    ... I'm trying to set up a DOS batch file to decode all the MP3 ... how to get the "for" command to return anything beyond the first ... Another problem is parsing. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: file Error
    ... I am parsing an xml file,and using raw_input command to ask the ... program in production. ...
    (comp.lang.python)
  • Re: DOS Options
    ... it look like it's back to the drawing board when I get to the ... It never occurred to me that command line parsing ... not meaning to imply that my memory was faultless. ...
    (comp.lang.ada)