mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-15 01:21:06 +00:00
support/shell-container.c: Add builtin exit
Reviewed-by: DJ Delorie <dj@redhat.com>
(cherry picked from commit 5a5a3a3234
)
This commit is contained in:
parent
55e77b7d81
commit
946ee0281a
@ -135,6 +135,18 @@ copy_func (char **argv)
|
||||
|
||||
}
|
||||
|
||||
/* Emulate the 'exit' builtin. The exit value is optional. */
|
||||
static int
|
||||
exit_func (char **argv)
|
||||
{
|
||||
int exit_val = 0;
|
||||
|
||||
if (argv[0] != 0)
|
||||
exit_val = atoi (argv[0]) & 0xff;
|
||||
exit (exit_val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This is a list of all the built-in commands we understand. */
|
||||
static struct {
|
||||
const char *name;
|
||||
@ -143,6 +155,7 @@ static struct {
|
||||
{ "true", true_func },
|
||||
{ "echo", echo_func },
|
||||
{ "cp", copy_func },
|
||||
{ "exit", exit_func },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user