LIBRARY.C 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
  12. */
  13. /*
  14. * $Source: f:/miner/source/pslib/rcs/library.c $
  15. * $Revision: 1.30 $
  16. * $Author: matt $
  17. * $Date: 1994/03/23 13:55:30 $
  18. *
  19. * Sample setup for RCS header
  20. *
  21. * $Log: library.c $
  22. * Revision 1.30 1994/03/23 13:55:30 matt
  23. * Set others_use in library get info routine
  24. *
  25. * Revision 1.29 1994/02/15 12:53:25 john
  26. * Made numfiles stored in library be a short instead of char.
  27. *
  28. * Revision 1.28 1994/02/14 20:11:38 john
  29. * First version working with new cfile stuff.
  30. *
  31. * Revision 1.27 1994/01/17 11:01:23 john
  32. * Made cfopen return NULL when file not found instead
  33. * of doing an Error inside ReadFile.
  34. *
  35. * Revision 1.26 1994/01/07 12:02:41 yuan
  36. * fixed problem with checkfile.
  37. * CheckFile now checks the directory first, rather
  38. * than the library
  39. *
  40. * Revision 1.25 1994/01/07 11:45:24 yuan
  41. * cleaned up some code.
  42. *
  43. * Revision 1.24 1994/01/07 10:24:29 yuan
  44. * Makes it so ReadFile reads from directory before
  45. * it checks the library file.
  46. *
  47. * Revision 1.23 1993/12/15 11:18:45 yuan
  48. * Fixed calloc in lib_init... Changed it to MALLOC
  49. *
  50. * Revision 1.22 1993/12/10 19:26:13 matt
  51. * Made more functions call Error() instead of returning error codes
  52. *
  53. * Revision 1.21 1993/12/08 17:06:47 yuan
  54. * Added CheckFile();
  55. *
  56. * Revision 1.20 1993/12/08 16:07:05 yuan
  57. * Changed MAX_FILES for FileList[]
  58. *
  59. * Revision 1.19 1993/10/28 14:40:55 yuan
  60. * cfread changed to cfreadfile.
  61. *
  62. * Revision 1.18 1993/10/27 12:42:29 yuan
  63. * Added ReadFileBuf to read into a buffer (compressed)
  64. *
  65. * Revision 1.17 1993/10/19 14:11:09 yuan
  66. * Fixed uncompress reading/writing problem
  67. *
  68. * Revision 1.16 1993/10/19 13:55:44 matt
  69. * Made ReadFile() call Error() on file error
  70. *
  71. * Revision 1.15 1993/10/19 12:38:53 matt
  72. * Cleaned up error handling in lib_init() a little
  73. *
  74. * Revision 1.14 1993/10/19 11:33:33 yuan
  75. * Fixed cfread free problem.
  76. *
  77. * Revision 1.13 1993/10/18 18:00:27 yuan
  78. * Fixed memory alloc errors.
  79. *
  80. * Revision 1.12 1993/10/17 18:01:48 yuan
  81. * Fixed the first file counting problem.
  82. *
  83. * Revision 1.11 1993/09/29 17:52:59 yuan
  84. * *** empty log message ***
  85. *
  86. * Revision 1.10 1993/09/29 17:46:54 yuan
  87. * ReadFile, etc. I/O functions moved back into library.c
  88. * ReadFile was renamed to ReadFileRaw which just reads
  89. * a file into a buffer... LibReadFile was renamed to
  90. * ReadFile, and it reads from either a library or a buffer
  91. * depending on lib_init and if the file is found in the
  92. * library.
  93. *
  94. * Also, printfs and exits for errors were removed.
  95. *
  96. * In this version, ReadFile should be completely transparent
  97. * to the user.
  98. *
  99. * Revision 1.9 1993/09/27 17:13:20 yuan
  100. * LibReadFile, lib_init, and lib_close functions added.
  101. * Documented in library.h.
  102. *
  103. * Revision 1.8 1993/09/21 17:22:26 yuan
  104. * *** empty log message ***
  105. *
  106. * Revision 1.7 1993/09/21 17:16:37 yuan
  107. * cleaning up
  108. *
  109. * Revision 1.6 1993/09/21 17:06:14 yuan
  110. * broken and then unbroken version.
  111. * need to restart the cflib_init stuff from scratch.
  112. *
  113. * Revision 1.5 1993/09/14 13:14:23 yuan
  114. * additional change which was made in 1.4:
  115. * If lzw_compress returns a size overflow (*size = -1) then it
  116. * means that the compression ratio is negative, thus we will
  117. * store the file rather than compress it.
  118. *
  119. * Revision 1.4 1993/09/14 13:06:41 yuan
  120. * Major changes made.
  121. * 1) cfread and cfwrite have been changed into lzw_expand and lzw_compress.
  122. * these functions now manipulate buffers rather than files.
  123. * 2) cfread, cfwrite, cfr_test, and cfw_test have been added.
  124. * cfread takes a file and returns a buffer.
  125. * cfwrite takes a buffer and writes to a file.
  126. * cfr_test and cfw_test are test programs for the previous two
  127. * programs and read and write files.
  128. * 3) extract now returns a buffer rather than passing a buffer as a
  129. * parameter.
  130. * 4) switches are allowed anywhere on the command line now.
  131. * 5) -a switch added in order to add files to a library.
  132. * 6) Help message lists available options.
  133. * 7) Date & Time added to library file headers.
  134. *
  135. * Revision 1.3 1993/09/09 17:42:21 yuan
  136. * parsarg running off of library
  137. * parsarg passes full path, so filename is extracted from path
  138. * for library.
  139. * checks to make sure library is not added to itself.
  140. * checks to make sure '-l' is not called in the middle of a build.
  141. *
  142. * Revision 1.2 1993/09/09 12:38:48 yuan
  143. * WriteFile and AppendFile fixed.
  144. *
  145. * Revision 1.1 1993/09/08 16:14:46 yuan
  146. * Initial revision
  147. *
  148. *
  149. */
  150. #pragma off (unreferenced)
  151. static char rcsid[] = "$Id: library.c 1.30 1994/03/23 13:55:30 matt Exp $";
  152. #pragma on (unreferenced)
  153. #include <time.h>
  154. #include <stdio.h>
  155. #include <stdlib.h>
  156. #include <string.h>
  157. #include <ctype.h>
  158. #include <stdarg.h>
  159. #include <conio.h>
  160. #include <dos.h>
  161. #include <fcntl.h>
  162. #include <io.h>
  163. #include <sys\types.h>
  164. #include <sys\stat.h>
  165. #include <errno.h>
  166. #include <string.h>
  167. #include "library.h"
  168. #include "mem.h"
  169. #include "error.h"
  170. int lib_flag; // library flag
  171. int l_flag; // listing flag
  172. int b_flag; // building flag;
  173. int c_flag; // compression flag
  174. FILE *InputLibFile; // file to read from
  175. FILE *OutputLibFile; // file to write to
  176. char *lib_name; // name of the library
  177. int file_count; // number of files processed
  178. int headers; // number of header spaces allocated
  179. char *FileList[MAX_FILES]; // Contains the list of files being processed
  180. file_header Header; // Holds header info of file being processed
  181. file_header *LibHeaderList;
  182. FILE *InputLibInitFile; // file to read from
  183. short init_numfiles; // number of files in the library
  184. int ReadFileBufRaw( char *filename, ubyte *buf, int bufsize )
  185. {
  186. int length;
  187. int handle;
  188. handle = open( filename, O_RDONLY | O_BINARY );
  189. if (handle == -1 )
  190. Error("File %s, %s ",filename,strerror(errno));
  191. if (length = read( handle, buf, bufsize ) != bufsize )
  192. {
  193. close( handle );
  194. Error("File %s, %s ",filename,strerror(errno));
  195. }
  196. close( handle );
  197. return length;
  198. }
  199. ubyte *ReadFileRaw( char *filename, int *length )
  200. {
  201. void *FileData;
  202. int handle;
  203. handle = open( filename, O_RDONLY | O_BINARY );
  204. if (handle == -1 )
  205. return NULL;
  206. // Error("File %s, %s ",filename,strerror(errno));
  207. *length = filelength( handle );
  208. // MALLOC( FileData, ubyte, *length );//Compile hack again -KRB
  209. FileData = (ubyte *)malloc(*length*sizeof(ubyte));
  210. if (FileData == NULL ) {
  211. close( handle );
  212. Error("File %s, cannot malloc memory",filename);
  213. }
  214. if (read( handle, FileData, *length ) != *length ) {
  215. free( FileData );
  216. close( handle );
  217. Error("File %s, %s ",filename,strerror(errno));
  218. }
  219. close( handle );
  220. return FileData;
  221. }
  222. int AppendFile( char *filename, void *data, int length )
  223. {
  224. int handle;
  225. handle = open( filename, O_WRONLY | O_CREAT | O_APPEND | O_BINARY , S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP );
  226. if (handle == -1 ) {
  227. // return ERROR_OPENING_FILE;
  228. Error("File %s, %s ",filename,strerror(errno));
  229. }
  230. if (write( handle, data, length )!=length) {
  231. close( handle );
  232. // return ERROR_WRITING_FILE;
  233. Error("File %s, %s ",filename,strerror(errno));
  234. }
  235. close( handle );
  236. return 0;
  237. }
  238. int WriteFile( char *filename, void *data, int length )
  239. {
  240. int handle;
  241. handle = open( filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP );
  242. if (handle == -1 ) {
  243. // return ERROR_OPENING_FILE;
  244. Error("File %s, %s ",filename,strerror(errno));
  245. }
  246. if (write( handle, data, length )!=length) {
  247. close( handle );
  248. // return ERROR_WRITING_FILE;
  249. Error("File %s, %s ",filename,strerror(errno));
  250. }
  251. close( handle );
  252. return 0;
  253. }
  254. int cfwritefile( char *filename, ubyte *buffer, int length ) {
  255. FILE *output;
  256. ubyte *compressed;
  257. int size;
  258. output = fopen( filename, "wb");
  259. putc( 'C', output );
  260. putc( 'F', output );
  261. fwrite( &length, sizeof(length), 1, output);
  262. compressed = lzw_compress( buffer, NULL, length, &size);
  263. if (size < 0) {
  264. printf(" WARNING! : Compressed size larger than original\n");
  265. printf(" Not storing.\n");
  266. }
  267. else {
  268. fwrite( compressed, sizeof(ubyte), size, output);
  269. fclose( output );
  270. free( compressed );
  271. return LF_LZW;
  272. }
  273. return 0;
  274. }
  275. ubyte *cfreadfile( char *filename, int *size ) {
  276. FILE *input;
  277. ubyte *tempbuf;
  278. ubyte *buf;
  279. char header[3];
  280. int length, i;
  281. input = fopen( filename, "rb" );
  282. for (i=0;i<3;i++) header[i]=0;
  283. for (i=0;i<2;i++)
  284. header[i] = (char) getc( input );
  285. if (strcmp( header, "CF" )) {
  286. return NULL;
  287. }
  288. fread( size, sizeof(int), 1, input);
  289. length = file_size( filename ) - 6;
  290. //MALLOC( tempbuf, ubyte, length );//Compile hack again -KRB
  291. tempbuf=(ubyte *)malloc(length*sizeof(ubyte));
  292. fread( tempbuf, sizeof(ubyte), length, input );
  293. buf = lzw_expand( tempbuf, NULL, *size );
  294. return buf;
  295. }
  296. ubyte *extract( char *library, char *filename ) {
  297. int i;
  298. ubyte *buf_ptr;
  299. ubyte *buf;
  300. ubyte *tempbuf;
  301. char header_buf[5];
  302. short numfiles;
  303. strupr( filename );
  304. InputLibFile = fopen( library, "rb" );
  305. for (i=0;i<5;i++) header_buf[i]=0;
  306. for (i=0;i<4;i++)
  307. header_buf[i] = (char) getc( InputLibFile );
  308. if (strcmp(header_buf, "PSLB")) {
  309. fclose( InputLibFile );
  310. return NULL;
  311. }
  312. else {
  313. //numfiles = (short) getc( InputLibFile );
  314. fread( &numfiles, sizeof(short), 1, InputLibFile );
  315. for (i=0; i<numfiles; i++) {
  316. read_data( InputLibFile, &Header );
  317. if (!strcmp(Header.name, filename)) {
  318. fseek( InputLibFile, Header.offset, SEEK_SET );
  319. //MALLOC(buf, ubyte, Header.original_size);//Compile hack again -KRB
  320. buf=(ubyte *)malloc(Header.original_size*sizeof(ubyte));
  321. buf_ptr = buf;
  322. if ( Header.compression == 0 ) {
  323. fread( buf, sizeof(ubyte), Header.original_size, InputLibFile );
  324. }
  325. else if ( Header.compression == LF_LZW ) {
  326. //MALLOC(tempbuf, ubyte, Header.length);//Compile hack again -KRB
  327. tempbuf=(ubyte*)malloc(Header.length*sizeof(ubyte));
  328. fread( tempbuf, sizeof(ubyte), Header.length, InputLibFile );
  329. lzw_expand( tempbuf, buf, Header.original_size );
  330. }
  331. break;
  332. }
  333. }
  334. if ( i >= numfiles ) return NULL;
  335. fclose( InputLibFile );
  336. return buf_ptr;
  337. }
  338. }
  339. int read_data( FILE *fp, struct file_header *p )
  340. {
  341. return( fread( p, sizeof(*p), 1, fp ) );
  342. }
  343. int file_size( char *name ) {
  344. long eof_ftell;
  345. FILE *file;
  346. file = fopen( name, "r" );
  347. if ( file == NULL )
  348. return( 0L );
  349. fseek( file, 0L, SEEK_END );
  350. eof_ftell = ftell( file );
  351. fclose( file );
  352. return( eof_ftell );
  353. }
  354. int ReadFileBuf( char *filename, ubyte *buf, int bufsize ) {
  355. int i;
  356. int length;
  357. ubyte *tempbuf;
  358. strupr( filename );
  359. length = -1;
  360. if (CheckFile( filename )==1)
  361. return ReadFileBufRaw( filename, buf, bufsize );
  362. if (lib_flag == 1)
  363. for ( i=0; i < init_numfiles; i++ ) {
  364. if (!strcmp(LibHeaderList[i].name, filename)) {
  365. fseek( InputLibInitFile, LibHeaderList[i].offset, SEEK_SET );
  366. length = LibHeaderList[i].original_size;
  367. if ( length == bufsize )
  368. if ( LibHeaderList[i].compression == 0 ) {
  369. //printf("Reading buf size = %d\n", LibHeaderList[i].original_size);
  370. fread( buf, sizeof(ubyte), LibHeaderList[i].original_size, InputLibInitFile );
  371. }
  372. else if ( LibHeaderList[i].compression == LF_LZW ) {
  373. //MALLOC(tempbuf, ubyte, LibHeaderList[i].length);//Compile hack again -KRB
  374. tempbuf=(ubyte *)malloc( LibHeaderList[i].length*sizeof(ubyte));
  375. fread( tempbuf, sizeof(ubyte), LibHeaderList[i].length, InputLibInitFile );
  376. lzw_expand( tempbuf, buf, LibHeaderList[i].original_size );
  377. }
  378. break;
  379. }
  380. }
  381. // else
  382. // return ReadFileBufRaw( filename, buf, bufsize );
  383. if ( i >= init_numfiles )
  384. return ReadFileBufRaw( filename, buf, bufsize );
  385. return length; //buf_ptr;
  386. }
  387. ubyte *ReadFile( char *filename, int *length ) {
  388. int i;
  389. ubyte *buf_ptr;
  390. ubyte *buf;
  391. ubyte *tempbuf;
  392. strupr( filename );
  393. *length = -1;
  394. if (CheckFile( filename )==1)
  395. return ReadFileRaw( filename, length );
  396. if (lib_flag == 1)
  397. for ( i=0; i < init_numfiles; i++ ) {
  398. if (!strcmp(LibHeaderList[i].name, filename)) {
  399. fseek( InputLibInitFile, LibHeaderList[i].offset, SEEK_SET );
  400. //MALLOC(buf, ubyte, LibHeaderList[i].original_size);//Compile hack again -KRB
  401. buf=(ubyte *)malloc(LibHeaderList[i].original_size*sizeof(ubyte));
  402. buf_ptr = buf;
  403. *length = LibHeaderList[i].original_size;
  404. if ( LibHeaderList[i].compression == 0 ) {
  405. //printf("Reading buf size = %d\n", LibHeaderList[i].original_size);
  406. fread( buf, sizeof(ubyte), LibHeaderList[i].original_size, InputLibInitFile );
  407. }
  408. else if ( LibHeaderList[i].compression == LF_LZW ) {
  409. //MALLOC(tempbuf, ubyte, LibHeaderList[i].length);//Compile hack again -KRB
  410. tempbuf=(ubyte *)malloc(LibHeaderList[i].length*sizeof(ubyte));
  411. fread( tempbuf, sizeof(ubyte), LibHeaderList[i].length, InputLibInitFile );
  412. lzw_expand( tempbuf, buf, LibHeaderList[i].original_size );
  413. }
  414. break;
  415. }
  416. }
  417. //else
  418. //return ReadFileRaw( filename, length );
  419. if ( i >= init_numfiles )
  420. return ReadFileRaw( filename, length );
  421. return buf_ptr;
  422. }
  423. //returns error codes listed in cflib.h
  424. int lib_init( char *init_lib_name ) {
  425. char header_buf[5];
  426. int i;
  427. short temp;
  428. InputLibInitFile = fopen( init_lib_name, "rb" );
  429. if (! InputLibInitFile) return LI_NO_FILE;
  430. for (i=0;i<5;i++) header_buf[i]=0;
  431. for (i=0;i<4;i++)
  432. header_buf[i] = (char) getc( InputLibInitFile );
  433. if (strcmp(header_buf, "PSLB")) {
  434. fclose( InputLibInitFile );
  435. return LI_NOT_PSLIB;
  436. }
  437. //init_numfiles = (short) getc( InputLibInitFile );
  438. fread( &temp, sizeof(short), 1, InputLibInitFile );
  439. init_numfiles = temp;
  440. // MALLOC ( LibHeaderList, file_header, init_numfiles );//Compile hack again -KRB
  441. LibHeaderList=(file_header *)malloc(init_numfiles*sizeof(file_header));
  442. if (! LibHeaderList) {
  443. fclose(InputLibInitFile);
  444. return LI_NO_MEM;
  445. }
  446. fread( LibHeaderList, sizeof( *LibHeaderList ), init_numfiles, InputLibInitFile );
  447. atexit(lib_close);
  448. lib_flag = 1; //everything is ok, so mark as open
  449. return LI_NO_ERROR;
  450. }
  451. void lib_close() {
  452. fclose( InputLibInitFile );
  453. free (LibHeaderList);
  454. lib_flag = 0;
  455. }
  456. void init_library( char *filename, int numfiles ) {
  457. lib_header Lib_Header;
  458. int i;
  459. ubyte nul;
  460. short temp;
  461. OutputLibFile = fopen( filename, "wb");
  462. strcpy( Lib_Header.id, "PSLB" );
  463. Lib_Header.nfiles = numfiles;
  464. for ( i=0; i<4 ; i++ ) putc( Lib_Header.id[i], OutputLibFile );
  465. temp = Lib_Header.nfiles;
  466. //putc( Lib_Header.nfiles, OutputLibFile );
  467. temp = Lib_Header.nfiles;
  468. fwrite( &temp, sizeof(short), 1, OutputLibFile );
  469. nul = 0;
  470. for ( i=0; i<numfiles; i++ ) fwrite( &nul, sizeof(nul), 32, OutputLibFile );
  471. fclose( OutputLibFile );
  472. }
  473. void write_file_header( char *filename, file_header Header ) {
  474. OutputLibFile = fopen( filename, "rb+" );
  475. fseek( OutputLibFile, 4+sizeof(short)+32*(file_count-1), SEEK_SET );
  476. fwrite( &Header, sizeof(file_header), 1, OutputLibFile );
  477. fclose( OutputLibFile );
  478. }
  479. int CheckFile( char *filename ) {
  480. int i;
  481. int handle;
  482. strupr( filename );
  483. handle = open( filename, O_RDONLY | O_BINARY );
  484. if (handle != -1)
  485. {
  486. close( handle );
  487. return 1;
  488. }
  489. close(handle);
  490. if (lib_flag == 1)
  491. for ( i=0; i < init_numfiles; i++ )
  492. if (!strcmp(LibHeaderList[i].name, filename))
  493. return 2;
  494. return 0;
  495. }
  496. FILE * LibraryGetFileInfo( char *filename, int * others_use, int * lib_offset, int * file_size, int * org_size, int * compressed, char * buffer ) {
  497. int i;
  498. FILE * lib_file;
  499. char signature[3];
  500. strupr( filename );
  501. lib_file = fopen( filename, "rb" );
  502. if (lib_file) {
  503. if (buffer)
  504. setvbuf( lib_file, buffer, _IOFBF, 4096*2 );
  505. *file_size = filelength( fileno( lib_file ));
  506. fread( signature, 2, sizeof(char), lib_file );
  507. signature[2] = '\0';
  508. if (!strcmp( signature, "CF" )) {
  509. fread( org_size, 1, sizeof(int), lib_file );
  510. *lib_offset = 6L; // Offset is CF+Length into file
  511. *compressed = 1;
  512. } else {
  513. *org_size = *file_size;
  514. *lib_offset = 0;
  515. fseek( lib_file, 0L, SEEK_SET );
  516. *compressed = 0;
  517. }
  518. *others_use = 0;
  519. return lib_file;
  520. }
  521. if (lib_flag == 1)
  522. for ( i=0; i < init_numfiles; i++ ) {
  523. if (!strcmp(LibHeaderList[i].name, filename)) {
  524. lib_file = InputLibInitFile;
  525. *lib_offset = LibHeaderList[i].offset;
  526. *org_size = LibHeaderList[i].original_size;
  527. *file_size = LibHeaderList[i].length;
  528. *compressed = (LibHeaderList[i].compression == LF_LZW );
  529. *others_use = 1;
  530. return lib_file;
  531. }
  532. }
  533. lib_file = NULL;
  534. *others_use = 0;
  535. *lib_offset = 0;
  536. *org_size = 0;
  537. *file_size = 0;
  538. *compressed=0;
  539. return lib_file;
  540. }