2014-08-07 |
Merge branch 'for-next/misc'
...
Conflicts:
lib/Makefile
Sascha Hauer
committed
on 7 Aug 2014
|
move file helper functions to separate file
...
We have our file helper functions in several places. Move them
all to lib/libfile.c.
With this we no longer have file helpers in fs/fs.c which contains
the core fs functions and no functions in lib/libbb.c which are
not from busybox.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 7 Aug 2014
|
2014-07-09 |
hush: Fix error code returned value
...
Just returns error code instead of 0 or 1.
With this fix, $? is set to child exit code in all cases.
Without this fix, /child $PATH;echo $? displays 1 even if
child script calls exit with a specific non zero error code.
Signed-off-by: Herve Codina <Herve.CODINA@celad.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Herve Codina
authored
on 7 Jul 2014
Sascha Hauer
committed
on 9 Jul 2014
|
2014-06-04 |
Merge branch 'for-next/misc'
...
Conflicts:
commands/devinfo.c
Sascha Hauer
committed
on 4 Jun 2014
|
2014-05-16 |
hush: setting variables may fail
...
In case of device parameters setting variables may fail. return
the result of set_local_var so that the user has a chance to detect
the failure with $?.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 16 May 2014
|
2014-05-14 |
commands: HUSH_GETOPT -> CMD_GETOPT
...
* this compile option actually turns on a command, so name it
accordingly
* also move the Kconfig definition into commands/Kconfig, thus
placing getopt into the "Shell scripting commands" section
* while at it, improve Kconfig documention
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Holger Schurig
authored
on 13 May 2014
Sascha Hauer
committed
on 14 May 2014
|
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>
Holger Schurig
authored
on 13 May 2014
Sascha Hauer
committed
on 14 May 2014
|
commands: group 'help' output
...
The old output of "help" was just producing a long list, that usually
scrolled of the screen (even on a X11 terminal). This list is more
compact, and also sorted by groups.
The old output format (plus grouping) is now available with 'help -v'.
Example:
Information commands:
?, devinfo, help, iomem, meminfo, version
Boot commands:
boot, bootm, go, loadb, loads, loadx, loady, saves, uimage
...
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Holger Schurig
authored
on 13 May 2014
Sascha Hauer
committed
on 14 May 2014
|
2014-03-28 |
Add shell_expand function
...
shell_expand expands shell variables in a string.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 28 Mar 2014
|
2014-03-07 |
run_command: remove unused flag parameter
...
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 7 Mar 2014
|
2013-11-12 |
hush: refactor reserved_word()
...
Save indentation level for easier readability.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 12 Nov 2013
|
hush: use standard ARRAY_SIZE
...
Use standard ARRAY_SIZE instead of handcrafted NRES.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 12 Nov 2013
|
hush: Be more informative on syntax error
...
Print the token that led to a syntax error, at least for the common
case.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 12 Nov 2013
|
consolidate syntax() and syntax_err()
...
syntax is defined as syntax_err. Drop syntax_err and call syntax instead.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 12 Nov 2013
|
hush: rename __promptme to interrupt
...
the name '__promptme' does not make clear what the variable means. rename
it to 'interrupt' which is set to true when the user has hit ctrl-c.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 12 Nov 2013
|
hush: refactor file_get()
...
Save indentation level by returning early.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 12 Nov 2013
|
hush: refactor get_user_input()
...
Save indentation level by returning early.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 12 Nov 2013
|
hush: refactor readline call
...
Don't call readline in if/else, instead setup a variable and call
it once.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 12 Nov 2013
|
hush: fix exit on syntax error behaviour
...
input.__promptme is no valid indicator that run_shell should be left.
It should be left on executing the 'exit' builtin which is indicated
by a return code < 0 from parse_stream_outer(). Track this with an extra
variable and use it as a condition to return from an interactive shell.
This fixes the weird behaviour that hush exits (and the user finds itself
in the menu) when a syntax error occured.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 12 Nov 2013
|
2013-09-18 |
process_escape_sequence: add support to \$?
...
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Jean-Christophe PLAGNIOL-VILLARD
authored
on 17 Sep 2013
Sascha Hauer
committed
on 18 Sep 2013
|
2013-05-21 |
treewide: Fix typo seperate -> separate
...
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 21 May 2013
|
2013-02-26 |
hush: implement $*
...
To get all arguments a script is called with.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 26 Feb 2013
|
2013-02-11 |
hush: add getopt only if it enabled
...
This patch add getopt to the command list if it enabled via
Kconfig. With this patch we get a 'command not found' error.
Otherwise getopt doing nothing.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Alexander Aring
authored
on 7 Feb 2013
Sascha Hauer
committed
on 11 Feb 2013
|
2013-01-27 |
treewide: fix format specifiers
...
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 27 Jan 2013
|
2012-09-17 |
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>
Sascha Hauer
committed
on 17 Sep 2012
|
2012-08-10 |
hush: catch errors from execute_binfmt
...
execute_binfmt may return negative return values which hush interprets
as 'exit'. Catch this and print an error message instead.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 10 Aug 2012
|
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>
Sascha Hauer
committed
on 10 Aug 2012
|
2012-07-04 |
hush getopt: shift argv arguments
...
Make the nonopt arguments to a script available starting from $1
after running getopt. This allows for scripts which use option
parsing but also have nonopts.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 4 Jul 2012
|
2012-05-23 |
hush: do not convert to return code too early
...
parse_stream_outer used to convert a exit value to a return code,
but parse_stream_outer maybe inside a recursion. This means that
the exit status is lost in this case. Test case:
if [ 0 = 0 ]; then
false
exit $?
fi
echo "shouldn't be here"
Without this patch "shouldn't be here" will be printed.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 23 May 2012
|
2012-05-21 |
run_shell: run again on ctrl-c
...
We can start a new interactive shell now using the 'sh' command on
the command line. This shell exits on ctrl-c though. Add a loop
around it to continue instead of exiting.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 21 May 2012
|