libarmutils  1.4
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Groups
armutils_version.c
Go to the documentation of this file.
1 /*******************************************************************************
2 *
3 * COPYRIGHT (C) 2010 Battelle Memorial Institute. All Rights Reserved.
4 *
5 ********************************************************************************
6 *
7 * Author:
8 * name: Brian Ermold
9 * phone: (509) 375-2277
10 * email: brian.ermold@pnl.gov
11 *
12 ********************************************************************************
13 *
14 * REPOSITORY INFORMATION:
15 * $Revision: 75245 $
16 * $Author: ermold $
17 * $Date: 2016-12-06 01:25:47 +0000 (Tue, 06 Dec 2016) $
18 *
19 ********************************************************************************
20 *
21 * NOTE: DOXYGEN is used to generate documentation for this file.
22 *
23 *******************************************************************************/
24 
25 /** @file armutils_version.c
26  * libarmutils library version.
27  */
28 
29 #include "armutils.h"
30 
31 /*******************************************************************************
32  * Private Functions
33  */
34 /** @privatesection */
35 
36 static char *_VersionTag = "$Version: afl-libarmutils-1.13 $";
37 static char _Version[64];
38 
39 /*******************************************************************************
40  * Public Functions
41  */
42 /** @publicsection */
43 
44 /**
45  * libarmutils library version.
46  *
47  * @return libarmutils library version
48  */
49 const char *armutils_lib_version(void)
50 {
51  char *tp = _VersionTag;
52  char *vp = _Version;
53 
54  if (!*vp) {
55 
56  /* find colon */
57 
58  for (; *tp != ':'; tp++)
59  if (*tp == '\0') return((const char *)_Version);
60 
61  /* skip spaces */
62 
63  for (tp++; *tp == ' '; tp++)
64  if (*tp == '\0') return((const char *)_Version);
65 
66  /* extract version from tag */
67 
68  while (*tp != ' ' && *tp != '$' && *tp != '\0')
69  *vp++ = *tp++;
70 
71  *vp = '\0';
72  }
73 
74  return((const char *)_Version);
75 }