comparison netinstall/tar.cc @ 452:3d3049ae1304 r21-2-41

Import from CVS: tag r21-2-41
author cvs
date Mon, 13 Aug 2007 11:40:21 +0200
parents 3078fd1074e8
children
comparison
equal deleted inserted replaced
451:8ad70c5cd5d7 452:3d3049ae1304
114 } 114 }
115 err = 0; 115 err = 0;
116 return g ? 0 : 1; 116 return g ? 0 : 1;
117 } 117 }
118 118
119 /* For some reason the cygwin version uses a function that is not in
120 the original source. We duplicate it here - although this does mean
121 revealing some internals. */
122 extern "C" {
123 z_off_t ZEXPORT tar_gzctell (gzFile file);
124 typedef struct gz_stream {
125 z_stream stream;
126 int z_err; /* error code for last stream operation */
127 int z_eof; /* set if end of input file */
128 FILE *file; /* .gz file */
129 Byte *inbuf; /* input buffer */
130 Byte *outbuf; /* output buffer */
131 uLong crc; /* crc32 of uncompressed data */
132 char *msg; /* error message */
133 char *path; /* path name for debugging only */
134 int transparent; /* 1 if input file is not a .gz file */
135 char mode; /* 'w' or 'r' */
136 long startpos; /* start of compressed data in file (header skipped) */
137 } gz_stream;
138 };
139
140 z_off_t ZEXPORT tar_gzctell (gzFile file)
141 {
142 gz_stream *s = (gz_stream *)file;
143 return ftell(s->file);
144 }
145
119 int 146 int
120 tar_ftell () 147 tar_ftell ()
121 { 148 {
122 return gztell (g); 149 return tar_gzctell (g);
123 } 150 }
124 151
125 static void 152 static void
126 skip_file () 153 skip_file ()
127 { 154 {
480 map[j] = mtemp; 507 map[j] = mtemp;
481 } 508 }
482 509
483 if ((tar_open (pathname))) 510 if ((tar_open (pathname)))
484 return 1; 511 return 1;
485 while (c = tar_next_file ()) 512 while ((c = tar_next_file ()))
486 { 513 {
487 int l = strlen (c); 514 int l = strlen (c);
488 for (i=0; i<nmaps; i++) 515 for (i=0; i<nmaps; i++)
489 if (l >= map[i].from_len 516 if (l >= map[i].from_len
490 && strncmp (c, map[i].from, map[i].from_len) == 0) 517 && strncmp (c, map[i].from, map[i].from_len) == 0)