9
0
Fork 0
Commit Graph

62 Commits

Author SHA1 Message Date
Jean-Christophe PLAGNIOL-VILLARD 9f15b42105 command: allow runtime usage
This will allow as example to list the currently supported digest.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-19 07:46:22 +01:00
Holger Schurig f1f532084a commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:

* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
  options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
  is listed by character in this (short) option string (the long
  description is in the long help text, as before)
* help texts have been reworked, to make them
  - sometimes smaller
  - sometimes describe the options better
  - more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
  macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
  all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
  is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
  errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
  compiled long help texts
* 'help -v' gives a list of commands with their short description, this
  is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-14 10:03:43 +02:00
Sascha Hauer 907e3ff3e6 command: return 1 on unknown command
hush now prints the error value if a command returns a value < 0,
so do not return -1 (EPERM) when we encounter an unknown command.
Instead, return 1 so that hush is quiet.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-01 16:31:07 +01:00
Sascha Hauer 77322aa896 Treewide: remove address of the Free Software Foundation
The FSF address has changed in the past. Instead of updating it
each time the address changes, just drop it completely treewide.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-17 10:57:41 +02:00
Sascha Hauer 16edced39e hush: Make exit a shell builtin
'exit' used to do its job by returning value < 0. This is a sign
for hush that 'exit' is executed. This has problems:

- Often commands accidently return a negative value. This causes
  the shell to exit.
- execute_binfmt returns a negative value when it does not find
  a binary to execute. This again causes the shell to exit.
  Returning a negative error value seems to be the right thing
  to do, but catching this in the shell would mean that the exit
  command does not work anymore.
- if called without arguments exit is supposed to return the code
  of the last command. As a command exit has no access to this code.

This patch changes exit to be a builtin and also fixes the last return
code problem. While at it, update the help text.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-08-10 20:59:55 +02:00
Jean-Christophe PLAGNIOL-VILLARD 14c8c60ac6 command: add missing EXPORT_SYMBOL for find_cmd
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-25 09:50:00 +02:00
Sascha Hauer 33d1cc4bf2 commands: remove struct command pointer from commands
This is unused in all commands and thus can be removed.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-02-27 20:28:07 +01:00
Sascha Hauer d59925b8fb command: do not allow abbreviated commands anymore
abbreviated commands are derived from U-Boot and are only
partly useful. Noone expects from a shell to support this,
also we have tab completion. They also have some funny
side effects. For example we have a 'time' command. If this
command is not compiled in, the time command is interpreted
as an abbreviated version of the 'timeout' command. So remove
support for abbreviated commands and safe the binary space.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-02-27 20:08:09 +01:00
Sascha Hauer aed0e6ba03 getopt: save and restore context
execute_command is the single point where commands are executed and thus a new
getopt context is needed. currently we call getopt_reset here to reset the
context. This breaks though when a command tries to run a command itself by
calling execute_command or run_command.  In this case we have to store the
context and restore it afterwards. The same is necessary in builtin_getopt.
Currently noone does this so this one shouldn't fix a bug, but merely allows
us to do such things later.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-02-27 19:53:47 +01:00
Sascha Hauer 3f1ff6b730 move version_string to seperate file
In a noninteractive environment barebox will be compiled without
command support. So move version_string to a seperate file which
is compiled unconditionally.
Also, display the banner when the simple console support is used.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-11 12:36:08 +02:00
Jean-Christophe PLAGNIOL-VILLARD 93bd1526aa move utsrelease.h to include/generated/ instead of include/linux
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-09-17 10:56:24 +08:00
Sascha Hauer 922bb41a47 remove typedef cmd_tbl_t and replace it with struct command
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-02-01 17:25:32 +01:00
Sascha Hauer a3ffa97f40 rename U-Boot-v2 project to barebox
This has been done with the following script:

find -path ./.git -prune -o -type f -print0 | xargs -0 -r sed -i \
	-e 's/u2boot/barebox/g' \
	-e 's/U2Boot/barebox/g' \
	-e 's/U-boot V2/barebox/g' \
	-e 's/u-boot v2/barebox/g' \
	-e 's/U-Boot V2/barebox/g' \
	-e 's/U-Boot-v2/barebox/g' \
	-e 's/U_BOOT/BAREBOX/g' \
	-e 's/UBOOT/BAREBOX/g' \
	-e 's/uboot/barebox/g' \
	-e 's/u-boot/barebox/g' \
	-e 's/u_boot/barebox/g' \
	-e 's/U-Boot/barebox/g' \
	-e 's/U-boot/barebox/g' \
	-e 's/U-BOOT/barebox/g'

find -path ./.git -prune -o \( -name "*u-boot*" -o -name "*uboot*" -o -name "*u_boot*" \) -print0 | \
	xargs -0 -r rename 's/u[-_]?boot/barebox/'

It needs some manual fixup following in the next patch

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-12-15 10:18:30 +01:00
Juergen Beisert b00a6d357e Remove deadlock message
Any wrong or unknown command will result into the output:

 Unknown command '<some text>' - try 'help'

If the command 'help' is disabled, this will end up in:

 Unknown command 'help' - try 'help'

which is for blondes. Suppress the "try 'help'" for the case the 'help'
command is disabled.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-11-19 09:41:44 +01:00
Sascha Hauer 73d57b1d35 list: remove duplicated list.h
We accidently have two list implementations in the tree:
include/list.h and include/linux/list.h. This patch moves
the latter (newer one) to include/linux/list.h.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-11-03 09:48:53 +01:00
Sascha Hauer 420a3173f0 commands: remove maxargs
No need to check for maximum argument counts. The commands are
safe to be called with more arguments, so lets safe some bytes.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-19 16:18:33 +02:00
Sascha Hauer 63e01b4969 call getopt_reset only once
instead of calling getopt_reset in each command,
call it only once before calling the command.

Signed-off-by: Sascha Hauer <sha@pengutronix.de>
2009-10-19 10:18:52 +02:00
Sascha Hauer 0ecf7f1aeb commands: add defines for command errors/success
This allows us to return COMMAND_ERROR_USAGE for
a failed command which will then print the usage,
a very common case for commands.

Signed-off-by: Sascha Hauer <sha@pengutronix.de>
2009-10-19 10:18:52 +02:00
Sascha Hauer ef7ff70ca4 consolidate command calling in execute_command
Signed-off-by: Sascha Hauer <sha@pengutronix.de>
2009-10-19 10:18:51 +02:00
Sascha Hauer 932b57873d move several commands into extra files
move false, true, help, insmod, lsmod, version into extra files

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2008-08-13 16:29:17 +02:00
Sascha Hauer aca52174a9 console: add a simple console for saving space
Add a simple console layer which is not able to handle multiple
consoles for those who don't need it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2008-08-01 11:47:10 +02:00
Sascha Hauer 50cc8c5412 Subject: [PATCH] [general] Fixed constant strings in data section issue
For practical reasons I changed all string literals assumed to be constant
to reside in .rodata subsection at end of .text section.

Signed-off-by: Carsten Schlote <schlote@vahanus.net>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2008-04-04 14:45:04 +02:00
Sascha Hauer df31bb46be implement TAB completion 2008-03-01 21:08:14 +01:00
sascha 8ed683dddb - Insert commands sorted into the command list. This is useful
for commands added via modules.
- Let command aliases show up in help text
2007-10-19 13:06:45 +02:00
sascha 8a46c1102f move readline command to a file of its own 2007-10-19 11:28:58 +02:00
Sascha Hauer 82e54558b2 Collect all commands in a linked list. This makes it easier to handle
dynamically registered commands.
2007-10-11 21:58:51 +02:00
Sascha Hauer 17c3e64578 export functions 2007-10-04 12:37:06 +02:00
Sascha Hauer 1e3465553b Add register_command() to register a command in runtime. This
is only needed when modules are enabled, so the change is inside
"#ifdef CONFIG_MODULE"
2007-10-01 10:15:38 +02:00
Sascha Hauer b3dc734018 declare lots of functions static 2007-09-28 10:07:26 +02:00
Sascha Hauer 3cbc5c5c12 remove u-boot command paramter flag 2007-09-24 12:31:08 +02:00
Sascha Hauer 14b5c2a647 - teach hush to honour PATH variable
- remove common/main.c. This is now handled in the different shells.
2007-09-24 01:40:06 +02:00
Sascha Hauer 0dd68e795e - putc is now putchar for better standard conformity
- make printf return int
2007-09-21 09:09:06 +02:00
Sascha Hauer 89f0c5c94f svn_rev_701
move do_test to own file and reimplement
2007-07-05 18:02:18 +02:00
Sascha Hauer 367ed9fd09 svn_rev_571
add line break to help messages
2007-07-05 18:02:05 +02:00
Sascha Hauer fe2d505d4d svn_rev_481
make more char * const, fix compiler warnings
2007-07-05 18:01:58 +02:00
Sascha Hauer d5a108ece3 svn_rev_462
- Add help texts for many commands.
- Let the linker sort the command table.
- Add support for multiple argmuments in several commands
  (mkdir, rmdir, rm, cat)
2007-07-05 18:01:55 +02:00
Sascha Hauer 58c3774381 svn_rev_459 2007-07-05 18:01:55 +02:00
Sascha Hauer e694adc6a4 svn_rev_420
- do more POSIX:
  - use DIR instead of struct dirent
  - use (struct dirent)->d_name instead of (struct dirent)->name
- switch to a new layout for U_BOOT_CMD:
  - use C99 initializers to be able to add more fields to the
    command struct
  - add aliases for commands (needed mainly for help -> ? and test -> [
  - This is not done for all commands yet, but the compiler will tell you ;)
2007-07-05 18:01:52 +02:00
Sascha Hauer 4c16d48f03 svn_rev_375
add readline, true, false commands
2007-07-05 18:01:48 +02:00
Sascha Hauer 05be7fb930 svn_rev_316
make help command removable
2007-07-05 18:01:43 +02:00
Sascha Hauer a5bf47e33a svn_rev_207
move several config options to kconfig
2007-07-05 18:01:33 +02:00
Sascha Hauer 87ba5dfb46 svn_rev_135
CFG_CMD_ECHO -> CONFIG_CMD_ECHO
2007-07-05 18:01:26 +02:00
Sascha Hauer 162484b83c svn_rev_003
remove all #if 0 and #if 1
2007-07-05 18:01:13 +02:00
Wolfgang Denk 953c5b6f8b Adjust "echo" as a default command
Patch by Sam Song, 19 Jun 2005
2006-03-12 16:51:59 +01:00
wdenk 20787e23b8 * Patches by Robert Whaley, 29 Nov 2004:
- update the pxa-regs.h file for PXA27x chips
  - add PXA27x based ADSVIX board
  - add support for MMC on PXA27x processors

* Patch by Andrew E. Mileski, 28 Nov 2004:
  Fix PPC4xx SPD SDRAM detection bug

* Patch by Hiroshi Ito, 26 Nov 2004:
  Fix logic of "test -z" and "test -n" commands
2005-04-06 00:04:16 +00:00
wdenk 6e5923851e * Cleanup, minor fixes
* Patch by Rune Torgersen, 16 Apr 2004:
  LBA48 fixes

* Patches by Pantelis Antoniou, 16 Apr 2004:
  - Fix some compile problems;
    add "once" functionality for the netretry variable
2004-04-18 17:39:38 +00:00
wdenk c26e454dfc Patches by Pantelis Antoniou, 16 Apr 2004:
- add support for a new version of an Intracom board and fix
  various other things on others.
- add verify support to the crc32 command (define
  CONFIG_CRC32_VERIFY to enable it)
- fix FEC driver for MPC8xx systems:
  1. fix compilation problems for boards that use dynamic
     allocation of DPRAM
  2. shut down FEC after network transfers
- HUSH parser fixes:
  1. A new test command was added. This is a simplified version of
     the one in the bourne shell.
  2. A new exit command was added which terminates the current
     executing script.
  3. Fixed handing of $? (exit code of last executed command)
2004-04-18 10:13:26 +00:00
wdenk 04a85b3b36 * Patches by Pantelis Antoniou, 30 Mar 2004:
- 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
2004-04-15 18:22:41 +00:00
wdenk 0d4983930a Patch by Kenneth Johansson, 30 Jun 2003:
get rid of MK_CMD_ENTRY macro; update doc/README.command
2003-07-01 21:06:45 +00:00
wdenk b0fce99bfc Fix some missing commands, cleanup header files
(autoscript, bmp, bsp, fat, mmc, nand, portio, ...)
2003-06-29 21:03:46 +00:00