219 |
mateuszvis |
1 |
/*
|
|
|
2 |
* This file is part of the FDNPKG project
|
|
|
3 |
* http://fdnpkg.sourceforge.net
|
|
|
4 |
*
|
|
|
5 |
* Copyright (C) 2012-2016 Mateusz Viste. All rights reserved.
|
|
|
6 |
*
|
|
|
7 |
* Simple library providing functions to unzip files from zip archives.
|
|
|
8 |
*/
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
#ifndef libunzip_sentinel
|
|
|
12 |
#define libunzip_sentinel
|
|
|
13 |
|
|
|
14 |
#include <time.h> /* required for the time_t definition */
|
|
|
15 |
|
|
|
16 |
#define ZIP_FLAG_ISADIR 1
|
|
|
17 |
#define ZIP_FLAG_ENCRYPTED 2
|
|
|
18 |
|
|
|
19 |
struct ziplist {
|
|
|
20 |
long filelen;
|
|
|
21 |
long compressedfilelen;
|
|
|
22 |
unsigned long crc32;
|
|
|
23 |
long dataoffset; /* offset in the file where compressed data starts */
|
|
|
24 |
struct ziplist *nextfile;
|
|
|
25 |
time_t timestamp; /* the timestamp of the file */
|
|
|
26 |
short compmethod;
|
|
|
27 |
unsigned char flags; /* zero for files, non-zero for directories */
|
|
|
28 |
char filename[1]; /* must be last element (gets expanded at runtime) */
|
|
|
29 |
};
|
|
|
30 |
|
|
|
31 |
struct ziplist *zip_listfiles(FILE *fd);
|
|
|
32 |
int zip_unzip(FILE *zipfd, struct ziplist *curzipnode, char *fulldestfilename);
|
|
|
33 |
void zip_freelist(struct ziplist **ziplist);
|
|
|
34 |
|
|
|
35 |
#endif
|