+/* Extract a file from the archive. */
+void
+extract_archive (void)
+{
+ char typeflag;
+ tar_extractor_t fun;
+
+ fatal_exit_hook = extract_finish;
+
+ set_next_block_after (current_header);
+
+ if (!current_stat_info.file_name[0]
+ || (interactive_option
+ && !confirm ("extract", current_stat_info.file_name)))
+ {
+ skip_member ();
+ return;
+ }
+
+ /* Print the block from current_header and current_stat. */
+ if (verbose_option)
+ print_header (¤t_stat_info, current_header, -1);
+
+ /* Restore stats for all non-ancestor directories, unless
+ it is an incremental archive.
+ (see NOTICE in the comment to delay_set_stat above) */
+ if (!delay_directory_restore_option)
+ {
+ int dir = chdir_current;
+ apply_nonancestor_delayed_set_stat (current_stat_info.file_name, 0);
+ chdir_do (dir);
+ }
+
+ /* Take a safety backup of a previously existing file. */
+
+ if (backup_option)
+ if (!maybe_backup_file (current_stat_info.file_name, 0))
+ {
+ int e = errno;
+ ERROR ((0, e, _("%s: Was unable to backup this file"),
+ quotearg_colon (current_stat_info.file_name)));
+ skip_member ();
+ return;
+ }
+
+ /* Extract the archive entry according to its type. */
+ /* KLUDGE */
+ typeflag = sparse_member_p (¤t_stat_info) ?
+ GNUTYPE_SPARSE : current_header->header.typeflag;
+
+ if (prepare_to_extract (current_stat_info.file_name, typeflag, &fun))
+ {
+ if (fun && (*fun) (current_stat_info.file_name, typeflag)
+ && backup_option)
+ undo_last_backup ();
+ }
+ else
+ skip_member ();
+
+}
+
+/* Extract the links whose final extraction were delayed. */