]> Dogcows Code - chaz/tar/commitdiff
Minor changes
authorSergey Poznyakoff <gray@gnu.org.ua>
Mon, 17 Nov 2003 07:38:37 +0000 (07:38 +0000)
committerSergey Poznyakoff <gray@gnu.org.ua>
Mon, 17 Nov 2003 07:38:37 +0000 (07:38 +0000)
src/buffer.c
src/list.c
src/tar.c

index f451413e8e8d61703e644e3153401ecc6f329b1a..b735dca1858a38d5670864bb19f8964d1ac6125c 100644 (file)
@@ -266,7 +266,7 @@ open_archive (enum access_mode wanted_access)
   if (archive_names == 0)
     FATAL_ERROR ((0, 0, _("No archive name given")));
 
-  destroy_stat (&current_stat_info);
+  tar_stat_destroy (&current_stat_info);
   save_name = 0;
   real_s_name = 0;
 
@@ -420,7 +420,7 @@ open_archive (enum access_mode wanted_access)
 
          record_start->header.typeflag = GNUTYPE_VOLHDR;
          TIME_TO_CHARS (start_time, record_start->header.mtime);
-         finish_header (record_start, -1);
+         finish_header (&current_stat_info, record_start, -1);
 #if 0
          current_block++;
 #endif
@@ -512,7 +512,7 @@ flush_write (void)
               volume_label_option, volno);
       TIME_TO_CHARS (start_time, record_start->header.mtime);
       record_start->header.typeflag = GNUTYPE_VOLHDR;
-      finish_header (record_start, -1);
+      finish_header (&current_stat_info, record_start, -1);
     }
 
   if (real_s_name)
@@ -535,7 +535,7 @@ flush_write (void)
                    record_start->oldgnu_header.offset);
       tmp = verbose_option;
       verbose_option = 0;
-      finish_header (record_start, -1);
+      finish_header (&current_stat_info, record_start, -1);
       verbose_option = tmp;
 
       if (volume_label_option)
@@ -913,7 +913,7 @@ close_archive (void)
 
   sys_wait_for_child (child_pid);
   
-  destroy_stat (&current_stat_info);
+  tar_stat_destroy (&current_stat_info);
   if (save_name)
     free (save_name);
   if (real_s_name)
index d23002beaa64cf6c49badb1bd87c9ba389980b93..0c8095e4d991dcd426c221c52eba8c2a72e8f769 100644 (file)
@@ -76,7 +76,7 @@ read_and (void (*do_something) (void))
   do
     {
       prev_status = status;
-      destroy_stat (&current_stat_info);
+      tar_stat_destroy (&current_stat_info);
       xheader_destroy (&extended_header);
       
       status = read_header (false);
@@ -185,7 +185,7 @@ list_archive (void)
 
   decode_header (current_header, &current_stat_info, &current_format, 0);
   if (verbose_option)
-    print_header (-1);
+    print_header (&current_stat_info, -1);
 
   if (incremental_option && current_header->header.typeflag == GNUTYPE_DUMPDIR)
     {
@@ -933,11 +933,11 @@ static int ugswidth = UGSWIDTH;   /* maximum width encountered so far */
 #endif
 
 void
-print_header (off_t block_ordinal)
+print_header (struct tar_stat_info *st, off_t block_ordinal)
 {
   char modes[11];
   char const *time_stamp;
-  char *temp_name = current_stat_info.orig_file_name ? current_stat_info.orig_file_name : current_stat_info.file_name;
+  char *temp_name = st->orig_file_name ? st->orig_file_name : st->file_name;
   
   /* These hold formatted ints.  */
   char uform[UINTMAX_STRSIZE_BOUND], gform[UINTMAX_STRSIZE_BOUND];
@@ -1021,17 +1021,17 @@ print_header (off_t block_ordinal)
          break;
        }
 
-      decode_mode (current_stat_info.stat.st_mode, modes + 1);
+      decode_mode (st->stat.st_mode, modes + 1);
 
       /* Time stamp.  */
 
-      time_stamp = tartime (current_stat_info.stat.st_mtime);
+      time_stamp = tartime (st->stat.st_mtime);
 
       /* User and group names.  */
 
-      if (current_stat_info.uname && current_format != V7_FORMAT
+      if (st->uname && current_format != V7_FORMAT
          && !numeric_owner_option)
-       user = current_stat_info.uname;
+       user = st->uname;
       else
        {
          /* Try parsing it as an unsigned integer first, and as a
@@ -1051,9 +1051,9 @@ print_header (off_t block_ordinal)
            }
        }
 
-      if (current_stat_info.gname && current_format != V7_FORMAT
+      if (st->gname && current_format != V7_FORMAT
          && !numeric_owner_option)
-       group = current_stat_info.gname;
+       group = st->gname;
       else
        {
          /* Try parsing it as an unsigned integer first, and as a
@@ -1080,10 +1080,10 @@ print_header (off_t block_ordinal)
        case CHRTYPE:
        case BLKTYPE:
          strcpy (size,
-                 STRINGIFY_BIGINT (major (current_stat_info.stat.st_rdev), uintbuf));
+                 STRINGIFY_BIGINT (major (st->stat.st_rdev), uintbuf));
          strcat (size, ",");
          strcat (size,
-                 STRINGIFY_BIGINT (minor (current_stat_info.stat.st_rdev), uintbuf));
+                 STRINGIFY_BIGINT (minor (st->stat.st_rdev), uintbuf));
          break;
        case GNUTYPE_SPARSE:
          strcpy (size,
@@ -1093,7 +1093,7 @@ print_header (off_t block_ordinal)
                   uintbuf));
          break;
        default:
-         strcpy (size, STRINGIFY_BIGINT (current_stat_info.stat.st_size, uintbuf));
+         strcpy (size, STRINGIFY_BIGINT (st->stat.st_size, uintbuf));
          break;
        }
 
@@ -1111,11 +1111,11 @@ print_header (off_t block_ordinal)
       switch (current_header->header.typeflag)
        {
        case SYMTYPE:
-         fprintf (stdlis, " -> %s\n", quotearg (current_stat_info.link_name));
+         fprintf (stdlis, " -> %s\n", quotearg (st->link_name));
          break;
 
        case LNKTYPE:
-         fprintf (stdlis, _(" link to %s\n"), quotearg (current_stat_info.link_name));
+         fprintf (stdlis, _(" link to %s\n"), quotearg (st->link_name));
          break;
 
        default:
index 3d169e3bb368285dd9a7c899c74bc25e4a4b959b..33616d017220acdb069e545a39efdfb3959b3ca2 100644 (file)
--- a/src/tar.c
+++ b/src/tar.c
@@ -1510,13 +1510,20 @@ main (int argc, char **argv)
 }
 
 void
-destroy_stat (struct tar_stat_info *st)
+tar_stat_init (struct tar_stat_info *st)
+{
+  memset (st, 0, sizeof (*st));
+}
+     
+void
+tar_stat_destroy (struct tar_stat_info *st)
 {
   free (st->orig_file_name);
   free (st->file_name);
   free (st->link_name);
   free (st->uname);
   free (st->gname);
+  free (st->sparse_map);
   memset (st, 0, sizeof (*st));
 }
 
This page took 0.032717 seconds and 4 git commands to generate.