*** empty log message ***

svn path=/trunk/boinc/; revision=3237
This commit is contained in:
David Anderson 2004-04-09 20:39:41 +00:00
parent da1b2ff8aa
commit 48effa3a99
5 changed files with 758 additions and 0 deletions

89
lib/boinc_zip.C Normal file
View File

@ -0,0 +1,89 @@
// this is the "wrapper" file for the zip/unzip functions to expose to BOINC clients
#include "boinc_zip.h"
// send in an input file or path wildcard, output filename, and basic options
#ifndef _MAX_PATH
#define _MAX_PATH 255
#endif
int boinc_zip(int bZip, const char *fileIn, const char *fileOut, const char *options)
{
int carg;
char** av;
int iRet = 0, i = 0;
// if unzipping but no file out, so it just uses cwd, only 3 args
if (bZip == UNZIP_IT && !fileOut)
carg = 3;
else
carg = 4;
// make a dynamic array
av = (char**) calloc(4, sizeof(char*));
for (i=0;i<carg;i++)
av[i] = (char*) calloc(_MAX_PATH,sizeof(char));
// just form an argc/argv to spoof the "main"
// default options are to recurse into directories
if (options && strlen(options))
strcpy(av[1], options);
if (bZip == ZIP_IT)
{
strcpy(av[0], "zip");
// default zip options -- no dir names, no subdirs, highest compression, quiet mode
if (strlen(av[1])==0)
strcpy(av[1], "-j9q");
strcpy(av[2], fileOut);
strcpy(av[3], fileIn);
}
else
{
strcpy(av[0], "unzip");
// default unzip options -- preserve subdirs, overwrite
if (strlen(av[1])==0)
strcpy(av[1], "-o");
strcpy(av[2], fileIn);
// if they passed in a directory unzip there
if (carg == 4)
sprintf(av[3], "-d%s", fileOut);
}
//strcpy(av[carg-1], ""); // null arg
if (bZip == ZIP_IT)
{
if (access(fileOut, 0) == 0)
{ // old zip file exists so unlink (otherwise zip will reuse, doesn't seem to be a flag to
// bypass zip reusing it
unlink(fileOut);
}
iRet = zip_main(carg, av);
}
else
iRet = unzip_main(carg, av);
for (i=0;i<carg;i++)
free(av[i]);
free(av);
return iRet;
}
/*
// this is a test of the boinc_zip/unzip Info-Zip wrapper
int main()
{
// replace with the path/file wildcard of your choice
boinc_zip(ZIP_IT, "e:\\temp\\*.vxd", "e:\\temp\\test.zip", NULL);
//boinc_zip(UNZIP_IT, "e:\\temp\\test.zip", NULL, NULL);
boinc_zip(UNZIP_IT, "e:\\temp\\test.zip", "\\\\snowdon\\Writtable\\", NULL);
return 0;
}
*/

29
lib/boinc_zip.h Normal file
View File

@ -0,0 +1,29 @@
// this is the "wrapper" header file for the zip/unzip functions to expose to BOINC clients
// CMC - 18/03/2004, Oxford University for BOINC project
// released under the BOINC license
// note that I've disabled zip encryption to try and simplify things
// (zip encryption is fairly weak and easy to break anyway)
#include "../unzip/unzip.h"
#include "../zip/zip.h"
// forward declarations for boinc_zip functions
// note it's basically like running zip/unzip, just comprise an argc/argv
// send in an input file or path wildcard, output filename, and basic options
// default options for zip (bZip = true) are "-j9q" which is
// DON'T recurse subdirectories, best compression, quiet operation
// call it with bZip = ZIP to zip, bZip = UNZIP to unzip (duh)
#define ZIP_IT 1
#define UNZIP_IT 0
#ifdef __cplusplus
extern "C" {
#endif
int boinc_zip(int bZip, const char *fileIn, const char *fileOut, const char *options);
#ifdef __cplusplus
}
#endif

View File

@ -29,6 +29,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "upper_case", "upper_case.vc
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boinc_zip", "boinc_zip.vcproj", "{384D8DF2-F221-4810-ACEC-58866E91C629}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
@ -59,6 +63,10 @@ Global
{48FB07D8-6E26-4BB1-98AB-22001C0FB0FF}.Debug.Build.0 = Debug|Win32
{48FB07D8-6E26-4BB1-98AB-22001C0FB0FF}.Release.ActiveCfg = Release|Win32
{48FB07D8-6E26-4BB1-98AB-22001C0FB0FF}.Release.Build.0 = Release|Win32
{384D8DF2-F221-4810-ACEC-58866E91C629}.Debug.ActiveCfg = Debug|Win32
{384D8DF2-F221-4810-ACEC-58866E91C629}.Debug.Build.0 = Debug|Win32
{384D8DF2-F221-4810-ACEC-58866E91C629}.Release.ActiveCfg = Release|Win32
{384D8DF2-F221-4810-ACEC-58866E91C629}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection

307
win_build/boinc_zip.dsp Normal file
View File

@ -0,0 +1,307 @@
# Microsoft Developer Studio Project File - Name="boinc_zip" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=boinc_zip - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "boinc_zip.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "boinc_zip.mak" CFG="boinc_zip - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "boinc_zip - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "boinc_zip - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
F90=df.exe
RSC=rc.exe
!IF "$(CFG)" == "boinc_zip - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE F90 /compile_only /nologo /warn:nofileopt
# ADD F90 /compile_only /nologo /warn:nofileopt
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"boinc_zip.lib"
!ELSEIF "$(CFG)" == "boinc_zip - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE F90 /check:bounds /compile_only /dbglibs /debug:full /nologo /traceback /warn:argument_checking /warn:nofileopt
# ADD F90 /check:bounds /compile_only /dbglibs /debug:full /nologo /traceback /warn:argument_checking /warn:nofileopt
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"boinc_zipd.lib"
!ENDIF
# Begin Target
# Name "boinc_zip - Win32 Release"
# Name "boinc_zip - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;f90;for;f;fpp"
# Begin Source File
SOURCE=.\boinc_zip.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=.\boinc_zip.h
# End Source File
# End Group
# Begin Group "Unzip Header Files"
# PROP Default_Filter "*.h"
# Begin Source File
SOURCE=.\unzip\consts.h
# End Source File
# Begin Source File
SOURCE=.\unzip\ebcdic.h
# End Source File
# Begin Source File
SOURCE=.\unzip\globals.h
# End Source File
# Begin Source File
SOURCE=.\unzip\inflate.h
# End Source File
# Begin Source File
SOURCE=.\unzip\tables.h
# End Source File
# Begin Source File
SOURCE=.\unzip\ttyio.h
# End Source File
# Begin Source File
SOURCE=.\unzip\unzip.h
# End Source File
# Begin Source File
SOURCE=.\unzip\unzpriv.h
# End Source File
# Begin Source File
SOURCE=.\unzip\unzvers.h
# End Source File
# Begin Source File
SOURCE=.\unzip\win32\w32cfg.h
# End Source File
# End Group
# Begin Group "Unzip Source Files"
# PROP Default_Filter "*.c"
# Begin Source File
SOURCE=.\unzip\apihelp.c
# End Source File
# Begin Source File
SOURCE=.\unzip\crc32.c
# End Source File
# Begin Source File
SOURCE=.\unzip\crctab.c
# End Source File
# Begin Source File
SOURCE=.\unzip\envargs.c
# End Source File
# Begin Source File
SOURCE=.\unzip\explode.c
# End Source File
# Begin Source File
SOURCE=.\unzip\extract.c
# End Source File
# Begin Source File
SOURCE=.\unzip\fileio.c
# End Source File
# Begin Source File
SOURCE=.\unzip\globals.c
# End Source File
# Begin Source File
SOURCE=.\unzip\inflate.c
# End Source File
# Begin Source File
SOURCE=.\unzip\list.c
# End Source File
# Begin Source File
SOURCE=.\unzip\match.c
# End Source File
# Begin Source File
SOURCE=.\unzip\process.c
# End Source File
# Begin Source File
SOURCE=.\unzip\ttyio.c
# End Source File
# Begin Source File
SOURCE=.\unzip\unreduce.c
# End Source File
# Begin Source File
SOURCE=.\unzip\unshrink.c
# End Source File
# Begin Source File
SOURCE=.\unzip\unzip.c
# End Source File
# Begin Source File
SOURCE=.\unzip\win32\win32.c
# End Source File
# Begin Source File
SOURCE=.\unzip\zipinfo.c
# End Source File
# End Group
# Begin Group "Zip Header Files"
# PROP Default_Filter "*.c"
# Begin Source File
SOURCE=.\zip\ebcdic.h
# End Source File
# Begin Source File
SOURCE=.\zip\win32\osdep.h
# End Source File
# Begin Source File
SOURCE=.\zip\revision.h
# End Source File
# Begin Source File
SOURCE=.\zip\tailor.h
# End Source File
# Begin Source File
SOURCE=.\zip\z_ttyio.h
# End Source File
# Begin Source File
SOURCE=.\zip\zip.h
# End Source File
# Begin Source File
SOURCE=.\zip\ziperr.h
# End Source File
# End Group
# Begin Group "Zip Source Files"
# PROP Default_Filter "*.c"
# Begin Source File
SOURCE=.\zip\deflate.c
# End Source File
# Begin Source File
SOURCE=.\zip\mktime.c
# End Source File
# Begin Source File
SOURCE=.\zip\trees.c
# End Source File
# Begin Source File
SOURCE=.\zip\util.c
# End Source File
# Begin Source File
SOURCE=.\zip\win32\win32zip.c
# End Source File
# Begin Source File
SOURCE=.\zip\z_fileio.c
# End Source File
# Begin Source File
SOURCE=.\zip\z_globals.c
# End Source File
# Begin Source File
SOURCE=.\zip\win32\z_win32.c
# End Source File
# Begin Source File
SOURCE=.\zip\zip.c
# End Source File
# Begin Source File
SOURCE=.\zip\zipfile.c
# End Source File
# Begin Source File
SOURCE=.\zip\zipup.c
# End Source File
# End Group
# End Target
# End Project

325
win_build/boinc_zip.vcproj Normal file
View File

@ -0,0 +1,325 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="boinc_zip"
ProjectGUID="{384D8DF2-F221-4810-ACEC-58866E91C629}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
PrecompiledHeaderFile=".\Debug/boinc_zip.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="boinc_zipd.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="2057"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\Release/boinc_zip.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="boinc_zip.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="2057"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;f90;for;f;fpp">
<File
RelativePath="..\lib\boinc_zip.C">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;fi;fd">
<File
RelativePath="..\lib\boinc_zip.h">
</File>
</Filter>
<Filter
Name="Unzip Header Files"
Filter="*.h">
<File
RelativePath="..\unzip\consts.h">
</File>
<File
RelativePath="..\unzip\ebcdic.h">
</File>
<File
RelativePath="..\unzip\globals.h">
</File>
<File
RelativePath="..\unzip\inflate.h">
</File>
<File
RelativePath="..\unzip\win32\nt.h">
</File>
<File
RelativePath="..\unzip\tables.h">
</File>
<File
RelativePath="..\unzip\ttyio.h">
</File>
<File
RelativePath="..\unzip\unzip.h">
</File>
<File
RelativePath="..\unzip\unzpriv.h">
</File>
<File
RelativePath="..\unzip\unzvers.h">
</File>
<File
RelativePath="..\unzip\win32\w32cfg.h">
</File>
<File
RelativePath="..\unzip\zip.h">
</File>
</Filter>
<Filter
Name="Unzip Source Files"
Filter="*.c">
<File
RelativePath="..\unzip\apihelp.c">
</File>
<File
RelativePath="..\unzip\crc32.c">
</File>
<File
RelativePath="..\unzip\crctab.c">
</File>
<File
RelativePath="..\unzip\envargs.c">
</File>
<File
RelativePath="..\unzip\explode.c">
</File>
<File
RelativePath="..\unzip\extract.c">
</File>
<File
RelativePath="..\unzip\fileio.c">
</File>
<File
RelativePath="..\unzip\globals.c">
</File>
<File
RelativePath="..\unzip\inflate.c">
</File>
<File
RelativePath="..\unzip\list.c">
</File>
<File
RelativePath="..\unzip\match.c">
</File>
<File
RelativePath="..\unzip\process.c">
</File>
<File
RelativePath="..\unzip\ttyio.c">
</File>
<File
RelativePath="..\unzip\unreduce.c">
</File>
<File
RelativePath="..\unzip\unshrink.c">
</File>
<File
RelativePath="..\unzip\unzip.c">
</File>
<File
RelativePath="..\unzip\zipinfo.c">
</File>
</Filter>
<Filter
Name="Zip Header Files"
Filter="*.c">
<File
RelativePath="..\zip\ebcdic.h">
</File>
<File
RelativePath="..\zip\win32\nt.h">
</File>
<File
RelativePath="..\zip\win32\osdep.h">
</File>
<File
RelativePath="..\zip\revision.h">
</File>
<File
RelativePath="..\zip\tailor.h">
</File>
<File
RelativePath="..\zip\win32\win32zip.h">
</File>
<File
RelativePath="..\zip\z_ttyio.h">
</File>
<File
RelativePath="..\zip\zip.h">
</File>
<File
RelativePath="..\zip\ziperr.h">
</File>
<File
RelativePath="..\zip\win32\zipup.h">
</File>
</Filter>
<Filter
Name="Zip Source Files"
Filter="*.c">
<File
RelativePath="..\zip\deflate.c">
</File>
<File
RelativePath="..\zip\mktime.c">
</File>
<File
RelativePath="..\zip\trees.c">
</File>
<File
RelativePath="..\zip\util.c">
</File>
<File
RelativePath="..\zip\win32zip.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File
RelativePath="..\zip\z_fileio.c">
</File>
<File
RelativePath="..\zip\z_globals.c">
</File>
<File
RelativePath="..\zip\win32\z_win32.c">
</File>
<File
RelativePath="..\zip\z_win32.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File
RelativePath="..\zip\zip.c">
</File>
<File
RelativePath="..\zip\zipfile.c">
</File>
<File
RelativePath="..\zip\zipup.c">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>