summaryrefslogtreecommitdiff
path: root/src/iversion.cpp
blob: 524f3e2562f3bcc4ee9e57353f323ee93a4eb94f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**************************************************************************\
 ibtk (Insomnia's Basic ToolKit)

  By Insomnia (Steaphan Greene)
  (insomnia@core.binghamton.edu)

  Copyright (C) 1999 Steaphan Greene

  This program 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.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.

\**************************************************************************/
#include <stdio.h>
#include <string.h>
#include "version.h"

/*
 * Return IBTK version in the format "MMmmsspp"
 * MM: major version (two digits)
 * mm: minor version (two digits)
 * ss: sub version (two digits)
 * pp: pre version (two digits)
 */
char *get_ibtk_version(void) {
  static char buf[34];

  sprintf(buf, "%.2d%.2d%.2d%.2d", IBTK_MAJOR_VERSION, IBTK_MINOR_VERSION,
	  IBTK_SUB_VERSION, IBTK_PRE_VERSION);
  return buf;
  }

/*
 * Return the IBTK_VERSION_STRING
 */
char *get_ibtk_version_string(void) {
  static char buf[34];

  sprintf(buf, "%s", IBTK_VERSION_STRING);
  return buf;
  }

/*
 * Return the IBTK_FULL_VERSION_STRING
 */
char *get_ibtk_full_version_string(void) {
  static char buf[34];

  sprintf(buf, "%s", IBTK_FULL_VERSION_STRING);
  return buf;
  }

/*
 * Check if string version to control is
 * less or greater than the current version
 * of IBTK. Return 1 if (to_check>=current), 
 * and 0 if (to_check<current).
 */
int ibtk_required_version(char *checkwith) {

  if(strcmp(get_ibtk_version(), checkwith) >= 0) {
     /* Ok, ibtk version is equal or greater that required */
     return 1;
    } else {
     /* Humm, is less than required */
     return 0;
    }
  }