ARJ解包C语言源代码.zip

  • PUDN用户
    了解作者
  • C/C++
    开发工具
  • 43KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 151
    下载次数
  • 2005-07-18 06:19
    上传日期
ARJ解包C语言源代码,供个人研究压缩算法等。
ARJ解包C语言源代码.zip
  • UNARJNT
  • UNARJ.EXE
    39KB
  • WIN32UN.MAK
    815B
  • DECODE.C
    11.9KB
  • ENVIRON.C
    15.1KB
  • TCCUNARJ.MAK
    303B
  • UNARJ.C
    23.5KB
  • QCLUNARJ.MAK
    304B
  • UNARJ.DOC
    10.4KB
  • UNARJ.DEF
    34B
  • README.DOC
    966B
  • UNARJ.H
    13.8KB
  • TECHNOTE.DOC
    8.8KB
  • OS2UNARJ.MAK
    350B
  • www.pudn.com.txt
    218B
内容介绍
/* UNARJ.C, UNARJ, R JUNG, 02/17/93 * Main Extractor routine * Copyright (c) 1991-93 by Robert K Jung. All rights reserved. * * This code may be freely used in programs that are NOT ARJ archivers * (both compress and extract ARJ archives). * * If you wish to distribute a modified version of this program, you * MUST indicate that it is a modified version both in the program and * source code. * * I am holding the copyright on the source code, so please do not * delete my name from the program files or from the documentation. * * I wish to give credit to Haruhiko Okumura for providing the * basic ideas for ARJ and UNARJ in his program AR. Please note * that UNARJ is significantly different from AR from an archive * structural point of view. * * Modification history: * Date Programmer Description of modification. * 04/05/91 R. Jung Rewrote code. * 04/23/91 M. Adler Portabilized. * 04/29/91 R. Jung Added l command. Removed 16 bit dependency in * fillbuf(). * 05/19/91 R. Jung Fixed extended header skipping code. * 05/25/91 R. Jung Improved find_header(). * 06/03/91 R. Jung Changed arguments in get_mode_str() and * set_ftime_mode(). * 06/19/81 R. Jung Added two more %c in printf() in list_arc(). * 07/07/91 R. Jung Added default_case_path() to extract(). * Added strlower(). * 07/20/91 R. Jung Changed uint ratio() to static uint ratio(). * 07/21/91 R. Jung Added #ifdef VMS. * 08/28/91 R. Jung Changed M_DIFFHOST message. * 08/31/91 R. Jung Added changes to support MAC THINK_C compiler * per Eric Larson. * 10/07/91 R. Jung Added missing ; to THINK_C additions. * 11/11/91 R. Jung Added host_os test to fwrite_txt_crc(). * 11/24/91 R. Jung Added more error_count processing. * 12/03/91 R. Jung Added backup file processing. * 02/17/93 R. Jung Added archive modified date support. * 07/28/93 N. Leon Added WinNT (WIN32) console support * */ #include "unarj.h" #ifdef MODERN #include <stdlib.h> #include <string.h> #include <ctype.h> #else /* !MODERN */ extern void free(); extern void exit(); extern char *strcat(); extern char *strcpy(); extern char *strncpy(); extern char *strchr(); extern char *strrchr(); extern int strlen(); extern int strcmp(); #ifdef VMS #include <ssdef.h> #define EXIT_FAILURE SS$_ABORT #define EXIT_SUCCESS SS$_NORMAL #else #define EXIT_FAILURE (1) #define EXIT_SUCCESS (0) #endif #define toupper(c) ((c)>='a'&&(c)<='z'?(c)-('a'-'A'):(c)) #define tolower(c) ((c)>='A'&&(c)<='Z'?(c)+('a'-'A'):(c)) #endif /* ?MODERN */ #ifdef THINK_C #include <console.h> #endif /* Global variables */ UCRC crc; FILE *arcfile; FILE *outfile; ushort bitbuf; long compsize; long origsize; uchar subbitbuf; uchar header[HEADERSIZE_MAX]; char arc_name[FNAME_MAX]; int command; int bitcount; int file_type; int no_output; int error_count; /* Messages */ static char *M_USAGE [] = { "Usage: UNARJ archive[.arj] (list archive)\n", " UNARJ e archive (extract archive)\n", " UNARJ l archive (list archive)\n", " UNARJ t archive (test archive)\n", " UNARJ x archive (extract with pathnames)\n", "\n", "This is an ARJ demonstration program and ** IS NOT OPTIMIZED ** for speed.\n", "You may freely use, copy and distribute this program, provided that no fee\n", "is charged for such use, copying or distribution, and it is distributed\n", "ONLY in its original unmodified state. UNARJ is provided as is without\n", "warranty of any kind, express or implied, including but not limited to\n", "the implied warranties of merchantability and fitness for a particular\n", "purpose. Refer to UNARJ.DOC for more warranty information.\n", "\n", "ARJ Software Internet address : robjung@world.std.com\n", "Robert and Susan Jung CompuServe userid: 72077,445\n", "2606 Village Road West\n", "Norwood, Massachusetts 02062\n", "USA\n", NULL }; #ifdef WIN32 char M_VERSION [] = "UNARJ (WinNT Console Version) 2.41 Copyright (c) 1991-93 Robert K Jung\n\n"; #else char M_VERSION [] = "UNARJ (Demo version) 2.41 Copyright (c) 1991-93 Robert K Jung\n\n"; #endif char M_ARCDATE [] = "Archive created: %s"; char M_ARCDATEM[] = ", modified: %s"; char M_BADCOMND[] = "Bad UNARJ command: %s"; char M_BADCOMNT[] = "Invalid comment header"; char M_BADHEADR[] = "Bad header"; char M_BADTABLE[] = "Bad Huffman code"; char M_CANTOPEN[] = "Can't open %s"; char M_CANTREAD[] = "Can't read file or unexpected end of file"; char M_CANTWRIT[] = "Can't write file. Disk full?"; char M_CRCERROR[] = "CRC error!\n"; char M_CRCOK [] = "CRC OK\n"; char M_DIFFHOST[] = " Binary file!"; char M_ENCRYPT [] = "File is password encrypted, "; char M_ERRORCNT[] = "%sFound %5d error(s)!"; char M_EXTRACT [] = "Extracting %-25s"; char M_FEXISTS [] = "%-25s exists, "; char M_HEADRCRC[] = "Header CRC error!"; char M_NBRFILES[] = "%5d file(s)\n"; char M_NOMEMORY[] = "Out of memory"; char M_NOTARJ [] = "%s is not an ARJ archive"; char M_PROCARC [] = "Processing archive: %s\n"; char M_SKIPPED [] = "Skipped %s\n"; char M_SUFFIX [] = ARJ_SUFFIX; char M_TESTING [] = "Testing %-25s"; char M_UNKNMETH[] = "Unsupported method: %d, "; char M_UNKNTYPE[] = "Unsupported file type: %d, "; char M_UNKNVERS[] = "Unsupported version: %d, "; #define get_crc() get_longword() #define fget_crc(f) fget_longword(f) #define setup_get(PTR) (get_ptr = (PTR)) #define get_byte() ((uchar)(*get_ptr++ & 0xff)) #define BUFFERSIZE 4096 #define ASCII_MASK 0x7F #define CRCPOLY 0xEDB88320L #define UPDATE_CRC(r,c) r=crctable[((uchar)(r)^(uchar)(c))&0xff]^(r>>CHAR_BIT) /* Local functions */ #ifdef MODERN static void make_crctable(void); static void crc_buf(char *str, int len); static void strparity(uchar *p); static FILE *fopen_msg(char *name, char *mode); static int fget_byte(FILE *f); static uint fget_word(FILE *f); static ulong fget_longword(FILE *f); static void fread_crc(uchar *p, int n, FILE *f); static void decode_path(char *name); static void get_date_str(char *str, ulong tstamp); static int parse_path(char *pathname, char *path, char *entry); static void strncopy(char *to, char *from, int len); static uint get_word(void); static ulong get_longword(void); static long find_header(FILE *fd); static int read_header(int first, FILE *fd, char *name); static void skip(void); static void unstore(void); static int check_flags(void); static int extract(void); static int test(void); static uint ratio(long a, long b); static void list_start(void); static void list_arc(int count); static void execute_cmd(void); static void help(void); #endif /* MODERN */ /* Local variables */ static char filename[FNAME_MAX]; static char comment[COMMENT_MAX]; static char *hdr_filename; static char *hdr_comment; static ushort headersize; static uchar first_hdr_size; static uchar arj_nbr; static uchar arj_x_nbr; static uchar host_os; static uchar arj_flags; static short method; static uint file_mode; static ulong time_stamp; static short entry_pos; static ushort host_data; static uchar *get_ptr; static UCRC file_crc; static UCRC header_crc; static long first_hdr_pos; static long torigsize; static long tcompsize; static int clock_inx; static char *writemode[2] = { "wb", "w" }; static UCRC crctable[UCHAR_MAX + 1]; /* Functions */ static void make_crctable() { uint i, j; UCRC r; for (i = 0; i <= UCHAR_MAX; i++) { r = i; for (j = CHAR_BIT; j > 0; j--) {
评论
    相关推荐
    • winRAR压缩软件
      winRAR压缩软件 正式版流行好用功能强大的压缩压缩工具。支持鼠标拖放及外壳扩展;...固定压缩和多卷自释放压缩以及针对文本类、多媒体类和 PE 类文件的优化算法是大多数压缩工具所不具备的;使用非常简单方便
    • 7z zip 版本920 旧版本 压缩软件.exe
      使用了 LZMA 与 LZMA2 算法的 7z 格式 拥有极高的压缩比 支持格式: 压缩 / 解压缩:7z, XZ, BZIP2, GZIP, TAR, ZIP and WIM 仅解压缩ARJ, CAB, CHM, CPIO, CramFS, DEB, DMG, FAT, HFS, ISO, LZH, LZMA, MBR, MSI...
    • WinRAR压缩软件官方最新正版
      WinRAR 在 DOS 时代就一直具备这种优势,经过多次试验证明,WinRAR 的 RAR 格式一般要比其他的 ZIP 格式高出 10%~30% 的压缩率,尤其是它还提供了可选择的、针对多媒体数据的压缩算法。 对多媒体文件有独特的高压...
    • 关于VRML文件WRL文件压缩
      - 更新了算法来加大 7z 格式的压缩比 - 压缩档案可基于 GNU LGPL 之下发布 - 支持 7z、ZIP、CAB、RAR、ARJ、LZH、GZIP、BZIP2、Z、CHM、TAR、CPIO、RPM 和 DEB - 更快的压缩和解压缩速度 - 7z 格式支持创建自...
    • 多种压缩算法的源代码
      包含Lzw,Huff1,Dhuff等等多种压缩算法的源代码包。
    • RAR解压缩密码破解软件
      CPU 可选用自定义化的“暴破”方式,也可选用高效的字典方式 支持经 AES-128 算法加密的各类 RAR/WinRAR 压缩包 注册码:ARPR-83296730531875-CBBVYBXFEXDEVPMB-Unzip password cracking baolipuojie
    • 7-Zip开源压缩软件
      7-Zip 是一款拥有极高压缩比的开源压缩软件...使用了 LZMA 与 LZMA2 算法的 7z 格式 拥有极高的压缩比,7z 格式支持创建自释放压缩包,强大的的文件管理器,更给力的命令行版本。可作为其他同类压缩软件的最佳替代品。
    • 数字图像 压缩算法
      不错的压缩算法,有需要的话可以下载看看,真的值得一看的代码!
    • WINRAR压缩软件
      这款软件在DOS 时代就一直具备这种优势,经过多次试验证明,这款软件的 RAR 格式一般要比其他的 ZIP 格式高出 10%~30% 的压缩率,尤其是它还提供了可选择的、针对多媒体数据的压缩算法。 2、对多媒体文件有独特的...
    • 专用RAR解压缩软件
      固定压缩和多卷自释放压缩以及针对文本类、多媒体类和 PE 类文件的优化算法是大多数压缩工具所不具备的;使用非常简单方便,配置选项也不多,仅在资源管理器中就可以完成你想做的工作;对于 ZIP 和 RAR 的自释放档案...