263 FILE *outfile =
NULL;
276 error(
"gzread: incomplete block read");
281 if (getheader == 1) {
287 if ((len == 0) || (
buffer.header.name[0]== 0))
break;
291 if ((fname[strlen(fname)-1] !=
'/') && (fname[strlen(fname)-1] !=
'\\'))
293 strcat(fname,
buffer.header.name);
295 switch (
buffer.header.typeflag) {
303 outfile = fopen(fname,
"wb");
304 if (outfile ==
NULL) {
306 char *p = strrchr(fname,
'/');
311 outfile = fopen(fname,
"wb");
326 getheader = (remaining) ? 0 : 1;
335 if (outfile !=
NULL) {
336 if (fwrite(&
buffer,
sizeof(
char),bytes,outfile) != bytes) {
337 fprintf(stderr,
"%s : error writing %s skipping...\n",
prog,fname);
343 if (remaining == 0) {
345 if (outfile !=
NULL) {
348 FILETIME ftm,ftLocal;
354 localt = *localtime(&tartime);
356 hFile = CreateFile(fname, GENERIC_READ | GENERIC_WRITE,
359 st.wYear = (WORD)localt.tm_year+1900;
360 st.wMonth = (WORD)localt.tm_mon;
361 st.wDayOfWeek = (WORD)localt.tm_wday;
362 st.wDay = (WORD)localt.tm_mday;
363 st.wHour = (WORD)localt.tm_hour;
364 st.wMinute = (WORD)localt.tm_min;
365 st.wSecond = (WORD)localt.tm_sec;
366 st.wMilliseconds = 0;
367 SystemTimeToFileTime(&st,&ftLocal);
368 LocalFileTimeToFileTime(&ftLocal,&ftm);
369 SetFileTime(hFile,&ftm,
NULL,&ftm);
374 struct utimbuf settime;
376 settime.actime = settime.modtime = tartime;
380 utime(fname,&settime);
int makedir(char *newdir)
void error(const char *msg)
const char *ZEXPORT gzerror(gzFile file, int *errnum)
int getoct(char *p, int width)
int ZEXPORT gzread(gzFile file, voidp buf, unsigned len)