i-bash/version.c

95 lines
2.9 KiB
C
Raw Normal View History

1996-08-26 18:22:31 +00:00
/* version.c -- distribution and version numbers. */
/* Copyright (C) 1989-2013 Free Software Foundation, Inc.
1996-08-26 18:22:31 +00:00
This file is part of GNU Bash, the Bourne Again SHell.
2009-01-12 13:36:28 +00:00
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
1996-08-26 18:22:31 +00:00
2009-01-12 13:36:28 +00:00
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
1996-08-26 18:22:31 +00:00
2009-01-12 13:36:28 +00:00
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
1996-08-26 18:22:31 +00:00
2001-11-13 17:56:06 +00:00
#include <config.h>
1996-12-23 17:02:34 +00:00
#include <stdio.h>
2001-11-13 17:56:06 +00:00
#include "stdc.h"
1996-08-26 18:22:31 +00:00
#include "version.h"
2001-11-13 17:56:06 +00:00
#include "patchlevel.h"
#include "conftypes.h"
1996-08-26 18:22:31 +00:00
2004-07-27 13:29:18 +00:00
#include "bashintl.h"
1996-12-23 17:02:34 +00:00
extern char *shell_name;
/* Defines from version.h */
2009-01-12 13:36:28 +00:00
const char * const dist_version = DISTVERSION;
const int patch_level = PATCHLEVEL;
const int build_version = BUILDVERSION;
1996-12-23 17:02:34 +00:00
#ifdef RELSTATUS
2009-01-12 13:36:28 +00:00
const char * const release_status = RELSTATUS;
1996-12-23 17:02:34 +00:00
#else
2009-01-12 13:36:28 +00:00
const char * const release_status = (char *)0;
1996-12-23 17:02:34 +00:00
#endif
2009-01-12 13:36:28 +00:00
const char * const sccs_version = SCCSVERSION;
const char * const bash_copyright = N_("Copyright (C) 2013 Free Software Foundation, Inc.");
2009-01-12 13:36:28 +00:00
const char * const bash_license = N_("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n");
1996-12-23 17:02:34 +00:00
2008-11-18 13:15:12 +00:00
/* If == 31, shell compatible with bash-3.1, == 32 with bash-3.2, and so on */
2009-01-12 13:36:28 +00:00
int shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
2008-11-18 13:15:12 +00:00
1996-12-23 17:02:34 +00:00
/* Functions for getting, setting, and displaying the shell version. */
2004-07-27 13:29:18 +00:00
/* Forward declarations so we don't have to include externs.h */
extern char *shell_version_string __P((void));
extern void show_shell_version __P((int));
1996-12-23 17:02:34 +00:00
/* Give version information about this shell. */
char *
shell_version_string ()
{
static char tt[32] = { '\0' };
if (tt[0] == '\0')
{
if (release_status)
2004-07-27 13:29:18 +00:00
#if defined (HAVE_SNPRINTF)
snprintf (tt, sizeof (tt), "%s.%d(%d)-%s", dist_version, patch_level, build_version, release_status);
#else
1996-12-23 17:02:34 +00:00
sprintf (tt, "%s.%d(%d)-%s", dist_version, patch_level, build_version, release_status);
2004-07-27 13:29:18 +00:00
#endif
1996-12-23 17:02:34 +00:00
else
2004-07-27 13:29:18 +00:00
#if defined (HAVE_SNPRINTF)
snprintf (tt, sizeof (tt), "%s.%d(%d)", dist_version, patch_level, build_version);
#else
1996-12-23 17:02:34 +00:00
sprintf (tt, "%s.%d(%d)", dist_version, patch_level, build_version);
2004-07-27 13:29:18 +00:00
#endif
1996-12-23 17:02:34 +00:00
}
return tt;
}
void
show_shell_version (extended)
int extended;
{
2009-01-12 13:36:28 +00:00
printf (_("GNU bash, version %s (%s)\n"), shell_version_string (), MACHTYPE);
1996-12-23 17:02:34 +00:00
if (extended)
2009-01-12 13:36:28 +00:00
{
printf ("%s\n", _(bash_copyright));
printf ("%s\n", _(bash_license));
printf ("%s\n", _("This is free software; you are free to change and redistribute it."));
printf ("%s\n", _("There is NO WARRANTY, to the extent permitted by law."));
2009-01-12 13:36:28 +00:00
}
1996-12-23 17:02:34 +00:00
}