1 /* $Id$
2 * Provides function to check huskylib version.
3 * Written at 2002 by Stas Degteff 2:5080/102
4 *
5 * HUSKYLIB: common defines, types and functions for HUSKY
6 *
7 * This is part of The HUSKY Fidonet Software project:
8 * see http://husky.sourceforge.net for details
9 *
10 *
11 * HUSKYLIB is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
15 *
16 * HUSKYLIB is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; see file COPYING. If not, write to the
23 * Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 * See also http://www.gnu.org, license may be found here.
26 */
27
28 #include <string.h>
29 #include "compiler.h"
30
31 /* export functions from DLL */
32 #define DLLEXPORT
33 #include "huskylib.h"
34
35
36 /* Check version of huskylib library
37 * return zero if test failed; non-zero if passed
38 * test cvs need for DLL version only, using #include <fidoconf/cvsdate.h>
39 */
CheckHuskylibVersion(int need_major,int need_minor,int need_patch,branch_t need_branch,const char * cvs)40 int CheckHuskylibVersion( int need_major, int need_minor,
41 int need_patch, branch_t need_branch, const char *cvs )
42 { /* We don't need check pathlevel: see huskybse/develop-docs/ */
43
44 static
45 #include "../cvsdate.h" /* char cvs_date[]=datestring; */
46
47 if( need_major==HUSKYLIB_VER_MAJOR && need_minor==HUSKYLIB_VER_MINOR ) {
48 if(need_branch==BRANCH_CURRENT) {
49 if(need_patch) fprintf(stderr, "Huskylib: strange, current patch level can't be non-zero\n");
50 return (HUSKYLIB_VER_BRANCH==BRANCH_CURRENT) && !(cvs && strcmp(cvs,cvs_date));
51 }
52 else return HUSKYLIB_VER_BRANCH!=BRANCH_CURRENT;
53 }
54 return 0;
55 }
56