[PATCH 2/4] support/shell-container.c: Add builtin exit
Adhemerval Zanella
adhemerval.zanella@linaro.org
Tue Mar 24 19:42:27 GMT 2020
On 24/03/2020 16:31, DJ Delorie wrote:
> Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org> writes:
>> +/* Emulate the "/bin/exit" command. The exit value is optional. */
>
> There's no /bin/exit - it's a builtin
Indeed, I will fix the title.
>
>> +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 }
>> };
>
> LGTM otherwise
>
> Reviewed-by: DJ Delorie <dj@redhat.com>
>
More information about the Libc-alpha
mailing list