- method = (int)get_byte();
- if (method != DEFLATED) {
- fprintf(stderr,
- "%s: %s: unknown method %d -- not supported\n",
- program_name, ifname, method);
- exit_code = ERROR;
- return -1;
- }
- work = unzip;
- flags = (uch)get_byte();
-
- if ((flags & ENCRYPTED) != 0) {
- fprintf(stderr,
- "%s: %s is encrypted -- not supported\n",
- program_name, ifname);
- exit_code = ERROR;
- return -1;
- }
- if ((flags & CONTINUATION) != 0) {
- fprintf(stderr,
- "%s: %s is a multi-part gzip file -- not supported\n",
- program_name, ifname);
- exit_code = ERROR;
- if (force <= 1) return -1;
- }
- if ((flags & RESERVED) != 0) {
- fprintf(stderr,
- "%s: %s has flags 0x%x -- not supported\n",
- program_name, ifname, flags);
- exit_code = ERROR;
- if (force <= 1) return -1;
- }
- stamp = (ulg)get_byte();
- stamp |= ((ulg)get_byte()) << 8;
- stamp |= ((ulg)get_byte()) << 16;
- stamp |= ((ulg)get_byte()) << 24;
- if (stamp != 0 && !no_time)
- {
- time_stamp.tv_sec = stamp;
- time_stamp.tv_nsec = 0;
- }
-
- (void)get_byte(); /* Ignore extra flags for the moment */
- (void)get_byte(); /* Ignore OS type for the moment */
-
- if ((flags & CONTINUATION) != 0) {
- unsigned part = (unsigned)get_byte();
- part |= ((unsigned)get_byte())<<8;
- if (verbose) {
- fprintf(stderr,"%s: %s: part number %u\n",
- program_name, ifname, part);
- }
- }
- if ((flags & EXTRA_FIELD) != 0) {
- unsigned len = (unsigned)get_byte();
- len |= ((unsigned)get_byte())<<8;
- if (verbose) {
- fprintf(stderr,"%s: %s: extra field of %u bytes ignored\n",
- program_name, ifname, len);
- }
- while (len--) (void)get_byte();
- }
-
- /* Get original file name if it was truncated */
- if ((flags & ORIG_NAME) != 0) {
- if (no_name || (to_stdout && !list) || part_nb > 1) {
- /* Discard the old name */
- char c; /* dummy used for NeXTstep 3.0 cc optimizer bug */
- do {c=get_byte();} while (c != 0);
- } else {
- /* Copy the base name. Keep a directory prefix intact. */
+ method = (int)get_byte();
+ if (method != DEFLATED) {
+ fprintf(stderr,
+ "%s: %s: unknown method %d -- not supported\n",
+ program_name, ifname, method);
+ exit_code = ERROR;
+ return -1;
+ }
+ work = unzip;
+ flags = (uch)get_byte();
+
+ if ((flags & ENCRYPTED) != 0) {
+ fprintf(stderr,
+ "%s: %s is encrypted -- not supported\n",
+ program_name, ifname);
+ exit_code = ERROR;
+ return -1;
+ }
+ if ((flags & RESERVED) != 0) {
+ fprintf(stderr,
+ "%s: %s has flags 0x%x -- not supported\n",
+ program_name, ifname, flags);
+ exit_code = ERROR;
+ if (force <= 1) return -1;
+ }
+ stamp = (ulg)get_byte();
+ stamp |= ((ulg)get_byte()) << 8;
+ stamp |= ((ulg)get_byte()) << 16;
+ stamp |= ((ulg)get_byte()) << 24;
+ if (stamp != 0 && !no_time)
+ {
+ time_stamp.tv_sec = stamp;
+ time_stamp.tv_nsec = 0;
+ }
+
+ magic[8] = get_byte (); /* Ignore extra flags. */
+ magic[9] = get_byte (); /* Ignore OS type. */
+
+ if (flags & HEADER_CRC)
+ {
+ magic[2] = DEFLATED;
+ magic[3] = flags;
+ magic[4] = stamp & 0xff;
+ magic[5] = (stamp >> 8) & 0xff;
+ magic[6] = (stamp >> 16) & 0xff;
+ magic[7] = stamp >> 24;
+ updcrc (NULL, 0);
+ updcrc (magic, 10);
+ }
+
+ if ((flags & EXTRA_FIELD) != 0) {
+ uch lenbuf[2];
+ unsigned int len = lenbuf[0] = get_byte ();
+ len |= (lenbuf[1] = get_byte ()) << 8;
+ if (verbose) {
+ fprintf(stderr,"%s: %s: extra field of %u bytes ignored\n",
+ program_name, ifname, len);
+ }
+ if (flags & HEADER_CRC)
+ updcrc (lenbuf, 2);
+ discard_input_bytes (len, flags);
+ }
+
+ /* Get original file name if it was truncated */
+ if ((flags & ORIG_NAME) != 0) {
+ if (no_name || (to_stdout && !list) || part_nb > 1) {
+ /* Discard the old name */
+ discard_input_bytes (-1, flags);
+ } else {
+ /* Copy the base name. Keep a directory prefix intact. */