Git init
[external/libidn.git] / lib / version.c
1 /* version.c --- Version handling.
2  * Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008, 2009  Simon Josefsson
3  *
4  * This file is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This file is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this file; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
17  *
18  */
19
20 #ifdef HAVE_CONFIG_H
21 # include "config.h"
22 #endif
23
24 #include "stringprep.h"
25
26 #include <string.h> /* for strverscmp */
27
28 /**
29  * stringprep_check_version - check for library version
30  * @req_version: Required version number, or NULL.
31  *
32  * Check that the version of the library is at minimum the requested one
33  * and return the version string; return NULL if the condition is not
34  * satisfied.  If a NULL is passed to this function, no check is done,
35  * but the version string is simply returned.
36  *
37  * See %STRINGPREP_VERSION for a suitable @req_version string.
38  *
39  * Return value: Version string of run-time library, or NULL if the
40  * run-time library does not meet the required version number.
41  */
42 const char *
43 stringprep_check_version (const char *req_version)
44 {
45   if (!req_version || strverscmp (req_version, STRINGPREP_VERSION) <= 0)
46     return STRINGPREP_VERSION;
47
48   return NULL;
49 }