[prev in list] [next in list] [prev in thread] [next in thread]
List: glibc-cvs
Subject: [glibc/release/2.31/master] support/shell-container.c: Add builtin exit
From: Adhemerval Zanella via Glibc-cvs <glibc-cvs () sourceware ! org>
Date: 2020-03-25 13:34:06
Message-ID: 20200325133406.D1589385E016 () sourceware ! org
[Download RAW message or body]
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2448ba1d724bec8cd162084fc51aaecea3929727
commit 2448ba1d724bec8cd162084fc51aaecea3929727
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue Mar 24 15:40:36 2020 -0300
support/shell-container.c: Add builtin exit
Reviewed-by: DJ Delorie <dj@redhat.com>
(cherry picked from commit 5a5a3a3234bc220a5192d620e0cbc5360da46f14)
Diff:
---
support/shell-container.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/support/shell-container.c b/support/shell-container.c
index 0f4568ed0c..6540f8ac47 100644
--- a/support/shell-container.c
+++ b/support/shell-container.c
@@ -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 }
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic