]>
Commit | Line | Data |
---|---|---|
726f6388 JA |
1 | /* version.c -- distribution and version numbers. */ |
2 | ||
95732b49 | 3 | /* Copyright (C) 1989-2005 Free Software Foundation, Inc. |
726f6388 JA |
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 it under | |
8 | the terms of the GNU General Public License as published by the Free | |
bb70624e | 9 | Software Foundation; either version 2, or (at your option) any later |
726f6388 JA |
10 | version. |
11 | ||
12 | Bash is distributed in the hope that it will be useful, but WITHOUT ANY | |
13 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 | for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License along | |
18 | with Bash; see the file COPYING. If not, write to the Free Software | |
bb70624e | 19 | Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ |
726f6388 | 20 | |
f73dda09 JA |
21 | #include <config.h> |
22 | ||
ccc6cda3 JA |
23 | #include <stdio.h> |
24 | ||
f73dda09 JA |
25 | #include "stdc.h" |
26 | ||
726f6388 | 27 | #include "version.h" |
f73dda09 JA |
28 | #include "patchlevel.h" |
29 | #include "conftypes.h" | |
726f6388 | 30 | |
b80f6443 JA |
31 | #include "bashintl.h" |
32 | ||
ccc6cda3 JA |
33 | extern char *shell_name; |
34 | ||
35 | /* Defines from version.h */ | |
f73dda09 | 36 | const char *dist_version = DISTVERSION; |
726f6388 JA |
37 | int patch_level = PATCHLEVEL; |
38 | int build_version = BUILDVERSION; | |
ccc6cda3 | 39 | #ifdef RELSTATUS |
f73dda09 | 40 | const char *release_status = RELSTATUS; |
ccc6cda3 | 41 | #else |
f73dda09 | 42 | const char *release_status = (char *)0; |
ccc6cda3 | 43 | #endif |
f73dda09 | 44 | const char *sccs_version = SCCSVERSION; |
ccc6cda3 | 45 | |
f1be666c JA |
46 | /* If == 31, shell compatible with bash-3.1, == 32 with bash-3.2, and so on */ |
47 | int shell_compatibility_level = 32; | |
48 | ||
ccc6cda3 JA |
49 | /* Functions for getting, setting, and displaying the shell version. */ |
50 | ||
b80f6443 JA |
51 | /* Forward declarations so we don't have to include externs.h */ |
52 | extern char *shell_version_string __P((void)); | |
53 | extern void show_shell_version __P((int)); | |
54 | ||
ccc6cda3 JA |
55 | /* Give version information about this shell. */ |
56 | char * | |
57 | shell_version_string () | |
58 | { | |
59 | static char tt[32] = { '\0' }; | |
60 | ||
61 | if (tt[0] == '\0') | |
62 | { | |
63 | if (release_status) | |
b80f6443 JA |
64 | #if defined (HAVE_SNPRINTF) |
65 | snprintf (tt, sizeof (tt), "%s.%d(%d)-%s", dist_version, patch_level, build_version, release_status); | |
66 | #else | |
ccc6cda3 | 67 | sprintf (tt, "%s.%d(%d)-%s", dist_version, patch_level, build_version, release_status); |
b80f6443 | 68 | #endif |
ccc6cda3 | 69 | else |
b80f6443 JA |
70 | #if defined (HAVE_SNPRINTF) |
71 | snprintf (tt, sizeof (tt), "%s.%d(%d)", dist_version, patch_level, build_version); | |
72 | #else | |
ccc6cda3 | 73 | sprintf (tt, "%s.%d(%d)", dist_version, patch_level, build_version); |
b80f6443 | 74 | #endif |
ccc6cda3 JA |
75 | } |
76 | return tt; | |
77 | } | |
78 | ||
ccc6cda3 JA |
79 | void |
80 | show_shell_version (extended) | |
81 | int extended; | |
82 | { | |
83 | printf ("GNU bash, version %s (%s)\n", shell_version_string (), MACHTYPE); | |
84 | if (extended) | |
f1be666c | 85 | printf (_("Copyright (C) 2007 Free Software Foundation, Inc.\n")); |
ccc6cda3 | 86 | } |