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