| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/bash/src/version.c |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | /* version.c -- distribution and version numbers. */ | - | ||||||
| 2 | - | |||||||
| 3 | /* Copyright (C) 1989-2016 Free Software Foundation, Inc. | - | ||||||
| 4 | - | |||||||
| 5 | This file is part of GNU Bash, the Bourne Again SHell. | - | ||||||
| 6 | - | |||||||
| 7 | Bash is free software: you can redistribute it and/or modify | - | ||||||
| 8 | it under the terms of the GNU General Public License as published by | - | ||||||
| 9 | the Free Software Foundation, either version 3 of the License, or | - | ||||||
| 10 | (at your option) any later version. | - | ||||||
| 11 | - | |||||||
| 12 | Bash is distributed in the hope that it will be useful, | - | ||||||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | - | ||||||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | - | ||||||
| 15 | GNU General Public License for more details. | - | ||||||
| 16 | - | |||||||
| 17 | You should have received a copy of the GNU General Public License | - | ||||||
| 18 | along with Bash. If not, see <http://www.gnu.org/licenses/>. | - | ||||||
| 19 | */ | - | ||||||
| 20 | - | |||||||
| 21 | #include <config.h> | - | ||||||
| 22 | - | |||||||
| 23 | #include <stdio.h> | - | ||||||
| 24 | - | |||||||
| 25 | #include "stdc.h" | - | ||||||
| 26 | - | |||||||
| 27 | #include "version.h" | - | ||||||
| 28 | #include "patchlevel.h" | - | ||||||
| 29 | #include "conftypes.h" | - | ||||||
| 30 | - | |||||||
| 31 | #include "bashintl.h" | - | ||||||
| 32 | - | |||||||
| 33 | extern char *shell_name; | - | ||||||
| 34 | - | |||||||
| 35 | /* Defines from version.h */ | - | ||||||
| 36 | const char * const dist_version = DISTVERSION; | - | ||||||
| 37 | const int patch_level = PATCHLEVEL; | - | ||||||
| 38 | const int build_version = BUILDVERSION; | - | ||||||
| 39 | #ifdef RELSTATUS | - | ||||||
| 40 | const char * const release_status = RELSTATUS; | - | ||||||
| 41 | #else | - | ||||||
| 42 | const char * const release_status = (char *)0; | - | ||||||
| 43 | #endif | - | ||||||
| 44 | const char * const sccs_version = SCCSVERSION; | - | ||||||
| 45 | - | |||||||
| 46 | const char * const bash_copyright = N_("Copyright (C) 2016 Free Software Foundation, Inc."); | - | ||||||
| 47 | const char * const bash_license = N_("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n"); | - | ||||||
| 48 | - | |||||||
| 49 | /* If == 31, shell compatible with bash-3.1, == 32 with bash-3.2, and so on */ | - | ||||||
| 50 | int shell_compatibility_level = DEFAULT_COMPAT_LEVEL; | - | ||||||
| 51 | - | |||||||
| 52 | /* Functions for getting, setting, and displaying the shell version. */ | - | ||||||
| 53 | - | |||||||
| 54 | /* Forward declarations so we don't have to include externs.h */ | - | ||||||
| 55 | extern char *shell_version_string __P((void)); | - | ||||||
| 56 | extern void show_shell_version __P((int)); | - | ||||||
| 57 | - | |||||||
| 58 | /* Give version information about this shell. */ | - | ||||||
| 59 | char * | - | ||||||
| 60 | shell_version_string () | - | ||||||
| 61 | { | - | ||||||
| 62 | static char tt[32] = { '\0' }; | - | ||||||
| 63 | - | |||||||
| 64 | if (tt[0] == '\0')
| 16-5432 | ||||||
| 65 | { | - | ||||||
| 66 | if (release_status)
| 0-5432 | ||||||
| 67 | #if HAVE_SNPRINTF | - | ||||||
| 68 | snprintf (tt, sizeof (tt), "%s.%d(%d)-%s", dist_version, patch_level, build_version, release_status); executed 5432 times by 1 test: snprintf (tt, sizeof (tt), "%s.%d(%d)-%s", dist_version, patch_level, build_version, release_status);Executed by:
| 5432 | ||||||
| 69 | #else | - | ||||||
| 70 | sprintf (tt, "%s.%d(%d)-%s", dist_version, patch_level, build_version, release_status); | - | ||||||
| 71 | #endif | - | ||||||
| 72 | else | - | ||||||
| 73 | #if HAVE_SNPRINTF | - | ||||||
| 74 | snprintf (tt, sizeof (tt), "%s.%d(%d)", dist_version, patch_level, build_version); never executed: snprintf (tt, sizeof (tt), "%s.%d(%d)", dist_version, patch_level, build_version); | 0 | ||||||
| 75 | #else | - | ||||||
| 76 | sprintf (tt, "%s.%d(%d)", dist_version, patch_level, build_version); | - | ||||||
| 77 | #endif | - | ||||||
| 78 | } | - | ||||||
| 79 | return tt; executed 5448 times by 1 test: return tt;Executed by:
| 5448 | ||||||
| 80 | } | - | ||||||
| 81 | - | |||||||
| 82 | void | - | ||||||
| 83 | show_shell_version (extended) | - | ||||||
| 84 | int extended; | - | ||||||
| 85 | { | - | ||||||
| 86 | printf (_("GNU bash, version %s (%s)\n"), shell_version_string (), MACHTYPE); | - | ||||||
| 87 | if (extended)
| 0-1 | ||||||
| 88 | { | - | ||||||
| 89 | printf ("%s\n", _(bash_copyright)); | - | ||||||
| 90 | printf ("%s\n", _(bash_license)); | - | ||||||
| 91 | printf ("%s\n", _("This is free software; you are free to change and redistribute it.")); | - | ||||||
| 92 | printf ("%s\n", _("There is NO WARRANTY, to the extent permitted by law.")); | - | ||||||
| 93 | } never executed: end of block | 0 | ||||||
| 94 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||
| Source code | Switch to Preprocessed file |