1 /* $Id$ */
2 /******************************************************************************
3  * HTPZIP --- library for zipinternal packer/unpacker
4  ******************************************************************************
5  * Copyright (C) 1998-2002
6  *
7  * Husky Delopment Team
8  *
9  * Internet: http://husky.sourceforge.net
10  *
11  * This file is part of HPTZIP.
12  *
13  * This library is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU Library/Lesser General Public
15  * License as published by the Free Software Foundation; either
16  * version 2 of the License, or (at your option) any later version.
17  *
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21  * Library General Public License for more details.
22  *
23  * You should have received a copy of the GNU Library General Public
24  * License along with this library; see file COPYING. If not, write to the Free
25  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26  *
27  * See also http://www.gnu.org
28  *****************************************************************************
29  */
30 #include <string.h>
31 #include <huskylib/huskylib.h>
32 
33 /* export functions from DLL */
34 #define DLLEXPORT
35 #include <huskylib/huskyext.h>
36 
37 #include "common.h"
38 
39 #define __VERSION__C__
40 
41 #include "version.h"
42 
43 /* Check version of fidoconfig library
44  * return zero if test failed; non-zero if passed
45  * test cvs need for DLL version only, using #include <fidoconf/cvsdate.h>
46  */
CheckHptzipVersion(int need_major,int need_minor,int need_patch,branch_t need_branch,const char * cvs)47 HUSKYEXT int CheckHptzipVersion( int need_major, int need_minor,
48                       int need_patch, branch_t need_branch, const char *cvs )
49 { /* We don't need check pathlevel: see huskybse/develop-docs/ */
50 
51 static
52 #include "../cvsdate.h"   /* char cvs_date[]=datestring; */
53 
54   if( need_major==HZ_VER_MAJOR && need_minor==HZ_VER_MINOR ) {
55     if(need_branch==BRANCH_CURRENT) {
56       if(need_patch) fprintf(stderr, "HPTzip: strange, current patch level can't be non-zero\n");
57       return (HZ_VER_BRANCH==BRANCH_CURRENT) && !(cvs && strcmp(cvs,cvs_date));
58     }
59     else return HZ_VER_BRANCH!=BRANCH_CURRENT;
60   }
61   return 0;
62 }
63 
64 
65 #ifdef TEST_VERSION_C
66 
67 #include <stdio.h>
68 #include <stdlib.h>
69 #include "../cvsdate.h"
70 
main()71 int main(){
72   char *versionStr;
73 
74   versionStr = GenVersionStr( "hptzip", 1, 3, 0, BRANCH_RELEASE, cvs_date);
75   printf( "RELEASE: %s\n\n", versionStr );
76   nfree(versionStr);
77 
78   versionStr = GenVersionStr( "hptzip", 1, 2, 1, BRANCH_RELEASE, cvs_date);
79   printf( "RELEASE: %s\n\n", versionStr );
80   nfree(versionStr);
81 
82   versionStr = GenVersionStr( "hptzip", 1, 2, 6, BRANCH_CURRENT, cvs_date);
83   printf( "CURRENT: %s\n\n", versionStr );
84   nfree(versionStr);
85 
86   versionStr = GenVersionStr( "hptzip", 1, 3, 0, BRANCH_CURRENT, cvs_date);
87   printf( "CURRENT: %s\n\n", versionStr );
88   nfree(versionStr);
89 
90   versionStr = GenVersionStr( "hptzip", 1, 3, 4, BRANCH_STABLE, cvs_date);
91   printf( "STABLE: %s\n\n", versionStr );
92   nfree(versionStr);
93 
94   versionStr = GenVersionStr( "hptzip", 1, 4, 0, BRANCH_STABLE, cvs_date);
95   printf( "STABLE: %s\n\n", versionStr );
96   nfree(versionStr);
97 
98   versionStr = GenVersionStr( "hptzip", 1, 9, 0, BRANCH_CURRENT, cvs_date);
99   printf( "CURRENT: %s\n\n", versionStr );
100   nfree(versionStr);
101 
102   return 0;
103 }
104 #endif
105