rtems: Add rtems_get_copyright_notice()

Update #3973.
This commit is contained in:
Sebastian Huber
2020-05-05 16:11:39 +02:00
parent 63274daf68
commit 1af8e45bb7
6 changed files with 66 additions and 2 deletions

View File

@@ -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

View File

@@ -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.
*/

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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();

View File

@@ -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)