1*c87b03e5Sespie /* Definitions for using a zipped' archive. 2*c87b03e5Sespie 3*c87b03e5Sespie Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 4*c87b03e5Sespie 5*c87b03e5Sespie This program is free software; you can redistribute it and/or modify 6*c87b03e5Sespie it under the terms of the GNU General Public License as published by 7*c87b03e5Sespie the Free Software Foundation; either version 2, or (at your option) 8*c87b03e5Sespie any later version. 9*c87b03e5Sespie 10*c87b03e5Sespie This program is distributed in the hope that it will be useful, 11*c87b03e5Sespie but WITHOUT ANY WARRANTY; without even the implied warranty of 12*c87b03e5Sespie MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13*c87b03e5Sespie GNU General Public License for more details. 14*c87b03e5Sespie 15*c87b03e5Sespie You should have received a copy of the GNU General Public License 16*c87b03e5Sespie along with GNU CC; see the file COPYING. If not, write to 17*c87b03e5Sespie the Free Software Foundation, 59 Temple Place - Suite 330, 18*c87b03e5Sespie Boston, MA 02111-1307, USA. 19*c87b03e5Sespie 20*c87b03e5Sespie Java and all Java-based marks are trademarks or registered trademarks 21*c87b03e5Sespie of Sun Microsystems, Inc. in the United States and other countries. 22*c87b03e5Sespie The Free Software Foundation is independent of Sun Microsystems, Inc. */ 23*c87b03e5Sespie 24*c87b03e5Sespie struct ZipFile { 25*c87b03e5Sespie char *name; 26*c87b03e5Sespie int fd; 27*c87b03e5Sespie long size; 28*c87b03e5Sespie long count; 29*c87b03e5Sespie long dir_size; 30*c87b03e5Sespie char *central_directory; 31*c87b03e5Sespie 32*c87b03e5Sespie /* Chain together in SeenZipFiles. */ 33*c87b03e5Sespie struct ZipFile *next; 34*c87b03e5Sespie }; 35*c87b03e5Sespie 36*c87b03e5Sespie typedef struct ZipFile ZipFile; 37*c87b03e5Sespie 38*c87b03e5Sespie struct ZipDirectory { 39*c87b03e5Sespie int direntry_size; 40*c87b03e5Sespie int filename_offset; 41*c87b03e5Sespie int compression_method; 42*c87b03e5Sespie unsigned size; /* length of file */ 43*c87b03e5Sespie unsigned uncompressed_size; /* length of uncompressed data */ 44*c87b03e5Sespie unsigned filestart; /* start of file in archive */ 45*c87b03e5Sespie ZipFile *zipf; 46*c87b03e5Sespie int filename_length; 47*c87b03e5Sespie /* char mid_padding[...]; */ 48*c87b03e5Sespie /* char filename[filename_length]; */ 49*c87b03e5Sespie /* char end_padding[...]; */ 50*c87b03e5Sespie }; 51*c87b03e5Sespie 52*c87b03e5Sespie typedef struct ZipDirectory ZipDirectory; 53*c87b03e5Sespie 54*c87b03e5Sespie extern struct ZipFile *SeenZipFiles; 55*c87b03e5Sespie 56*c87b03e5Sespie #define ZIPDIR_FILENAME(ZIPD) ((char*)(ZIPD)+(ZIPD)->filename_offset) 57*c87b03e5Sespie #define ZIPDIR_NEXT(ZIPD) \ 58*c87b03e5Sespie ((ZipDirectory*)((char*)(ZIPD)+(ZIPD)->direntry_size)) 59*c87b03e5Sespie #define ZIPMAGIC 0x504b0304 60*c87b03e5Sespie 61*c87b03e5Sespie extern ZipFile * opendir_in_zip PARAMS ((const char *, int)); 62*c87b03e5Sespie extern int read_zip_archive PARAMS ((ZipFile *)); 63*c87b03e5Sespie #ifdef GCC_JCF_H 64*c87b03e5Sespie extern int read_zip_member PARAMS ((JCF*, ZipDirectory*, ZipFile *)); 65*c87b03e5Sespie extern int open_in_zip PARAMS ((struct JCF *, const char *, 66*c87b03e5Sespie const char *, int)); 67*c87b03e5Sespie #endif 68