summaryrefslogtreecommitdiffstats
path: root/include/command.h
Commit message (Collapse)AuthorAgeFilesLines
* Make sure that argv[] argument pointers are not modified.Wolfgang Denk2010-07-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The hush shell dynamically allocates (and re-allocates) memory for the argument strings in the "char *argv[]" argument vector passed to commands. Any code that modifies these pointers will cause serious corruption of the malloc data structures and crash U-Boot, so make sure the compiler can check that no such modifications are being done by changing the code into "char * const argv[]". This modification is the result of debugging a strange crash caused after adding a new command, which used the following argument processing code which has been working perfectly fine in all Unix systems since version 6 - but not so in U-Boot: int main (int argc, char **argv) { while (--argc > 0 && **++argv == '-') { /* ====> */ while (*++*argv) { switch (**argv) { case 'd': debug++; break; ... default: usage (); } } } ... } The line marked "====>" will corrupt the malloc data structures and usually cause U-Boot to crash when the next command gets executed by the shell. With the modification, the compiler will prevent this with an error: increment of read-only location '*argv' N.B.: The code above can be trivially rewritten like this: while (--argc > 0 && **++argv == '-') { char *arg = *argv; while (*++arg) { switch (*arg) { ... Signed-off-by: Wolfgang Denk <wd@denx.de> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Make "usage" messages more helpful.Wolfgang Denk2009-06-121-1/+1
| | | | | | | | | | | | | | | | | | In case of incorrect command invocations U-Boot used to print pretty useless "usage" messages, for example: => nand markbad Usage: nand - NAND sub-system In the result, the user would have to run the "help" command to get the (available) information about correct command usage. Change this, so that this information gets always printed. Note that this changes the user interface of all commands, but hopefully to the better. Signed-off-by: Wolfgang Denk <wd@denx.de>
* command.c: Expose the core of do_help as _do_help to the rest of u-boot.Detlev Zundel2009-03-271-1/+3
| | | | | | | Other commands implementing subcommands can reuse this code nicely. Signed-off-by: Detlev Zundel <dzu@denx.de> Signed-off-by: Andreas Pfefferle <ap@denx.de>
* Command usage cleanupPeter Tyser2009-01-281-0/+5
| | | | | | | | Remove command name from all command "usage" fields and update common/command.c to display "name - usage" instead of just "usage". Also remove newlines from command usage fields. Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
* Standardize command usage messages with cmd_usage()Peter Tyser2009-01-281-0/+2
| | | | Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
* rename CFG_ macros to CONFIG_SYSJean-Christophe PLAGNIOL-VILLARD2008-10-181-3/+3
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* Expose command table search for sub-commandsKumar Gala2008-10-181-0/+7
| | | | | | | | | Sub-command can benefit from using the same table and search functions that top level commands have. Expose this functionality by refactoring find_cmd() and introducing find_cmd_tbl() that sub-command processing can call. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* move cmd_get_data_size to command.cJean-Christophe PLAGNIOL-VILLARD2008-09-101-0/+9
| | | | | | add CMD_DATA_SIZE macro to enable it Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* Fix merge problemsStefan Roese2008-08-061-0/+2
| | | | Signed-off-by: Stefan Roese <sr@denx.de>
* Big white-space cleanup.Wolfgang Denk2008-05-211-1/+1
| | | | | | | | | | | This commit gets rid of a huge amount of silly white-space issues. Especially, all sequences of SPACEs followed by TAB characters get removed (unless they appear in print statements). Also remove all embedded "vim:" and "vi:" statements which hide indentation problems. Signed-off-by: Wolfgang Denk <wd@denx.de>
* Remove references to the old cmd_confdefs.h include file.Jon Loeliger2007-07-081-6/+0
| | | | Signed-off-by: Jon Loeliger <jdl@freescale.com>
* * Patches by Pantelis Antoniou, 30 Mar 2004:wdenk2004-04-151-0/+9
| | | | | | | | | | - add auto-complete support to the U-Boot CLI - add support for NETTA and NETPHONE boards; fix NETVIA board * Patch by Yuli Barcohen, 28 Mar 2004: - Add support for MPC8272 family including MPC8247/8248/8271/8272 - Add support for MPC8272ADS evaluation board (another flavour of MPC8260ADS) - Change configuration method for MPC8260ADS family
* Patch by Kenneth Johansson, 30 Jun 2003:wdenk2003-07-011-6/+4
| | | | get rid of MK_CMD_ENTRY macro; update doc/README.command
* * Code cleanup:wdenk2003-06-271-9/+19
| | | | | | | | | - remove trailing white space, trailing empty lines, C++ comments, etc. - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c) * Patches by Kenneth Johansson, 25 Jun 2003: - major rework of command structure (work done mostly by Michal Cendrowski and Joakim Kristiansen)
* Initial revisionwdenk2002-08-271-0/+90
OpenPOWER on IntegriCloud