From 1af8e45bb7149f72b932a4453dc1a699477ff00f Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 5 May 2020 16:11:39 +0200 Subject: 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(-) create mode 100644 cpukit/sapi/src/getcopyrightnotice.c diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am index 3af69bd615..51f38c84c7 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 9f6f9cc659..1b91965563 100644 --- a/cpukit/include/rtems.h +++ b/cpukit/include/rtems.h @@ -63,6 +63,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. */ diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c index 79c1afcb5a..0b06e8b4d1 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 0000000000..515d5258c2 --- /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 +#include + +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 b57c158173..57f883daf0 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 04af7f9596..c71f087f96 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) -- cgit v1.2.3