LCOV - code coverage report
Current view: top level - src - m_infos.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 30 30 100.0 %
Date: 2017-02-27 17:05:36 Functions: 6 6 100.0 %

          Line data    Source code
       1             : /*********************************** LICENSE **********************************\
       2             : *                            Copyright 2017 Morphux                            *
       3             : *                                                                              *
       4             : *        Licensed under the Apache License, Version 2.0 (the "License");       *
       5             : *        you may not use this file except in compliance with the License.      *
       6             : *                  You may obtain a copy of the License at                     *
       7             : *                                                                              *
       8             : *                 http://www.apache.org/licenses/LICENSE-2.0                   *
       9             : *                                                                              *
      10             : *      Unless required by applicable law or agreed to in writing, software     *
      11             : *       distributed under the License is distributed on an "AS IS" BASIS,      *
      12             : *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  *
      13             : *        See the License for the specific language governing permissions and   *
      14             : *                       limitations under the License.                         *
      15             : \******************************************************************************/
      16             : 
      17             : #include <m_infos.h>
      18             : 
      19             : 
      20             : /* Globals */
      21             : static char             program[INFOS_G_LEN_MAX] = "";
      22             : static char             version[INFOS_G_LEN_MAX] = "";
      23             : static char             maintainer[INFOS_G_LEN_MAX] = "";
      24             : 
      25             : /*!
      26             :  * Set the program name to a string
      27             :  */
      28           4 : void    set_program_name(const char *str) {
      29           4 :         if (str == NULL) {
      30           1 :                 strcpy(program, "");
      31           3 :         } else if (strlen(str) < INFOS_G_LEN_MAX) {
      32           3 :                 strcpy(program, str);
      33             :         }
      34           4 : }
      35             : 
      36             : /*!
      37             :  * Set the version name to a string
      38             :  */
      39           4 : void    set_version(const char *str) {
      40           4 :         if (str == NULL) {
      41           1 :                 strcpy(version, "");
      42           3 :         } else if (strlen(str) < INFOS_G_LEN_MAX) {
      43           3 :                 strcpy(version, str);
      44             :         }
      45           4 : }
      46             : 
      47             : /*!
      48             :  * Set the maintainer name to a string
      49             :  */
      50           4 : void    set_maintainer(const char *str) {
      51           4 :         if (str == NULL) {
      52           1 :                 strcpy(maintainer, "");
      53           3 :         } else if (strlen(str) < INFOS_G_LEN_MAX) {
      54           3 :                 strcpy(maintainer, str);
      55             :         }
      56           4 : }
      57             : 
      58             : /*!
      59             :  * Get the program name
      60             :  * \note If the program is not set, return NULL
      61             :  */
      62           9 : const char      *get_program_name(void) {
      63           9 :         if (strlen(program) != 0)
      64           4 :                 return program;
      65           5 :         return NULL;
      66             : }
      67             : 
      68             : /*!
      69             :  * Get the version
      70             :  * \note If the version is not set, return NULL
      71             :  */
      72           9 : const char      *get_version(void) {
      73           9 :         if (strlen(version) != 0)
      74           4 :                 return version;
      75           5 :         return NULL;
      76             : }
      77             : 
      78             : /*!
      79             :  * Get the maintainer
      80             :  * \note If the maintainer is not set, return NULL
      81             :  */
      82           9 : const char      *get_maintainer(void) {
      83           9 :         if (strlen(maintainer) != 0)
      84           4 :                 return maintainer;
      85           5 :         return NULL;
      86             : }

Generated by: LCOV version 1.11