New to VxWorks, I have to implement a CLI command, how hard it is?. - VxWorks

This is a discussion on New to VxWorks, I have to implement a CLI command, how hard it is?. - VxWorks ; New to VxWorks, how hard it is to implement a CLI command, (example: set ipaddr 192.168.0.3 netmask 255.255.255.0). Can some expert give me a clue. Thanks in advance....

+ Reply to Thread
Results 1 to 3 of 3

Thread: New to VxWorks, I have to implement a CLI command, how hard it is?.

  1. New to VxWorks, I have to implement a CLI command, how hard it is?.

    New to VxWorks, how hard it is to implement a CLI command, (example:
    set ipaddr 192.168.0.3 netmask 255.255.255.0). Can some expert give me
    a clue. Thanks in advance.


  2. Re: New to VxWorks, I have to implement a CLI command, how hard it is?.

    santa19992000@yahoo.com wrote:

    >New to VxWorks, how hard it is to implement a CLI command, (example:
    >set ipaddr 192.168.0.3 netmask 255.255.255.0). Can some expert give me
    >a clue. Thanks in advance.


    If by "CLI" you mean the host and/or taget shells provided by VxWorks
    then it is very easy. Any symbol known to the shell via the shell's
    symbol table may be used on the shell's command line. This means that
    any such function may be called from the shell by merely typing its
    name. For example, if the function foo(void) has a valid entry in the
    shell's symbol table, that function may be executed from the shell with:

    -> foo

    Function parameters may be provided on the shell command line, too. For
    example, if the function bar(char, int) has a valid entry in the shell's
    symbol table, that function may be executed from the shell with the
    first parameter value of 17 and the second parameter value of 34125 with:

    -> bar 17,34125

    Unspecified parameters are passed with the value zero.

    The shell is, in fact, as C expression interpreter and any valid C
    expression may be used. This allow hexadecimal values to be expressed
    with the leading radix of "0x", the value 17 to be expressed as "39-22",
    etc. Unquoted strings are assumed to symbol table references.

    It is not uncommon to write functions specifically intended to be called
    from the shell and these are often "wrappers" that provide the desired
    interface to existing library functions. In the case of your example,
    your function might parse the passed parameters for the keywords "ipaddr"
    and "netmask", validate the parameters that follow these keywords, and
    call ifAddrAdd().

    See chapter 7, Shell, of the Tornado User's Guide for complete documentation
    of this topic.

    --
    ================================================== ======================
    Michael Kesti | "And like, one and one don't make
    | two, one and one make one."
    mrkesti at comcast dot net | - The Who, Bargain

  3. Re: New to VxWorks, I have to implement a CLI command, how hard it is?.

    writing CLI commands are as simple as writing a small function.. all u
    need to do is

    - write a function which does required job with necessary arguments.
    - load that function in to symbol table. (generally the function will
    be in a file and u can load file.o). As Michael said, it is
    mandatory that u need have this function symbol in symbol table inorder
    to use it from shell.
    - call the function with necessary arguments. ( u can find example from
    Michael's reply :-) )

    Hope this will help u.

    Happy CLI coding :-D

    Vali.


+ Reply to Thread