247 char filename_inzip[256];
248 char* filename_withoutpath;
261 printf(
"error %d with zipfile in unzGetCurrentFileInfo\n",err);
266 buf = (
void*)malloc(size_buf);
269 printf(
"Error allocating memory\n");
273 p = filename_withoutpath = filename_inzip;
276 if (((*p)==
'/') || ((*p)==
'\\'))
277 filename_withoutpath = p+1;
281 if ((*filename_withoutpath)==
'\0')
283 if ((*popt_extract_without_path)==0)
285 printf(
"creating directory: %s\n",filename_inzip);
291 const char* write_filename;
294 if ((*popt_extract_without_path)==0)
295 write_filename = filename_inzip;
297 write_filename = filename_withoutpath;
302 printf(
"error %d with zipfile in unzOpenCurrentFilePassword\n",err);
305 if (((*popt_overwrite)==0) && (err==
UNZ_OK))
309 ftestexist = fopen(write_filename,
"rb");
310 if (ftestexist!=NULL)
318 printf(
"The file %s exists. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename);
319 ret = scanf(
"%1s",answer);
325 if ((rep>=
'a') && (rep<=
'z'))
328 while ((rep!=
'Y') && (rep!=
'N') && (rep!=
'A'));
338 if ((skip==0) && (err==
UNZ_OK))
340 fout=fopen(write_filename,
"wb");
343 if ((fout==NULL) && ((*popt_extract_without_path)==0) &&
344 (filename_withoutpath!=(
char*)filename_inzip))
346 char c=*(filename_withoutpath-1);
347 *(filename_withoutpath-1)=
'\0';
349 *(filename_withoutpath-1)=c;
350 fout=fopen(write_filename,
"wb");
355 printf(
"error opening %s\n",write_filename);
361 printf(
" extracting: %s\n",write_filename);
368 printf(
"error %d with zipfile in unzReadCurrentFile\n",err);
372 if (fwrite(buf,err,1,fout)!=1)
374 printf(
"error in writing extracted file\n");
393 printf(
"error %d with zipfile in unzCloseCurrentFile\n",err);
#define UNZ_INTERNALERROR
int makedir(char *newdir)
typedef uLong(ZCALLBACK *read_file_func) OF((voidpf opaque
int ZEXPORT unzOpenCurrentFilePassword(unzFile file, const char *password)
int mymkdir(char *dirname) const
int ZEXPORT unzGetCurrentFileInfo(unzFile file, unz_file_info *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
int ZEXPORT unzCloseCurrentFile(unzFile file)
int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len)
void change_file_date(char *filename, uLong dosdate, tm_unz tmu_date) const