Skip to contentSkip to conversation

Capture of the returned value in cmdline

U-Boot-Users do 2 participants 2 messages Feb 8, 2006 – Feb 9, 2006

lore
Share & tools
lore

do

author
#0 lore raw

Hello,
Is this possible to capture value returned by the function, which implement some command (for example do_printenv),
from commandline in u-boot and for example write it to some shell variable? Is this also possible with standalone programs like examples/hello_world.c?

By the way, what is the usage/application of the flag argument in command function declaration, for example:
int do_printenv(cmd_tbl_t * cmdtp, int flag, int argc, char * argv[]);

Best regards!

#1 lore raw
Quoted 4 lines · In message <[email protected]> you wrote:

Is this possible to capture value returned by the function, which implement some command (for example do_printenv),
from commandline in u-boot and for example write it to some shell variable?

No, but you can evaluate the return code (especially if you enabled the HUSH shell as command line parser).

Quoted 1 line

Is this also possible with standalone programs like examples/hello_world.c?

Same here.

Quoted 3 lines

By the way, what is the usage/application of the flag argument in command function declaration, for example:
int do_printenv(cmd_tbl_t * cmdtp, int flag, int argc, char * argv[]);

See do_run() and run_command() in common/main.c

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Documentation is like sex: when it is good, it is  very,  very  good;
and when it is bad, it is better than nothing.         - Dick Brandon