Subversion Repositories SvarDOS

Rev

Rev 295 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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