This commit is contained in:
King_DuckZ 2020-05-05 20:22:42 +02:00
parent 0433a6bc0a
commit e5cd2e91e8
22 changed files with 5633 additions and 5315 deletions

View file

@ -1,6 +1,6 @@
CPP = g++
CC = gcc
OBJ = main.o UnAlz.o UnAlzBz2decompress.o UnAlzBzip2.o UnAlzbzlib.o zlib/adler32.o zlib/crc32.o zlib/infback.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/zutil.o bzip2/blocksort.o bzip2/compress.o bzip2/crctable.o bzip2/huffman.o bzip2/randtable.o
OBJ = main.o UnAlz.o UnAlzUtils.o UnAlzBz2decompress.o UnAlzBzip2.o UnAlzbzlib.o zlib/adler32.o zlib/crc32.o zlib/infback.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/zutil.o bzip2/blocksort.o bzip2/compress.o bzip2/crctable.o bzip2/huffman.o bzip2/randtable.o
BIN = unalz
LDFLAGS =
CFLAGS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
@ -13,25 +13,33 @@ all:
@echo "TARGET_SYSTEM is one of"
@echo ""
@echo " posix : POSIX system (FreeBSD/linux/OSX/sparc)"
@echo " posix-utf8 : POSIX with utf8 filesystem(OSX)"
@echo " posix-noiconv : POSIX without libiconv (Windows(MINGW32,CYGWIN)/CP949 only file system)"
@echo " posix-utf8 : POSIX with utf8 filesystem(e.g. OSX)"
@echo " linux-utf8 : LINUX with utf8 filesystem(without -liconv option)"
@echo " posix-noiconv : POSIX without libiconv (Windows(MINGW32,CYGWIN) or EUC-KR file system)"
@echo ""
@echo " and 'clean' for clean"
@echo " 'install' for copy unalz to /usr/local/bin and "
@echo " 'clean' for clean"
@echo ""
posix: unalz
$(CPP) -c UnAlz.cpp -c main.cpp -D_UNALZ_ICONV $(CFLAGS)
$(CPP) -c UnAlz.cpp -c UnAlzUtils.cpp -c main.cpp -D_UNALZ_ICONV $(CFLAGS)
$(CPP) $(OBJ) $(LDFLAGS) -liconv -o $(BIN)
posix-utf8: unalz
$(CPP) -c UnAlz.cpp -c main.cpp -D_UNALZ_ICONV -D_UNALZ_UTF8 $(CFLAGS)
$(CPP) -c UnAlz.cpp -c UnAlzUtils.cpp -c main.cpp -D_UNALZ_ICONV -D_UNALZ_UTF8 $(CFLAGS)
$(CPP) $(OBJ) $(LDFLAGS) -liconv -o $(BIN)
posix-noiconv: unalz
$(CPP) -c UnAlz.cpp -c main.cpp $(CFLAGS)
$(CPP) -c UnAlz.cpp -c UnAlzUtils.cpp -c main.cpp $(CFLAGS)
$(CPP) $(OBJ) $(LDFLAGS) -o $(BIN)
linux-utf8: unalz
$(CPP) -c UnAlz.cpp -c UnAlzUtils.cpp -c main.cpp -D_UNALZ_ICONV -D_UNALZ_UTF8 $(CFLAGS)
$(CPP) $(OBJ) $(LDFLAGS) -o $(BIN)
install:
cp unalz /usr/local/bin/
clean:
rm -f $(OBJ) $(BIN)

View file

@ -2,8 +2,7 @@
PROG= unalz
NOMAN=
SRCS= main.cpp UnAlz.cpp UnAlzBz2decompress.c UnAlzBzip2.cpp \
UnAlzbzlib.c
SRCS= main.cpp UnAlz.cpp UnAlzBz2decompress.c UnAlzBzip2.cpp UnAlzbzlib.c UnAlzUtils.cpp
LDADD+= -lz -lbz2 -liconv -lstdc++
.include <bsd.prog.mk>

View file

@ -3,6 +3,18 @@
#include "bzip2/bzlib.h"
#include "UnAlz.h"
// utime 함수 처리
#if defined(_WIN32) || defined(__CYGWIN__)
# include <time.h>
# include <sys/utime.h>
#endif
#ifdef __GNUC__
# include <time.h>
# include <utime.h>
#endif
// mkdir
#ifdef _WIN32
# include <direct.h>
@ -68,7 +80,7 @@
#ifndef MAX_PATH
# define MAX_PATH 260
# define MAX_PATH 260*6 // 그냥 .. 충분히..
#endif
#ifdef _WIN32
@ -79,6 +91,18 @@
# define PATHSEPC '/'
#endif
static time_t dosTime2TimeT(UINT32 dostime) // from INFO-ZIP src
{
struct tm t;
t.tm_isdst = -1;
t.tm_sec = (((int)dostime) << 1) & 0x3e;
t.tm_min = (((int)dostime) >> 5) & 0x3f;
t.tm_hour = (((int)dostime) >> 11) & 0x1f;
t.tm_mday = (int)(dostime >> 16) & 0x1f;
t.tm_mon = ((int)(dostime >> 21) & 0x0f) - 1;
t.tm_year = ((int)(dostime >> 25) & 0x7f) + 80;
return mktime(&t);
}
// error string table <- CUnAlz::ERR 의 번역
@ -355,13 +379,13 @@ BOOL CUnAlz::ReadLocalFileheader()
FRead(&(zipHeader.compressionMethod), sizeof(zipHeader.compressionMethod));
FRead(&(zipHeader.unknown), sizeof(zipHeader.unknown));
FRead(&(zipHeader.fileCRC), sizeof(zipHeader.fileCRC));
// FRead(&(zipHeader.passwordCRC), sizeof(zipHeader.passwordCRC));
FRead(&(zipHeader.compressedSize), byteLen);
FRead(&(zipHeader.uncompressedSize), byteLen); // 압축 사이즈가 없다.
}
// little to system
zipHeader.fileCRC = unalz_le32toh(zipHeader.fileCRC);
zipHeader.head.fileNameLength = unalz_le16toh(zipHeader.head.fileNameLength);
zipHeader.compressedSize = unalz_le64toh(zipHeader.compressedSize);
zipHeader.uncompressedSize = unalz_le64toh(zipHeader.uncompressedSize);
@ -389,7 +413,7 @@ BOOL CUnAlz::ReadLocalFileheader()
size_t size;
char inbuf[ICONV_BUF_SIZE];
char outbuf[ICONV_BUF_SIZE];
#if defined(__FreeBSD__) || defined(__CYGWIN__)
#if defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__APPLE__)
const char *inptr = inbuf;
#else
char *inptr = inbuf;
@ -474,6 +498,7 @@ BOOL CUnAlz::ReadLocalFileheader()
}
*/
/*
#ifdef _DEBUG
printf("NAME:%s COMPRESSED SIZE:%d UNCOMPRESSED SIZE:%d COMP METHOD:%d\n",
zipHeader.fileName,
@ -482,6 +507,7 @@ BOOL CUnAlz::ReadLocalFileheader()
zipHeader.compressionMethod
);
#endif
*/
// 파일을 목록에 추가한다..
m_fileList.push_back(zipHeader);
@ -691,7 +717,15 @@ BOOL CUnAlz::ExtractCurrentFile(const char* szDestPathName, const char* szDestFi
if(m_pFuncCallBack) m_pFuncCallBack(m_posCur->fileName, 0,m_posCur->uncompressedSize,m_pCallbackParam, NULL);
ret = ExtractTo(&dest);
if(dest.fp!=NULL)fclose(dest.fp);
if(dest.fp!=NULL)
{
fclose(dest.fp);
// file time setting - from unalz_wcx_01i.zip
utimbuf tmp;
tmp.actime = 0; // 마지막 엑세스 타임
tmp.modtime = dosTime2TimeT(m_posCur->head.fileTimeDate); // 마지막 수정일자만 변경(만든 날자는 어떻게 바꾸지?)
utime(m_posCur->fileName, &tmp);
}
return ret;
}
@ -721,6 +755,7 @@ BOOL CUnAlz::ExtractTo(SExtractDest* dest)
{
// alzip 5.6 부터 추가된 포맷(5.5 에서는 풀지 못한다. 영문 5.51 은 푼다 )
// 하지만 어떤 버전에서 이 포맷을 만들어 내는지 정확히 알 수 없다.
// 공식으로 릴리즈된 알집은 이 포맷을 만들어내지 않는다. 비공식(베타?)으로 배포된 버전에서만 이 포맷을 만들어낸다.
m_nErr = ERR_UNKNOWN_COMPRESSION_METHOD;
ASSERT(0);
ret = FALSE;
@ -1418,6 +1453,7 @@ void CUnAlz::FClose()
m_nVirtualFilePos = 0;
m_nCurFilePos = 0;
m_bIsEOF = FALSE;
}
////////////////////////////////////////////////////////////////////////////////////////////////////

44
UnAlz.h
View file

@ -42,7 +42,7 @@
- unalz 0.22
2004/10/30 - & ..
- unalz 0.23
2004/11/14 - by xxfre86 :
2004/11/14 - by xxfree86 :
- unalz 0.30
2004/11/27 - cygwin에서
- GPL CZipArchive "ZIP File Format Specification version 4.5" &
@ -56,7 +56,13 @@
2005/06/16 - GetFileList() ( )
2005/06/18 - by goweol : utf-8
- unalz 0.4
2005/06/22 - by goweol : -l
- UnAlzUtils.cpp/h
2005/06/29 - by xxfree86 : MacOSX 10.4.1 gcc 4.0 iconv
- CRC (?)
2005/07/02 - unalz , ..
- - from unalz_wcx_01i.zip
2005/07/09 - unalz 0.5
:
- alz ( deflate/ bzip2/raw )
@ -79,7 +85,6 @@
#define _UNALZ_H_
#include <vector>
#include <string>
using namespace std;
@ -129,8 +134,10 @@ using namespace std;
typedef unsigned long ULONG; // same as DWORD? i don't know.
#endif
#ifndef BOOL
# ifndef BOOL_DEFINED // 이미 BOOL 이 DEFINE 되어 있으면 BOOL_DEFINED 를 define 해서 컴파일 에러를 막을 수 있다.
typedef int BOOL;
# endif
#endif
#ifndef FALSE
# define FALSE 0
#endif
@ -147,7 +154,7 @@ using namespace std;
#ifndef ASSERT
# include <assert.h>
//# define ASSERT(x) assert(x)
# define ASSERT(x) {printf("assert at file:%s line:%d\n", __FILE__, __LINE__);}
# define ASSERT(x) {printf("unalz assert at file:%s line:%d\n", __FILE__, __LINE__);}
#endif
@ -162,7 +169,7 @@ namespace UNALZ
# pragma pack(1)
#endif
static const char UNALZ_VERSION[] = "CUnAlz0.4";
static const char UNALZ_VERSION[] = "CUnAlz0.5";
static const char UNALZ_COPYRIGHT[] = "Copyright(C) 2004-2005 by hardkoder ( http://www.kipple.pe.kr ) ";
enum {ENCR_HEADER_LEN=12}; // xf86
@ -196,18 +203,28 @@ enum COMPRESSION_METHOD ///<
COMP_UNKNOWN = 3, // unknown!
};
enum FILE_ATTRIBUTE
enum ALZ_FILE_ATTRIBUTE
{
FILEATTR_FILE = 0x1,
FILEATTR_FOLDER = 0x10,
FILEATTR_FILE2 = 0x20, /// FILEATTR_FILE 과 FILEATTR_FILE2 의 차이는 모르겠다..
ALZ_FILEATTR_READONLY = 0x1,
ALZ_FILEATTR_HIDDEN = 0x2,
ALZ_FILEATTR_DIRECTORY = 0x10,
ALZ_FILEATTR_FILE = 0x20,
};
enum ALZ_FILE_DESCRIPTOR
{
ALZ_FILE_DESCRIPTOR_ENCRYPTED = 0x01, // 암호 걸린 파일
ALZ_FILE_DESCRIPTOR_FILESIZEFIELD_1BYTE = 0x10, // 파일 크기 필드의 크기
ALZ_FILE_DESCRIPTOR_FILESIZEFIELD_2BYTE = 0x20,
ALZ_FILE_DESCRIPTOR_FILESIZEFIELD_4BYTE = 0x40,
ALZ_FILE_DESCRIPTOR_FILESIZEFIELD_8BYTE = 0x80,
};
struct _SLocalFileHeaderHead ///< 고정 헤더.
{
SHORT fileNameLength;
BYTE fileAttribute; // from http://www.zap.pe.kr, FILE_ATTRIBUE 참고
UINT32 fileTimeDate;
BYTE fileAttribute; // from http://www.zap.pe.kr, enum FILE_ATTRIBUE 참고
UINT32 fileTimeDate; // dos file time
BYTE fileDescriptor; ///< 파일 크기 필드의 크기 : 0x10, 0x20, 0x40, 0x80 각각 1byte, 2byte, 4byte, 8byte.
///< fileDescriptor & 1 == 암호걸렸는지 여부
@ -246,7 +263,6 @@ struct SLocalFileHeader
BYTE compressionMethod; ///< 압축 방법 : 2 - deflate, 1 - 변형 bzip2, 0 - 압축 안함.
BYTE unknown;
UINT32 fileCRC; ///< 파일의 CRC, 최상위 바이트는 암호 체크용으로도 사용된다.
//BYTE passwordCRC; ///< 암호 체크를 위한 1byte crc
INT64 compressedSize;
INT64 uncompressedSize;
@ -262,7 +278,7 @@ struct SLocalFileHeader
struct _SCentralDirectoryStructureHead
{
UINT32 dwUnknown; ///< 항상 NULL 이던데..
UINT32 dwMaybeCRC; ///< 아마도 crc
UINT32 dwUnknown2; ///< 아마도 crc
UINT32 dwCLZ03; ///< "CLZ0x03" - 0x035a4c43 끝을 표시하는듯.
/*
SHORT versionMadeBy;
@ -472,7 +488,7 @@ private : // bzip2
int BZ2_bzRead(int* bzerror, MYBZFILE* b, void* buf, int len);
void BZ2_bzReadClose( int *bzerror, MYBZFILE *b );
private : // 분할 압축 파일 처리를 위한 래퍼(lapper?) 클래스
private : // 분할 압축 파일 처리를 위한 래퍼(lapper^^?) 클래스
BOOL FOpen(const char* szPathName);
void FClose();
INT64 FTell();

108
UnAlzUtils.cpp Executable file
View file

@ -0,0 +1,108 @@
#include <stdio.h>
#include <time.h>
#include "UnAlzUtils.h"
#ifdef _WIN32
# define I64FORM(x) "%"#x"I64d"
# define U64FORM(x) "%"#x"I64u"
#else
# define I64FORM(x) "%"#x"lld"
# define U64FORM(x) "%"#x"llu"
#endif
time_t dosTime2TimeT(UINT32 dostime) // from INFO-ZIP src
{
struct tm t;
t.tm_isdst = -1;
t.tm_sec = (((int)dostime) << 1) & 0x3e;
t.tm_min = (((int)dostime) >> 5) & 0x3f;
t.tm_hour = (((int)dostime) >> 11) & 0x1f;
t.tm_mday = (int)(dostime >> 16) & 0x1f;
t.tm_mon = ((int)(dostime >> 21) & 0x0f) - 1;
t.tm_year = ((int)(dostime >> 25) & 0x7f) + 80;
return mktime(&t);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// fileAttribute 를 스트링으로 바꿔준다.
/// @param buf - 5byte 이상
/// @param fileAttribute - ALZ_FILE_ATTRIBUTE 참조
/// @return
/// @date 2005-06-23 오후 10:12:35
////////////////////////////////////////////////////////////////////////////////////////////////////
void FileAttr2Str(char* buf, BYTE fileAttribute)
{
buf[0] = 0;
if(fileAttribute&ALZ_FILEATTR_FILE)
strcat(buf, "A");
else
strcat(buf, "_");
if(fileAttribute&ALZ_FILEATTR_DIRECTORY)
strcat(buf, "D");
else
strcat(buf, "_");
if(fileAttribute&ALZ_FILEATTR_READONLY)
strcat(buf, "R");
else
strcat(buf, "_");
if(fileAttribute&ALZ_FILEATTR_HIDDEN)
strcat(buf, "H");
else
strcat(buf, "_");
}
// alz 파일을 리스팅 한다 ( -l 옵션 )
int ListAlz(CUnAlz* pUnAlz, const char* src)
{
CUnAlz::FileList::iterator i;
CUnAlz::FileList* list;
list = pUnAlz->GetFileList();
printf("\nListing archive: %s\n"
"\n Date Time Attr Size Compressed Name\n",
src);
printf("------------------- ----- ------------ ------------ ------------\n");
char szDate[64];
char szTime[64];
char szAttr[6];
UINT64 totalUnCompressedSize = 0;
UINT64 totalCompressedSize = 0;
unsigned fileNum = 0;
time_t time;
struct tm* filetm;
for(i=list->begin(); i<list->end(); i++)
{
// time
time = dosTime2TimeT(i->head.fileTimeDate);
filetm = localtime(&time);
strftime(szTime, 64, "%H:%M:%S", filetm);
strftime(szDate, 64, "%Y:%m:%d", filetm);
// attributes
FileAttr2Str(szAttr, i->head.fileAttribute);
printf("%s %s %s " I64FORM(12) " " I64FORM(12) " %s%s\n",
szDate, szTime, szAttr, i->uncompressedSize,
i->compressedSize, i->fileName,
i->head.fileDescriptor & ALZ_FILE_DESCRIPTOR_ENCRYPTED ? "*" : "" );
++fileNum;
totalUnCompressedSize += i->uncompressedSize;
totalCompressedSize += i->compressedSize;
}
printf("------------------- ----- ------------ ------------ ------------\n");
printf(" " U64FORM(12) " " U64FORM(12) " %u file(s)\n",
totalUnCompressedSize, totalCompressedSize, fileNum);
return 0;
}

26
UnAlzUtils.h Executable file
View file

@ -0,0 +1,26 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// unalz 관련 유틸 모음
///
/// @author hardkoder
/// @date 2005-06-23 오후 9:55:34
///
////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef _UNALZ_UTILS_H_
#define _UNALZ_UTILS_H_
#include "UnAlz.h"
time_t dosTime2TimeT(UINT32 dostime);
int ListAlz(CUnAlz* pUnAlz, const char* src);
#endif // _UNALZ_UTILS_H_

View file

@ -1,4 +1,5 @@
del *.plg *.obj *.o *.sbr *.pch *.pdb *.res *.bsc *.pcc *.idb *.pdb *.ncb *.aps *.ilk 2*.log *.map *.opt *.exp *.sup *.dpbcd gebug.txt *_d.exe *_d.dll *_d.lib *_debug.dll *_debug.exe *.tlh *.tli *.scc /s
del *.plg *.obj *.o *.sbr *.pch *.pdb *.res *.bsc *.pcc *.idb *.pdb *.ncb *.aps *.ilk 2*.log *.map *.opt *.exp *.sup *.dpbcd gebug.txt *_d.exe *_d.dll *_d.lib *_debug.dll *_debug.exe *.tlh *.tli *.scc *.bak /s
del unalz.exe
rmdir bin
rmdir release
rmdir debug

147
main.cpp
View file

@ -1,11 +1,20 @@
#ifdef _WIN32
# pragma warning( disable : 4786 ) // stl warning 없애기
#endif
#include <stdio.h>
#include <iostream>
#include <time.h>
#include <string>
#include <vector>
#include "UnAlz.h"
#include "UnAlzUtils.h"
void Usage()
{
printf("\n");
/*
#ifdef _UNALZ_ICONV
printf("USAGE : unalz [ -utf8 | -cp949 | -euc-kr ] sourcefile.alz [dest path] \n");
# ifdef _UNALZ_UTF8
@ -20,8 +29,32 @@ void Usage()
#else // no iconv
printf("USAGE : unalz sourcefile.alz [dest path] \n");
#endif // _UNALZ_ICONV
*/
printf("Usage : unalz [<switches>...] archive.alz [<file names to extract>...]\n");
printf("\n");
printf("<switches>\n");
#ifdef _UNALZ_ICONV
# ifdef _UNALZ_UTF8
printf(" -utf8 : convert filename's codepage to UTF-8 (default)\n");
printf(" -cp949 : convert filename's codepage to CP949\n");
printf(" -euc-kr : convert filename's codepage to EUC-KR\n");
# else
printf(" -utf8 : convert filename's codepage to UTF-8\n");
printf(" -cp949 : convert filename's codepage to CP949 (default)\n");
printf(" -euc-kr : convert filename's codepage to EUC-KR\n");
# endif // _UNALZ_UTF8
#endif // _UNALZ_ICONV
printf(" -l : list contents of archive\n");
printf(" -d directory : set output directory\n");
}
void UnAlzCallback(const char* szMessage, INT64 nCurrent, INT64 nRange, void* param, BOOL* bHalt)
{
// progress
@ -72,7 +105,8 @@ int main(int argc, char* argv[])
// printf("unalz v0.22 (2004/10/27) \n");
// printf("unalz v0.23 (2004/10/30) \n");
// printf("unalz v0.31 (2004/11/27) \n");
printf("unalz v0.4 (2005/06/18) \n");
// printf("unalz v0.4 (2005/06/18) \n");
printf("unalz v0.5 (2005/07/09) \n");
printf("Copyright(C) 2004-2005 by hardkoder (http://www.kipple.pe.kr) \n");
if(argc<2)
@ -85,27 +119,37 @@ int main(int argc, char* argv[])
char* source=NULL;
char* destpath=".";
char* destcodepage=NULL;
int count=1;
int count;
BOOL listMode = FALSE;
vector<string> filelist;
// utf8 옵션 처리
/* old method
for (count=1 ; count < argc && argv[count][0] == '-'; ++count)
{
#ifdef _UNALZ_ICONV
// utf8 옵션 처리
if(strcmp(argv[count], "-utf8")==0)
{
destcodepage = "UTF-8"; // utf-8 support
count++;
}
else if(strcmp(argv[count], "-cp949")==0)
{
destcodepage = "CP949"; // cp959
count++;
destcodepage = "CP949"; // cp949
}
else if(strcmp(argv[count], "-euc-kr")==0)
{
destcodepage = "EUC-KR"; // EUC-KR
count++;
}
if(count>=argc) {Usage();return 0;} // 옵션만 쓰면 어쩌라고..
else
#endif
if(strcmp(argv[count], "-l")==0 || strcmp(argv[count], "-list")==0)
{
listMode = TRUE;
}
}
#ifdef _UNALZ_ICONV
if(count>=argc) {Usage();return 0;} // 옵션만 쓰면 어쩌라고..
if(destcodepage) unalz.SetDestCodepage(destcodepage);
#endif
@ -119,6 +163,54 @@ int main(int argc, char* argv[])
destpath = argv[count];
count++;
}
*/
for (count=1 ; count < argc; count++)
{
#ifdef _UNALZ_ICONV
// utf8 옵션 처리
if(strcmp(argv[count], "-utf8")==0)
{
destcodepage = "UTF-8"; // utf-8 support
}
else if(strcmp(argv[count], "-cp949")==0)
{
destcodepage = "CP949"; // cp949
}
else if(strcmp(argv[count], "-euc-kr")==0)
{
destcodepage = "EUC-KR"; // EUC-KR
}
else
#endif
if(strcmp(argv[count], "-l")==0 || strcmp(argv[count], "-list")==0)
{
listMode = TRUE;
}
else if(strcmp(argv[count], "-d")==0) // dest dir
{
count++;
if(count>=argc) {Usage();return 0;} // dest dir 이 정상 지정되지 않았다..
destpath = argv[count];
}
else // 옵션이 아닌 경우
{
if(source==NULL) // 소스 파일 경로
{
source=argv[count];
}
else // 압축풀 파일
{
filelist.push_back(argv[count]);
}
}
}
if(source==NULL) {Usage();return 0;} // 옵션만 쓰면 어쩌라고..
#ifdef _UNALZ_ICONV
if(destcodepage) unalz.SetDestCodepage(destcodepage);
#endif
// ÆÄÀÏ ¿­±â
@ -126,7 +218,7 @@ int main(int argc, char* argv[])
{
if(unalz.GetLastErr()==CUnAlz::ERR_CORRUPTED_FILE)
{
printf("It's corrupted file.\n", source); // 그냥 계속 풀기..
printf("It's corrupted file.\n"); // 그냥 계속 풀기..
}
else
{
@ -136,11 +228,17 @@ int main(int argc, char* argv[])
}
}
if(unalz.IsEncrypted()){
if (listMode)
{
return ListAlz(&unalz, source);
}
else
{
if(unalz.IsEncrypted())
{
char pwd[256];
cout << "Enter Password : ";
cin >> pwd;
printf("Enter Password : ");
fgets(pwd,256,stdin);
unalz.setPassword(pwd);
}
@ -148,15 +246,32 @@ int main(int argc, char* argv[])
// callback ÇÔ¼ö ¼¼ÆÃ
unalz.SetCallback(UnAlzCallback, (void*)NULL);
if (filelist.empty()==false) // 파일 지정하기.
{
vector<string>::iterator i;
for(i=filelist.begin();i<filelist.end();i++)
{
if(unalz.SetCurrentFile(i->c_str())==FALSE)
{
printf("filename not matched : %s\n", i->c_str());
}
else
unalz.ExtractCurrentFile(destpath);
}
}
else // 모든 파일 다풀기.
{
if(unalz.ExtractAll(destpath)==FALSE)
{
printf("\n");
printf("extract %s to %s failed.\n", source, destpath);
printf("err code(%d) (%s)\n", unalz.GetLastErr(), unalz.GetLastErrStr());
printf("err code(%d) (%s)\n", unalz.GetLastErr(),
unalz.GetLastErrStr());
}
}
printf("\ndone..\n");
}
return 0;
}

View file

@ -1,19 +1,14 @@
unalz v0.31
unalz v0.5
copyright(C) 2004 koder (http://www.kipple.pe.kr)
Copyright(C) 2004-2005 by hardkoder (http://www.kipple.pe.kr)
- 최초 작성일 : v0.20 - 2004/10/22
- 최종 갱신일 : v0.31 - 2004/11/27
- 기능
. alz 파일 압축 해제 프로그램
. deflate/변형 bzip2/raw 포맷 지원
. 분할 압축 파일 지원
. WIN32(VC60/VC70/DEV-C++/CYGWIN/MINGW) , Free-BSD/LINUX(gcc/g++) 지원
- 라이선스
. 자유로이 변형/배포 가능 (BSD-license)

View file

@ -213,6 +213,14 @@ SOURCE=.\UnAlzBzip2.cpp
SOURCE=.\UnAlzbzlib.c
# End Source File
# Begin Source File
SOURCE=.\UnAlzUtils.cpp
# End Source File
# Begin Source File
SOURCE=.\UnAlzUtils.h
# End Source File
# End Group
# End Target
# End Project

View file

@ -384,6 +384,12 @@
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath=".\UnAlzUtils.cpp">
</File>
<File
RelativePath=".\UnAlzUtils.h">
</File>
</Filter>
</Files>
<Globals>