- header = start_header (p, &hstat);
- if (header == NULL)
- {
- critical_error = 1;
- goto badfile;
- }
- header->header.linkflag = LF_SPARSE;
- header_moved++;
-
- /*
- * Call the routine that figures out the
- * layout of the sparse file in question.
- * UPPERBOUND is the index of the last
- * element of the "sparsearray," i.e.,
- * the number of elements it needed to
- * describe the file.
- */
-
- upperbound = deal_with_sparse (p, header);
-
- /*
- * See if we'll need an extended header
- * later
- */
- if (upperbound > SPARSE_IN_HDR - 1)
- header->header.isextended++;
- /*
- * We store the "real" file size so
- * we can show that in case someone wants
- * to list the archive, i.e., tar tvf <file>.
- * It might be kind of disconcerting if the
- * shrunken file size was the one that showed
- * up.
- */
- to_oct ((long) hstat.st_size, 1 + 12,
- header->header.realsize);
-
- /*
- * This will be the new "size" of the
- * file, i.e., the size of the file
- * minus the records of holes that we're
- * skipping over.
- */
-
- find_new_file_size (&filesize, upperbound);
- hstat.st_size = filesize;
- to_oct ((long) filesize, 1 + 12,
- header->header.size);
- /* to_oct((long) end_nulls, 1+12,
- header->header.ending_blanks);*/
-
- for (i = 0; i < SPARSE_IN_HDR; i++)
- {
- if (!sparsearray[i].numbytes)
- break;
- to_oct (sparsearray[i].offset, 1 + 12,
- header->header.sp[i].offset);
- to_oct (sparsearray[i].numbytes, 1 + 12,
- header->header.sp[i].numbytes);
- }