1 /* version.c --- Version handling.
2  * Copyright (C) 2002-2014 Simon Josefsson
3  *
4  * This file is part of the Generic Security Service (GSS).
5  *
6  * GSS is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * GSS is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with GSS; if not, see http://www.gnu.org/licenses or write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth
19  * Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #include "internal.h"
24 
25 #include <string.h>		/* for strverscmp */
26 
27 /**
28  * gss_check_version:
29  * @req_version: version string to compare with, or NULL
30  *
31  * Check that the version of the library is at minimum the one
32  * given as a string in @req_version.
33  *
34  * WARNING: This function is a GNU GSS specific extension, and is not
35  * part of the official GSS API.
36  *
37  * Return value: The actual version string of the library; NULL if the
38  *   condition is not met.  If NULL is passed to this function no
39  *   check is done and only the version string is returned.
40  **/
41 const char *
gss_check_version(const char * req_version)42 gss_check_version (const char *req_version)
43 {
44   if (!req_version || strverscmp (req_version, PACKAGE_VERSION) <= 0)
45     return PACKAGE_VERSION;
46 
47   return NULL;
48 }
49