Imported from ../bash-2.0.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 1, 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
20
21 #include <stdio.h>
22
23 #include "version.h"
24
25 extern char *shell_name;
26
27 /* Defines from version.h */
28 char *dist_version = DISTVERSION;
29 int patch_level = PATCHLEVEL;
30 int build_version = BUILDVERSION;
31 #ifdef RELSTATUS
32 char *release_status = RELSTATUS;
33 #else
34 char *release_status = (char *)0;
35 #endif
36 char *sccs_version = SCCSVERSION;
37
38 /* Functions for getting, setting, and displaying the shell version. */
39
40 /* Give version information about this shell. */
41 char *
42 shell_version_string ()
43 {
44   static char tt[32] = { '\0' };
45
46   if (tt[0] == '\0')
47     {
48       if (release_status)
49         sprintf (tt, "%s.%d(%d)-%s", dist_version, patch_level, build_version, release_status);
50       else
51         sprintf (tt, "%s.%d(%d)", dist_version, patch_level, build_version);
52     }
53   return tt;
54 }
55
56 #if !defined (MACHTYPE)
57 #  define MACHTYPE "unknown"
58 #endif
59
60 void
61 show_shell_version (extended)
62      int extended;
63 {
64   printf ("GNU bash, version %s (%s)\n", shell_version_string (), MACHTYPE);
65   if (extended)
66     printf ("Copyright 1996 Free Software Foundation, Inc.\n");
67 }