[rtems commit] rtems: Add rtems_get_copyright_notice()
Sebastian Huber
sebh at rtems.org
Wed May 6 06:02:29 UTC 2020
Module: rtems
Branch: master
Commit: 1af8e45bb7149f72b932a4453dc1a699477ff00f
Changeset: http://git.rtems.org/rtems/commit/?id=1af8e45bb7149f72b932a4453dc1a699477ff00f
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue May 5 16:11:39 2020 +0200
rtems: Add rtems_get_copyright_notice()
Update #3973.
---
cpukit/Makefile.am | 1 +
cpukit/include/rtems.h | 5 ++++
cpukit/libmisc/shell/shell.c | 14 +++++++++--
cpukit/sapi/src/getcopyrightnotice.c | 46 ++++++++++++++++++++++++++++++++++++
testsuites/sptests/sp43/init.c | 1 +
testsuites/sptests/sp43/sp43.scn | 1 +
6 files changed, 66 insertions(+), 2 deletions(-)
diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 3af69bd..51f38c8 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -1051,6 +1051,7 @@ librtemscpu_a_SOURCES += sapi/src/extensionident.c
librtemscpu_a_SOURCES += sapi/src/fatal.c
librtemscpu_a_SOURCES += sapi/src/fatalsrctext.c
librtemscpu_a_SOURCES += sapi/src/getconfigmax.c
+librtemscpu_a_SOURCES += sapi/src/getcopyrightnotice.c
librtemscpu_a_SOURCES += sapi/src/getversionstring.c
librtemscpu_a_SOURCES += sapi/src/interrtext.c
librtemscpu_a_SOURCES += sapi/src/io.c
diff --git a/cpukit/include/rtems.h b/cpukit/include/rtems.h
index 9f6f9cc..1b91965 100644
--- a/cpukit/include/rtems.h
+++ b/cpukit/include/rtems.h
@@ -64,6 +64,11 @@ extern "C" {
#endif
/**
+ * @brief Returns the pointer to the RTEMS copyright notice.
+ */
+const char *rtems_get_copyright_notice(void);
+
+/**
* @brief Returns the pointer to the RTEMS version string.
*/
const char *rtems_get_version_string(void);
diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
index 79c1afc..0b06e8b 100644
--- a/cpukit/libmisc/shell/shell.c
+++ b/cpukit/libmisc/shell/shell.c
@@ -683,7 +683,12 @@ static bool rtems_shell_login(rtems_shell_env_t *env, FILE * in,FILE * out)
fprintf(out,"RTEMS");
break;
case 'V':
- fprintf(out,"%s\n%s",rtems_get_version_string(), _Copyright_Notice);
+ fprintf(
+ out,
+ "%s\n%s",
+ rtems_get_version_string(),
+ rtems_get_copyright_notice()
+ );
break;
case '@':
fprintf(out,"@");
@@ -738,7 +743,12 @@ static bool rtems_shell_login(rtems_shell_env_t *env, FILE * in,FILE * out)
fprintf(out,rtems_get_version_string());
break;
case 'v':
- fprintf(out,"%s\n%s",rtems_get_version_string(),_Copyright_Notice);
+ fprintf(
+ out,
+ "%s\n%s",
+ rtems_get_version_string(),
+ rtems_get_copyright_notice()
+ );
break;
case '%':fprintf(out,"%%");
break;
diff --git a/cpukit/sapi/src/getcopyrightnotice.c b/cpukit/sapi/src/getcopyrightnotice.c
new file mode 100644
index 0000000..515d525
--- /dev/null
+++ b/cpukit/sapi/src/getcopyrightnotice.c
@@ -0,0 +1,46 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSAPIClassic
+ *
+ * @brief rtems_get_copyright_notice() Implementation
+ */
+
+/*
+ * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems.h>
+#include <rtems/score/copyrt.h>
+
+const char *rtems_get_copyright_notice( void )
+{
+ return _Copyright_Notice;
+}
diff --git a/testsuites/sptests/sp43/init.c b/testsuites/sptests/sp43/init.c
index b57c158..57f883d 100644
--- a/testsuites/sptests/sp43/init.c
+++ b/testsuites/sptests/sp43/init.c
@@ -131,6 +131,7 @@ rtems_task Init(
TEST_BEGIN();
printf( "RTEMS Version: %s\n", rtems_get_version_string() );
+ printf( "RTEMS Copyright Notice: %s\n", rtems_get_copyright_notice() );
main_task = rtems_task_self();
diff --git a/testsuites/sptests/sp43/sp43.scn b/testsuites/sptests/sp43/sp43.scn
index 04af7f9..c71f087 100644
--- a/testsuites/sptests/sp43/sp43.scn
+++ b/testsuites/sptests/sp43/sp43.scn
@@ -1,5 +1,6 @@
*** BEGIN OF TEST SP 43 ***
RTEMS Version: rtems-5.0.0 (SPARC/w/FPU/erc32)
+RTEMS Copyright Notice: Copyright (C) 1989, 2020 RTEMS Project and contributors
rtems_object_get_classic_name - INVALID_ADDRESS
rtems_object_get_classic_name - INVALID_ID (bad index)
rtems_object_get_classic_name - INVALID_ID (unallocated index)
More information about the vc
mailing list