Imported from ../bash-2.05b.tar.gz.
[platform/upstream/bash.git] / version.c
1 /* version.c -- distribution and version numbers. */
2
3 /* Copyright (C) 1989 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 it under
8    the terms of the GNU General Public License as published by the Free
9    Software Foundation; either version 2, or (at your option) any later
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
19    Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
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 extern char *shell_name;
32
33 /* Defines from version.h */
34 const char *dist_version = DISTVERSION;
35 int patch_level = PATCHLEVEL;
36 int build_version = BUILDVERSION;
37 #ifdef RELSTATUS
38 const char *release_status = RELSTATUS;
39 #else
40 const char *release_status = (char *)0;
41 #endif
42 const char *sccs_version = SCCSVERSION;
43
44 /* Functions for getting, setting, and displaying the shell version. */
45
46 /* Give version information about this shell. */
47 char *
48 shell_version_string ()
49 {
50   static char tt[32] = { '\0' };
51
52   if (tt[0] == '\0')
53     {
54       if (release_status)
55         sprintf (tt, "%s.%d(%d)-%s", dist_version, patch_level, build_version, release_status);
56       else
57         sprintf (tt, "%s.%d(%d)", dist_version, patch_level, build_version);
58     }
59   return tt;
60 }
61
62 void
63 show_shell_version (extended)
64      int extended;
65 {
66   printf ("GNU bash, version %s (%s)\n", shell_version_string (), MACHTYPE);
67   if (extended)
68     printf ("Copyright (C) 2002 Free Software Foundation, Inc.\n");
69 }