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
|
2012-05-03 |
Merge branch 'next'
...
Conflicts:
common/hush.c
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 3 May 2012
|
2012-05-02 |
hush: bail out of scripts on syntax error
...
On a systax error we have to bail out of the shell instead of
setting inp->p to NULL and crash barebox with a NULL pointer
deref. This only happened in scripts.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This fixes the problem I had (i.e. a boot loop caused by a stray fi in
/env/bin/init).
Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sascha Hauer
committed
on 2 May 2012
|
2012-04-30 |
hush: allow to run interactive shell in do_sh
...
This allows to call 'sh' in scripts without arguments in which
case an interactive shell will be started.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 30 Apr 2012
|
hush: Fix globbing
...
hush has a long standing and anoying glob bug. hush expands wildcards
during parsing of the script or command stream. When the command stream
begins to execute the wildcards are already expanded which leads to:
mkdir /tmp
cd /tmp
mkdir foo; ls *
ls: *: No such file or directory
To fix this expand wildcards right before executing the command. Since
'for' loops are not executed in commands, we have to keep the old behaviour
in here so that 'for i in *' still works.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 30 Apr 2012
|
hush: pass GLOB_NOCHECK to glob
...
By doing so glob will not return GLOB_NOMATCH anymore but instead
just does what fake_glob would do.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 30 Apr 2012
|
hush: simplify globhack
...
hush used to escape '*' '[' '?' during parsing because the quotes
got removed in the first parsing loop.
globhack is used to remove these escapes again for glob. Since we now
keep the quotes until the end of parsing and we no longer escape glob
wildcards, we do no longer have to remove any quotes. With this globhack
can be much simpler.
While at it, change the prototype to match the one from glob() and rename
the function to fake_glob, because that's what it is: it just copies the
input string into the output struct without actually globbing.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 30 Apr 2012
|
hush: remove quotes at end of processing
...
hush removes the quotes from strings too early. This leads to some bugs.
When hush executes
echo "hello sascha"
it correctly results in:
argv[0] = "echo"
argv[1] = "hello sascha"
However, the following behaves incorrect:
a="hello sascha"
echo "$a"
results in:
argv[0] = "echo"
argv[1] = "hello"
argv[2] = "sascha"
This is because hush removes the quotes and inserts variable values in a
single loop, so
echo "$a"
becomes:
echo hello sascha
after the loop.
Instead, keep the quotes until all variables are inserted and remove them
at the end.
This also fixes that echo \" resulted in \" instead of ".
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 30 Apr 2012
|
hush: run_pipe_real: bail out early to safe an indention level
...
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 30 Apr 2012
|
hush: run_pipe_real must have num_progs == 1
...
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 30 Apr 2012
|
hush: remove bogus 'else'
...
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 30 Apr 2012
|
hush: cleanup coding style
...
General coding style cleanup
- add some blank lines
- add whitespaces on on both sides of operators
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 30 Apr 2012
|
hush: safe an indention level by continueing a loop
...
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 30 Apr 2012
|
hush: safe indention level by continueing a loop
...
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 30 Apr 2012
|
2012-04-18 |
Introduce binfmt support
...
This will allow to execute any file and detect it's type to handle it.
This will allow to use shell for bootp bootfile or dfu.
You can register multiple hook for the same filetype. They will be execute
in the invert order of register. If a hook does not handle the file you just
return -ERESTARTNOHAND;
This is only available with hush parser.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Jean-Christophe PLAGNIOL-VILLARD
committed
on 18 Apr 2012
|
2012-03-18 |
hush source: expand $PATH
...
The behaviour of other shells suggest that with source or '.'
the path should be resolved using the PATH environment variable. Do
the same in barebox.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 18 Mar 2012
|
2012-02-27 |
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>
Sascha Hauer
committed
on 27 Feb 2012
|
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>
Sascha Hauer
committed
on 27 Feb 2012
|
2011-11-29 |
hush: Add magicvars
...
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 29 Nov 2011
|
2011-04-12 |
move simple_itoa to libbb so that others can use it
...
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 12 Apr 2011
|
2010-10-21 |
hush: sparse fixes
...
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 21 Oct 2010
|