Browse Source

Remove some lint, found by gcc -W etc.

* src/common.h (label_notfound): New decl.
* src/buffer.c (set_volume_start_time, compress_type):
(guess_seekable_archive, open_compressed_archive, init_buffer):
(_flush_write, archive_is-dev, increase_volume_number):
(change_tape_menu, try_new_volume, add_chunk_header):
(multi_volume_sync):
Declare as 'static' if it's not exported.
Use function prototype (void) rather than old-style ().
* src/checkpoint.c (expand_checkpoint_string): Likewise.
* src/incremen.c (dirlist_replace_prefix, makedumpdir, read_incr_db_2):
Likewise.
* src/list.c (print_volume_label): Likewise.
* src/misc.c (normalize_filename_x): Likewise.
* src/names.c (make_name, free_name, check_name_alloc, name_next_elt):
Likewise.
* src/tar.c (tar_list_quoting_style, add_exclude_array):
(set_stat_signal): Likewise.
* src/transform.c (new_transform, _single_transform_name_to_obstack):
(_transform_name_to_obstack): Likewise.
* src/unlink.c (dunlink_alloc): Likewise.

* src/buffer.c (struct zip_magic): Use const when appropriate.
* src/incremen.c (obstack_code_rename, write_directory_file_entry):
Likewise.
* src/sparse.c (COPY_STRING): Likewise.
* src/system.c (dec_to_env, time_to_env, oct_to_env, str_to_env):
(chr_to_env): Likewise.
* src/tar.c (tar_list_quoting_style, set_stat_signal): Likewise.

* src/extract.c (extract_node): Don't return garbage.

* src/names.c: Remove old-style declarations of getgrnam etc.
All modern systems declare these, and it's not worth the hassle
of ignoring the warnings on modern systems for old-style decls.
Paul Eggert 15 years ago
parent
commit
f6edb92580
13 changed files with 394 additions and 406 deletions
  1. 47 47
      src/buffer.c
  2. 12 13
      src/checkpoint.c
  3. 5 5
      src/common.h
  4. 14 15
      src/extract.c
  5. 25 25
      src/incremen.c
  6. 12 12
      src/list.c
  7. 5 6
      src/misc.c
  8. 23 32
      src/names.c
  9. 24 24
      src/sparse.c
  10. 13 13
      src/system.c
  11. 166 166
      src/tar.c
  12. 43 43
      src/transform.c
  13. 5 5
      src/unlink.c

+ 47 - 47
src/buffer.c

@@ -54,7 +54,7 @@ enum access_mode access_mode;   /* how do we handle the archive */
 off_t records_read;             /* number of records read from this archive */
 off_t records_read;             /* number of records read from this archive */
 off_t records_written;          /* likewise, for records written */
 off_t records_written;          /* likewise, for records written */
 extern off_t records_skipped;   /* number of records skipped at the start
 extern off_t records_skipped;   /* number of records skipped at the start
-                                   of the archive, defined in delete.c */   
+                                   of the archive, defined in delete.c */
 
 
 static off_t record_start_block; /* block ordinal at record_start */
 static off_t record_start_block; /* block ordinal at record_start */
 
 
@@ -175,8 +175,8 @@ set_start_time ()
   last_stat_time = start_time;
   last_stat_time = start_time;
 }
 }
 
 
-void
-set_volume_start_time ()
+static void
+set_volume_start_time (void)
 {
 {
   gettime (&volume_start_time);
   gettime (&volume_start_time);
   last_stat_time = volume_start_time;
   last_stat_time = volume_start_time;
@@ -211,9 +211,9 @@ struct zip_magic
 {
 {
   enum compress_type type;
   enum compress_type type;
   size_t length;
   size_t length;
-  char *magic;
-  char *program;
-  char *option;
+  char const *magic;
+  char const *program;
+  char const *option;
 };
 };
 
 
 static struct zip_magic const magic[] = {
 static struct zip_magic const magic[] = {
@@ -234,7 +234,7 @@ static struct zip_magic const magic[] = {
 #define compress_program(t) magic[t].program
 #define compress_program(t) magic[t].program
 
 
 /* Check if the file ARCHIVE is a compressed archive. */
 /* Check if the file ARCHIVE is a compressed archive. */
-enum compress_type
+static enum compress_type
 check_compressed_archive (bool *pshort)
 check_compressed_archive (bool *pshort)
 {
 {
   struct zip_magic const *p;
   struct zip_magic const *p;
@@ -243,14 +243,14 @@ check_compressed_archive (bool *pshort)
 
 
   if (!pshort)
   if (!pshort)
     pshort = &temp;
     pshort = &temp;
-  
+
   /* Prepare global data needed for find_next_block: */
   /* Prepare global data needed for find_next_block: */
   record_end = record_start; /* set up for 1st record = # 0 */
   record_end = record_start; /* set up for 1st record = # 0 */
   sfr = read_full_records;
   sfr = read_full_records;
   read_full_records = true; /* Suppress fatal error on reading a partial
   read_full_records = true; /* Suppress fatal error on reading a partial
                                record */
                                record */
   *pshort = find_next_block () == 0;
   *pshort = find_next_block () == 0;
-  
+
   /* Restore global values */
   /* Restore global values */
   read_full_records = sfr;
   read_full_records = sfr;
 
 
@@ -267,7 +267,7 @@ check_compressed_archive (bool *pshort)
 
 
 /* Guess if the archive is seekable. */
 /* Guess if the archive is seekable. */
 static void
 static void
-guess_seekable_archive ()
+guess_seekable_archive (void)
 {
 {
   struct stat st;
   struct stat st;
 
 
@@ -288,7 +288,7 @@ guess_seekable_archive ()
       seekable_archive = !!seek_option;
       seekable_archive = !!seek_option;
       return;
       return;
     }
     }
-  
+
   if (!multi_volume_option && !use_compress_program_option
   if (!multi_volume_option && !use_compress_program_option
       && fstat (archive, &st) == 0)
       && fstat (archive, &st) == 0)
     seekable_archive = S_ISREG (st.st_mode);
     seekable_archive = S_ISREG (st.st_mode);
@@ -299,8 +299,8 @@ guess_seekable_archive ()
 /* Open an archive named archive_name_array[0]. Detect if it is
 /* Open an archive named archive_name_array[0]. Detect if it is
    a compressed archive of known type and use corresponding decompression
    a compressed archive of known type and use corresponding decompression
    program if so */
    program if so */
-int
-open_compressed_archive ()
+static int
+open_compressed_archive (void)
 {
 {
   archive = rmtopen (archive_name_array[0], O_RDONLY | O_BINARY,
   archive = rmtopen (archive_name_array[0], O_RDONLY | O_BINARY,
                      MODE_RW, rsh_command_option);
                      MODE_RW, rsh_command_option);
@@ -320,7 +320,7 @@ open_compressed_archive ()
               if (shortfile)
               if (shortfile)
                 ERROR ((0, 0, _("This does not look like a tar archive")));
                 ERROR ((0, 0, _("This does not look like a tar archive")));
               return archive;
               return archive;
-      
+
             case ct_none:
             case ct_none:
               if (shortfile)
               if (shortfile)
                 ERROR ((0, 0, _("This does not look like a tar archive")));
                 ERROR ((0, 0, _("This does not look like a tar archive")));
@@ -334,10 +334,10 @@ open_compressed_archive ()
               break;
               break;
             }
             }
         }
         }
-      
+
       /* FD is not needed any more */
       /* FD is not needed any more */
       rmtclose (archive);
       rmtclose (archive);
-      
+
       hit_eof = false; /* It might have been set by find_next_block in
       hit_eof = false; /* It might have been set by find_next_block in
                           check_compressed_archive */
                           check_compressed_archive */
 
 
@@ -486,7 +486,7 @@ xclose (int fd)
 }
 }
 
 
 static void
 static void
-init_buffer ()
+init_buffer (void)
 {
 {
   if (! record_buffer_aligned[record_index])
   if (! record_buffer_aligned[record_index])
     record_buffer_aligned[record_index] =
     record_buffer_aligned[record_index] =
@@ -657,7 +657,7 @@ _open_archive (enum access_mode wanted_access)
 }
 }
 
 
 /* Perform a write to flush the buffer.  */
 /* Perform a write to flush the buffer.  */
-ssize_t
+static ssize_t
 _flush_write (void)
 _flush_write (void)
 {
 {
   ssize_t status;
   ssize_t status;
@@ -672,7 +672,7 @@ _flush_write (void)
     status = record_size;
     status = record_size;
   else
   else
     status = sys_write_archive_buffer ();
     status = sys_write_archive_buffer ();
-  
+
   return status;
   return status;
 }
 }
 
 
@@ -713,7 +713,7 @@ archive_read_error (void)
 }
 }
 
 
 static bool
 static bool
-archive_is_dev ()
+archive_is_dev (void)
 {
 {
   struct stat st;
   struct stat st;
 
 
@@ -861,7 +861,7 @@ seek_archive (off_t size)
 
 
   if (size <= skipped)
   if (size <= skipped)
     return 0;
     return 0;
-  
+
   /* Compute number of records to skip */
   /* Compute number of records to skip */
   nrec = (size - skipped) / record_size;
   nrec = (size - skipped) / record_size;
   if (nrec == 0)
   if (nrec == 0)
@@ -956,7 +956,7 @@ closeout_volume_number (void)
 
 
 
 
 static void
 static void
-increase_volume_number ()
+increase_volume_number (void)
 {
 {
   global_volno++;
   global_volno++;
   if (global_volno < 0)
   if (global_volno < 0)
@@ -964,13 +964,13 @@ increase_volume_number ()
   volno++;
   volno++;
 }
 }
 
 
-void
+static void
 change_tape_menu (FILE *read_file)
 change_tape_menu (FILE *read_file)
 {
 {
   char *input_buffer = NULL;
   char *input_buffer = NULL;
   size_t size = 0;
   size_t size = 0;
   bool stop = false;
   bool stop = false;
-  
+
   while (!stop)
   while (!stop)
     {
     {
       fputc ('\007', stderr);
       fputc ('\007', stderr);
@@ -1088,7 +1088,7 @@ new_volume (enum access_mode mode)
   assign_string (&continued_file_name, NULL);
   assign_string (&continued_file_name, NULL);
   continued_file_size = continued_file_offset = 0;
   continued_file_size = continued_file_offset = 0;
   current_block = record_start;
   current_block = record_start;
-  
+
   if (rmtclose (archive) != 0)
   if (rmtclose (archive) != 0)
     close_error (*archive_name_cursor);
     close_error (*archive_name_cursor);
 
 
@@ -1177,13 +1177,13 @@ read_header0 (struct tar_stat_info *info)
   return false;
   return false;
 }
 }
 
 
-bool
-try_new_volume ()
+static bool
+try_new_volume (void)
 {
 {
   size_t status;
   size_t status;
   union block *header;
   union block *header;
   enum access_mode acc;
   enum access_mode acc;
-  
+
   switch (subcommand_option)
   switch (subcommand_option)
     {
     {
     case APPEND_SUBCOMMAND:
     case APPEND_SUBCOMMAND:
@@ -1199,7 +1199,7 @@ try_new_volume ()
 
 
   if (!new_volume (acc))
   if (!new_volume (acc))
     return true;
     return true;
-  
+
   while ((status = rmtread (archive, record_start->buffer, record_size))
   while ((status = rmtread (archive, record_start->buffer, record_size))
          == SAFE_READ_ERROR)
          == SAFE_READ_ERROR)
     archive_read_error ();
     archive_read_error ();
@@ -1222,10 +1222,10 @@ try_new_volume ()
 	    ERROR ((0, 0, _("This does not look like a tar archive")));
 	    ERROR ((0, 0, _("This does not look like a tar archive")));
 	    return false;
 	    return false;
 	  }
 	  }
-	
+
         xheader_decode (&dummy); /* decodes values from the global header */
         xheader_decode (&dummy); /* decodes values from the global header */
         tar_stat_destroy (&dummy);
         tar_stat_destroy (&dummy);
-	
+
 	/* The initial global header must be immediately followed by
 	/* The initial global header must be immediately followed by
 	   an extended PAX header for the first member in this volume.
 	   an extended PAX header for the first member in this volume.
 	   However, in some cases tar may split volumes in the middle
 	   However, in some cases tar may split volumes in the middle
@@ -1237,7 +1237,7 @@ try_new_volume ()
 	   HEADER_FAILURE, which is ignored.
 	   HEADER_FAILURE, which is ignored.
 
 
 	   See also tests/multiv07.at */
 	   See also tests/multiv07.at */
-	       
+
 	switch (read_header (&header, &dummy, read_header_auto))
 	switch (read_header (&header, &dummy, read_header_auto))
 	  {
 	  {
 	  case HEADER_SUCCESS:
 	  case HEADER_SUCCESS:
@@ -1327,7 +1327,7 @@ try_new_volume ()
                  STRINGIFY_BIGINT (real_s_totsize, totsizebuf),
                  STRINGIFY_BIGINT (real_s_totsize, totsizebuf),
                  STRINGIFY_BIGINT (real_s_sizeleft, s1buf),
                  STRINGIFY_BIGINT (real_s_sizeleft, s1buf),
                  STRINGIFY_BIGINT (continued_file_offset, s2buf)));
                  STRINGIFY_BIGINT (continued_file_offset, s2buf)));
-         
+
           return false;
           return false;
         }
         }
     }
     }
@@ -1348,7 +1348,7 @@ drop_volume_label_suffix (const char *label)
 
 
   if (len < 1)
   if (len < 1)
     return NULL;
     return NULL;
-  
+
   for (p = label + len - 1; p > label && isdigit ((unsigned char) *p); p--)
   for (p = label + len - 1; p > label && isdigit ((unsigned char) *p); p--)
     ;
     ;
   if (p > label && p - (VOLUME_TEXT_LEN - 1) > label)
   if (p > label && p - (VOLUME_TEXT_LEN - 1) > label)
@@ -1365,7 +1365,7 @@ drop_volume_label_suffix (const char *label)
 
 
   return NULL;
   return NULL;
 }
 }
-      
+
 /* Check LABEL against the volume label, seen as a globbing
 /* Check LABEL against the volume label, seen as a globbing
    pattern.  Return true if the pattern matches.  In case of failure,
    pattern.  Return true if the pattern matches.  In case of failure,
    retry matching a volume sequence number before giving up in
    retry matching a volume sequence number before giving up in
@@ -1399,7 +1399,7 @@ match_volume_label (void)
   if (!volume_label)
   if (!volume_label)
     {
     {
       union block *label = find_next_block ();
       union block *label = find_next_block ();
-  
+
       if (!label)
       if (!label)
 	FATAL_ERROR ((0, 0, _("Archive not labeled to match %s"),
 	FATAL_ERROR ((0, 0, _("Archive not labeled to match %s"),
 		      quote (volume_label_option)));
 		      quote (volume_label_option)));
@@ -1425,11 +1425,11 @@ match_volume_label (void)
 	  tar_stat_destroy (&st);
 	  tar_stat_destroy (&st);
 	}
 	}
     }
     }
-  
+
   if (!volume_label)
   if (!volume_label)
     FATAL_ERROR ((0, 0, _("Archive not labeled to match %s"),
     FATAL_ERROR ((0, 0, _("Archive not labeled to match %s"),
                   quote (volume_label_option)));
                   quote (volume_label_option)));
-  
+
   if (!check_label_pattern (volume_label))
   if (!check_label_pattern (volume_label))
     FATAL_ERROR ((0, 0, _("Volume %s does not match %s"),
     FATAL_ERROR ((0, 0, _("Volume %s does not match %s"),
                   quote_n (0, volume_label),
                   quote_n (0, volume_label),
@@ -1477,7 +1477,7 @@ add_volume_label (void)
 }
 }
 
 
 static void
 static void
-add_chunk_header ()
+add_chunk_header (void)
 {
 {
   if (archive_format == POSIX_FORMAT)
   if (archive_format == POSIX_FORMAT)
     {
     {
@@ -1568,7 +1568,7 @@ add_multi_volume_header (void)
 
 
 /* Synchronize multi-volume globals */
 /* Synchronize multi-volume globals */
 static void
 static void
-multi_volume_sync ()
+multi_volume_sync (void)
 {
 {
   if (multi_volume_option)
   if (multi_volume_option)
     {
     {
@@ -1599,7 +1599,7 @@ simple_flush_read (void)
   size_t status;                /* result from system call */
   size_t status;                /* result from system call */
 
 
   checkpoint_run (false);
   checkpoint_run (false);
-  
+
   /* Clear the count of errors.  This only applies to a single call to
   /* Clear the count of errors.  This only applies to a single call to
      flush_read.  */
      flush_read.  */
 
 
@@ -1658,7 +1658,7 @@ _gnu_flush_read (void)
   size_t status;                /* result from system call */
   size_t status;                /* result from system call */
 
 
   checkpoint_run (false);
   checkpoint_run (false);
-  
+
   /* Clear the count of errors.  This only applies to a single call to
   /* Clear the count of errors.  This only applies to a single call to
      flush_read.  */
      flush_read.  */
 
 
@@ -1727,14 +1727,14 @@ _gnu_flush_write (size_t buffer_level)
   size_t copy_size;
   size_t copy_size;
   size_t bufsize;
   size_t bufsize;
   tarlong wrt;
   tarlong wrt;
-  
+
   status = _flush_write ();
   status = _flush_write ();
   if (status != record_size && !multi_volume_option)
   if (status != record_size && !multi_volume_option)
     archive_write_error (status);
     archive_write_error (status);
   else
   else
     {
     {
       if (status)
       if (status)
-        records_written++; 
+        records_written++;
       bytes_written += status;
       bytes_written += status;
     }
     }
 
 
@@ -1749,7 +1749,7 @@ _gnu_flush_write (size_t buffer_level)
       ERROR ((0, 0, _("write did not end on a block boundary")));
       ERROR ((0, 0, _("write did not end on a block boundary")));
       archive_write_error (status);
       archive_write_error (status);
     }
     }
-  
+
   /* In multi-volume mode. */
   /* In multi-volume mode. */
   /* ENXIO is for the UNIX PC.  */
   /* ENXIO is for the UNIX PC.  */
   if (status < 0 && errno != ENOSPC && errno != EIO && errno != ENXIO)
   if (status < 0 && errno != ENOSPC && errno != EIO && errno != ENXIO)
@@ -1767,7 +1767,7 @@ _gnu_flush_write (size_t buffer_level)
 
 
   copy_ptr = record_start->buffer + status;
   copy_ptr = record_start->buffer + status;
   copy_size = buffer_level - status;
   copy_size = buffer_level - status;
-                   
+
   /* Switch to the next buffer */
   /* Switch to the next buffer */
   record_index = !record_index;
   record_index = !record_index;
   init_buffer ();
   init_buffer ();
@@ -1780,7 +1780,7 @@ _gnu_flush_write (size_t buffer_level)
 
 
   write_extended (true, &dummy, find_next_block ());
   write_extended (true, &dummy, find_next_block ());
   tar_stat_destroy (&dummy);
   tar_stat_destroy (&dummy);
-  
+
   if (real_s_name)
   if (real_s_name)
     add_chunk_header ();
     add_chunk_header ();
   wrt = bytes_written;
   wrt = bytes_written;

+ 12 - 13
src/checkpoint.c

@@ -77,7 +77,7 @@ void
 checkpoint_compile_action (const char *str)
 checkpoint_compile_action (const char *str)
 {
 {
   struct checkpoint_action *act;
   struct checkpoint_action *act;
-  
+
   if (strcmp (str, ".") == 0 || strcmp (str, "dot") == 0)
   if (strcmp (str, ".") == 0 || strcmp (str, "dot") == 0)
     alloc_action (cop_dot);
     alloc_action (cop_dot);
   else if (strcmp (str, "bell") == 0)
   else if (strcmp (str, "bell") == 0)
@@ -119,14 +119,14 @@ checkpoint_finish_compile ()
     {
     {
       if (!checkpoint_action)
       if (!checkpoint_action)
 	/* Provide a historical default */
 	/* Provide a historical default */
-	checkpoint_compile_action ("echo"); 
+	checkpoint_compile_action ("echo");
     }
     }
   else if (checkpoint_action)
   else if (checkpoint_action)
     /* Otherwise, set default checkpoint rate */
     /* Otherwise, set default checkpoint rate */
     checkpoint_option = DEFAULT_CHECKPOINT;
     checkpoint_option = DEFAULT_CHECKPOINT;
 }
 }
 
 
-char *
+static char *
 expand_checkpoint_string (const char *input, bool do_write, unsigned cpn)
 expand_checkpoint_string (const char *input, bool do_write, unsigned cpn)
 {
 {
   const char *opstr = do_write ? gettext ("write") : gettext ("read");
   const char *opstr = do_write ? gettext ("write") : gettext ("read");
@@ -147,7 +147,7 @@ expand_checkpoint_string (const char *input, bool do_write, unsigned cpn)
 	case 'u':
 	case 'u':
 	  outlen += cpslen - 2;
 	  outlen += cpslen - 2;
 	  break;
 	  break;
-	  
+
 	case 's':
 	case 's':
 	  outlen += opstrlen - 2;
 	  outlen += opstrlen - 2;
 	}
 	}
@@ -164,11 +164,11 @@ expand_checkpoint_string (const char *input, bool do_write, unsigned cpn)
 	    case 'u':
 	    case 'u':
 	      op = stpcpy (op, cps);
 	      op = stpcpy (op, cps);
 	      break;
 	      break;
-	      
+
 	    case 's':
 	    case 's':
 	      op = stpcpy (op, opstr);
 	      op = stpcpy (op, opstr);
 	      break;
 	      break;
-	      
+
 	    default:
 	    default:
 	      *op++ = '%';
 	      *op++ = '%';
 	      *op++ = *ip;
 	      *op++ = *ip;
@@ -188,7 +188,7 @@ run_checkpoint_actions (bool do_write)
 {
 {
   struct checkpoint_action *p;
   struct checkpoint_action *p;
   FILE *tty = NULL;
   FILE *tty = NULL;
-  
+
   for (p = checkpoint_action; p; p = p->next)
   for (p = checkpoint_action; p; p = p->next)
     {
     {
       switch (p->opcode)
       switch (p->opcode)
@@ -207,7 +207,7 @@ run_checkpoint_actions (bool do_write)
 	      fflush (tty);
 	      fflush (tty);
 	    }
 	    }
 	  break;
 	  break;
-	  
+
 	case cop_echo:
 	case cop_echo:
 	  {
 	  {
 	    char *tmp;
 	    char *tmp;
@@ -232,7 +232,7 @@ run_checkpoint_actions (bool do_write)
 	    free (tmp);
 	    free (tmp);
 	  }
 	  }
 	  break;
 	  break;
-	  
+
 	case cop_ttyout:
 	case cop_ttyout:
 	  if (!tty)
 	  if (!tty)
 	    tty = fopen ("/dev/tty", "w");
 	    tty = fopen ("/dev/tty", "w");
@@ -245,11 +245,11 @@ run_checkpoint_actions (bool do_write)
 	      free (tmp);
 	      free (tmp);
 	    }
 	    }
 	  break;
 	  break;
-	  
+
 	case cop_sleep:
 	case cop_sleep:
 	  sleep (p->v.time);
 	  sleep (p->v.time);
 	  break;
 	  break;
-	  
+
 	case cop_exec:
 	case cop_exec:
 	  sys_exec_checkpoint_script (p->v.command,
 	  sys_exec_checkpoint_script (p->v.command,
 				      archive_name_cursor[0],
 				      archive_name_cursor[0],
@@ -266,5 +266,4 @@ checkpoint_run (bool do_write)
 {
 {
   if (checkpoint_option && !(++checkpoint % checkpoint_option))
   if (checkpoint_option && !(++checkpoint % checkpoint_option))
     run_checkpoint_actions (do_write);
     run_checkpoint_actions (do_write);
-}  
-
+}

+ 5 - 5
src/common.h

@@ -1,7 +1,7 @@
 /* Common declarations for the tar program.
 /* Common declarations for the tar program.
 
 
    Copyright (C) 1988, 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001,
    Copyright (C) 1988, 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001,
-   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
+   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
    Inc.
    Inc.
 
 
    This program is free software; you can redistribute it and/or modify it
    This program is free software; you can redistribute it and/or modify it
@@ -337,12 +337,12 @@ struct name
     int matching_flags;         /* wildcard flags if name is a pattern */
     int matching_flags;         /* wildcard flags if name is a pattern */
     bool cmdline;               /* true if this name was given in the
     bool cmdline;               /* true if this name was given in the
 				   command line */
 				   command line */
-    
+
     int change_dir;		/* Number of the directory to change to.
     int change_dir;		/* Number of the directory to change to.
 				   Set with the -C option. */
 				   Set with the -C option. */
     uintmax_t found_count;	/* number of times a matching file has
     uintmax_t found_count;	/* number of times a matching file has
 				   been found */
 				   been found */
-    
+
     /* The following members are used for incremental dumps only,
     /* The following members are used for incremental dumps only,
        if this struct name represents a directory;
        if this struct name represents a directory;
        see incremen.c */
        see incremen.c */
@@ -465,7 +465,7 @@ void exclusion_tag_warning (const char *dirname, const char *tagname,
 			    const char *message);
 			    const char *message);
 enum exclusion_tag_type check_exclusion_tags (const char *dirname,
 enum exclusion_tag_type check_exclusion_tags (const char *dirname,
 					      const char **tag_file_name);
 					      const char **tag_file_name);
-     
+
 #define GID_TO_CHARS(val, where) gid_to_chars (val, where, sizeof (where))
 #define GID_TO_CHARS(val, where) gid_to_chars (val, where, sizeof (where))
 #define MAJOR_TO_CHARS(val, where) major_to_chars (val, where, sizeof (where))
 #define MAJOR_TO_CHARS(val, where) major_to_chars (val, where, sizeof (where))
 #define MINOR_TO_CHARS(val, where) minor_to_chars (val, where, sizeof (where))
 #define MINOR_TO_CHARS(val, where) minor_to_chars (val, where, sizeof (where))
@@ -692,6 +692,7 @@ struct name *addname (char const *string, int change_dir,
 void remname (struct name *name);
 void remname (struct name *name);
 bool name_match (const char *name);
 bool name_match (const char *name);
 void names_notfound (void);
 void names_notfound (void);
+void label_notfound (void);
 void collect_and_sort_names (void);
 void collect_and_sort_names (void);
 struct name *name_scan (const char *name);
 struct name *name_scan (const char *name);
 struct name const *name_from_list (void);
 struct name const *name_from_list (void);
@@ -858,4 +859,3 @@ void finish_deferred_unlinks (void);
 
 
 /* Module exit.c */
 /* Module exit.c */
 extern void (*fatal_exit_hook) (void);
 extern void (*fatal_exit_hook) (void);
-

+ 14 - 15
src/extract.c

@@ -146,7 +146,7 @@ set_mode (char const *file_name,
 {
 {
   mode_t mode;
   mode_t mode;
   bool failed;
   bool failed;
-  
+
   if (0 < same_permissions_option
   if (0 < same_permissions_option
       && permstatus != INTERDIR_PERMSTATUS)
       && permstatus != INTERDIR_PERMSTATUS)
     {
     {
@@ -893,10 +893,10 @@ create_placeholder_file (char *file_name, bool is_symlink, int *interdir_made)
 	{
 	{
 	case RECOVER_OK:
 	case RECOVER_OK:
 	  continue;
 	  continue;
-	  
+
 	case RECOVER_SKIP:
 	case RECOVER_SKIP:
 	  return 0;
 	  return 0;
-	  
+
 	case RECOVER_NO:
 	case RECOVER_NO:
 	  open_error (file_name);
 	  open_error (file_name);
 	  return -1;
 	  return -1;
@@ -967,9 +967,9 @@ extract_link (char *file_name, int typeflag)
   int interdir_made = 0;
   int interdir_made = 0;
   char const *link_name;
   char const *link_name;
   int rc;
   int rc;
-  
+
   link_name = current_stat_info.link_name;
   link_name = current_stat_info.link_name;
-  
+
   if (! absolute_names_option && contains_dot_dot (link_name))
   if (! absolute_names_option && contains_dot_dot (link_name))
     return create_placeholder_file (file_name, false, &interdir_made);
     return create_placeholder_file (file_name, false, &interdir_made);
 
 
@@ -1035,15 +1035,15 @@ extract_symlink (char *file_name, int typeflag)
       {
       {
       case RECOVER_OK:
       case RECOVER_OK:
 	continue;
 	continue;
-	
+
       case RECOVER_SKIP:
       case RECOVER_SKIP:
 	return 0;
 	return 0;
-	
+
       case RECOVER_NO:
       case RECOVER_NO:
 	symlink_error (current_stat_info.link_name, file_name);
 	symlink_error (current_stat_info.link_name, file_name);
 	return -1;
 	return -1;
       }
       }
-  
+
   set_stat (file_name, &current_stat_info, NULL, 0, 0, SYMTYPE);
   set_stat (file_name, &current_stat_info, NULL, 0, 0, SYMTYPE);
   return 0;
   return 0;
 
 
@@ -1065,7 +1065,6 @@ extract_symlink (char *file_name, int typeflag)
 static int
 static int
 extract_node (char *file_name, int typeflag)
 extract_node (char *file_name, int typeflag)
 {
 {
-  int status;
   int interdir_made = 0;
   int interdir_made = 0;
   mode_t mode = current_stat_info.stat.st_mode & ~ current_umask;
   mode_t mode = current_stat_info.stat.st_mode & ~ current_umask;
   mode_t invert_permissions =
   mode_t invert_permissions =
@@ -1077,10 +1076,10 @@ extract_node (char *file_name, int typeflag)
       {
       {
       case RECOVER_OK:
       case RECOVER_OK:
 	continue;
 	continue;
-	
+
       case RECOVER_SKIP:
       case RECOVER_SKIP:
 	return 0;
 	return 0;
-	
+
       case RECOVER_NO:
       case RECOVER_NO:
 	mknod_error (file_name);
 	mknod_error (file_name);
 	return -1;
 	return -1;
@@ -1088,7 +1087,7 @@ extract_node (char *file_name, int typeflag)
 
 
   set_stat (file_name, &current_stat_info, NULL, invert_permissions,
   set_stat (file_name, &current_stat_info, NULL, invert_permissions,
 	    ARCHIVED_PERMSTATUS, typeflag);
 	    ARCHIVED_PERMSTATUS, typeflag);
-  return status;
+  return 0;
 }
 }
 #endif
 #endif
 
 
@@ -1107,10 +1106,10 @@ extract_fifo (char *file_name, int typeflag)
       {
       {
       case RECOVER_OK:
       case RECOVER_OK:
 	continue;
 	continue;
-	
+
       case RECOVER_SKIP:
       case RECOVER_SKIP:
 	return 0;
 	return 0;
-	
+
       case RECOVER_NO:
       case RECOVER_NO:
 	mkfifo_error (file_name);
 	mkfifo_error (file_name);
 	return -1;
 	return -1;
@@ -1274,7 +1273,7 @@ extract_archive (void)
   tar_extractor_t fun;
   tar_extractor_t fun;
 
 
   fatal_exit_hook = extract_finish;
   fatal_exit_hook = extract_finish;
-  
+
   /* Try to disable the ability to unlink a directory.  */
   /* Try to disable the ability to unlink a directory.  */
   priv_set_remove_linkdir ();
   priv_set_remove_linkdir ();
 
 

+ 25 - 25
src/incremen.c

@@ -84,7 +84,7 @@ dumpdir_create0 (const char *contents, const char *cmask)
   size_t i, total, ctsize, len;
   size_t i, total, ctsize, len;
   char *p;
   char *p;
   const char *q;
   const char *q;
-  
+
   for (i = 0, total = 0, ctsize = 1, q = contents; *q; total++, q += len)
   for (i = 0, total = 0, ctsize = 1, q = contents; *q; total++, q += len)
     {
     {
       len = strlen (q) + 1;
       len = strlen (q) + 1;
@@ -146,7 +146,7 @@ dumpdir_locate (struct dumpdir *dump, const char *name)
 struct dumpdir_iter
 struct dumpdir_iter
 {
 {
   struct dumpdir *dump; /* Dumpdir being iterated */
   struct dumpdir *dump; /* Dumpdir being iterated */
-  int all;              /* Iterate over all entries, not only D/N/Y */ 
+  int all;              /* Iterate over all entries, not only D/N/Y */
   size_t next;          /* Index of the next element */
   size_t next;          /* Index of the next element */
 };
 };
 
 
@@ -155,7 +155,7 @@ dumpdir_next (struct dumpdir_iter *itr)
 {
 {
   size_t cur = itr->next;
   size_t cur = itr->next;
   char *ret = NULL;
   char *ret = NULL;
-  
+
   if (itr->all)
   if (itr->all)
     {
     {
       ret = itr->dump->contents + cur;
       ret = itr->dump->contents + cur;
@@ -288,9 +288,9 @@ attach_directory (const char *name)
   dirtail = dir;
   dirtail = dir;
   return dir;
   return dir;
 }
 }
-		 
+
 
 
-void
+static void
 dirlist_replace_prefix (const char *pref, const char *repl)
 dirlist_replace_prefix (const char *pref, const char *repl)
 {
 {
   struct directory *dp;
   struct directory *dp;
@@ -414,7 +414,7 @@ update_parent_directory (const char *name)
       struct stat st;
       struct stat st;
       if (deref_stat (dereference_option, p, &st) != 0)
       if (deref_stat (dereference_option, p, &st) != 0)
 	{
 	{
-	  if (errno != ENOENT) 
+	  if (errno != ENOENT)
 	    stat_diag (directory->name);
 	    stat_diag (directory->name);
 	  /* else: should have been already reported */
 	  /* else: should have been already reported */
 	}
 	}
@@ -457,14 +457,14 @@ procdir (const char *name_buffer, struct stat *stat_data,
 	  *entry = 'N';
 	  *entry = 'N';
 	  return directory;
 	  return directory;
 	}
 	}
-      
+
       /* With NFS, the same file can have two different devices
       /* With NFS, the same file can have two different devices
 	 if an NFS directory is mounted in multiple locations,
 	 if an NFS directory is mounted in multiple locations,
 	 which is relatively common when automounting.
 	 which is relatively common when automounting.
 	 To avoid spurious incremental redumping of
 	 To avoid spurious incremental redumping of
 	 directories, consider all NFS devices as equal,
 	 directories, consider all NFS devices as equal,
 	 relying on the i-node to establish differences.  */
 	 relying on the i-node to establish differences.  */
-      
+
       if (! ((!check_device_option
       if (! ((!check_device_option
 	      || (DIR_IS_NFS (directory) && nfs)
 	      || (DIR_IS_NFS (directory) && nfs)
 	      || directory->device_number == stat_data->st_dev)
 	      || directory->device_number == stat_data->st_dev)
@@ -502,14 +502,14 @@ procdir (const char *name_buffer, struct stat *stat_data,
 	}
 	}
       else
       else
 	directory->children = CHANGED_CHILDREN;
 	directory->children = CHANGED_CHILDREN;
-      
+
       DIR_SET_FLAG (directory, DIRF_FOUND);
       DIR_SET_FLAG (directory, DIRF_FOUND);
     }
     }
   else
   else
     {
     {
       struct directory *d = find_directory_meta (stat_data->st_dev,
       struct directory *d = find_directory_meta (stat_data->st_dev,
 						 stat_data->st_ino);
 						 stat_data->st_ino);
-      
+
       directory = note_directory (name_buffer,
       directory = note_directory (name_buffer,
 				  get_stat_mtime(stat_data),
 				  get_stat_mtime(stat_data),
 				  stat_data->st_dev,
 				  stat_data->st_dev,
@@ -553,7 +553,7 @@ procdir (const char *name_buffer, struct stat *stat_data,
   if (one_file_system_option && device != stat_data->st_dev
   if (one_file_system_option && device != stat_data->st_dev
       /* ... except if it was explicitely given in the command line */
       /* ... except if it was explicitely given in the command line */
       && !is_individual_file (name_buffer))
       && !is_individual_file (name_buffer))
-    /* FIXME: 
+    /* FIXME:
 	WARNOPT (WARN_XDEV,
 	WARNOPT (WARN_XDEV,
 		 (0, 0,
 		 (0, 0,
 		  _("%s: directory is on a different filesystem; not dumped"),
 		  _("%s: directory is on a different filesystem; not dumped"),
@@ -566,7 +566,7 @@ procdir (const char *name_buffer, struct stat *stat_data,
       if (directory->children == NO_CHILDREN)
       if (directory->children == NO_CHILDREN)
 	*entry = 'N';
 	*entry = 'N';
     }
     }
-	  
+
   DIR_SET_FLAG (directory, DIRF_INIT);
   DIR_SET_FLAG (directory, DIRF_INIT);
 
 
   if (directory->children != NO_CHILDREN)
   if (directory->children != NO_CHILDREN)
@@ -590,13 +590,13 @@ procdir (const char *name_buffer, struct stat *stat_data,
 				 _("contents not dumped"));
 				 _("contents not dumped"));
 	  directory->children = NO_CHILDREN;
 	  directory->children = NO_CHILDREN;
 	  break;
 	  break;
-	  
+
 	case exclusion_tag_under:
 	case exclusion_tag_under:
 	  exclusion_tag_warning (name_buffer, tag_file_name,
 	  exclusion_tag_warning (name_buffer, tag_file_name,
 				 _("contents not dumped"));
 				 _("contents not dumped"));
 	  directory->tagfile = tag_file_name;
 	  directory->tagfile = tag_file_name;
 	  break;
 	  break;
-	  
+
 	case exclusion_tag_none:
 	case exclusion_tag_none:
 	  break;
 	  break;
 	}
 	}
@@ -616,7 +616,7 @@ procdir (const char *name_buffer, struct stat *stat_data,
    DIRECTORY->dump is replaced with the created template. Each entry is
    DIRECTORY->dump is replaced with the created template. Each entry is
    prefixed with ' ' if it was present in DUMP and with 'Y' otherwise. */
    prefixed with ' ' if it was present in DUMP and with 'Y' otherwise. */
 
 
-void
+static void
 makedumpdir (struct directory *directory, const char *dir)
 makedumpdir (struct directory *directory, const char *dir)
 {
 {
   size_t i,
   size_t i,
@@ -697,13 +697,13 @@ scan_directory (char *dir, dev_t device, bool cmdline)
   struct stat stat_data;
   struct stat stat_data;
   struct directory *directory;
   struct directory *directory;
   char ch;
   char ch;
-  
+
   if (! dirp)
   if (! dirp)
     savedir_error (dir);
     savedir_error (dir);
 
 
   tmp = xstrdup (dir);
   tmp = xstrdup (dir);
   zap_slashes (tmp);
   zap_slashes (tmp);
-  
+
   if (deref_stat (dereference_option, tmp, &stat_data))
   if (deref_stat (dereference_option, tmp, &stat_data))
     {
     {
       dir_removed_diag (tmp, cmdline, stat_diag);
       dir_removed_diag (tmp, cmdline, stat_diag);
@@ -715,7 +715,7 @@ scan_directory (char *dir, dev_t device, bool cmdline)
   directory = procdir (tmp, &stat_data, device,
   directory = procdir (tmp, &stat_data, device,
 		       (cmdline ? PD_FORCE_INIT : 0),
 		       (cmdline ? PD_FORCE_INIT : 0),
 		       &ch);
 		       &ch);
-  
+
   free (tmp);
   free (tmp);
 
 
   nbuf = namebuf_create (dir);
   nbuf = namebuf_create (dir);
@@ -809,9 +809,9 @@ name_fill_directory (struct name *name, dev_t device, bool cmdline)
 
 
 
 
 static void
 static void
-obstack_code_rename (struct obstack *stk, char *from, char *to)
+obstack_code_rename (struct obstack *stk, char const *from, char const *to)
 {
 {
-  char *s;
+  char const *s;
 
 
   s = from[0] == 0 ? from :
   s = from[0] == 0 ? from :
                      safer_name_suffix (from, false, absolute_names_option);
                      safer_name_suffix (from, false, absolute_names_option);
@@ -874,7 +874,7 @@ append_incremental_renames (struct directory *dir)
   size_t size;
   size_t size;
   struct directory *dp;
   struct directory *dp;
   const char *dump;
   const char *dump;
-  
+
   if (dirhead == NULL)
   if (dirhead == NULL)
     return;
     return;
 
 
@@ -1217,7 +1217,7 @@ read_timespec (FILE *fp, struct timespec *pval)
 
 
 /* Read incremental snapshot format 2 */
 /* Read incremental snapshot format 2 */
 static void
 static void
-read_incr_db_2 ()
+read_incr_db_2 (void)
 {
 {
   uintmax_t u;
   uintmax_t u;
   struct obstack stk;
   struct obstack stk;
@@ -1312,7 +1312,7 @@ read_directory_file (void)
      which is necessary to recreate absolute file names. */
      which is necessary to recreate absolute file names. */
   name_from_list ();
   name_from_list ();
   blank_name_list ();
   blank_name_list ();
-  
+
   if (0 < getline (&buf, &bufsize, listed_incremental_stream))
   if (0 < getline (&buf, &bufsize, listed_incremental_stream))
     {
     {
       char *ebuf;
       char *ebuf;
@@ -1367,7 +1367,7 @@ write_directory_file_entry (void *entry, void *data)
   if (DIR_IS_FOUND (directory))
   if (DIR_IS_FOUND (directory))
     {
     {
       char buf[UINTMAX_STRSIZE_BOUND];
       char buf[UINTMAX_STRSIZE_BOUND];
-      char *s;
+      char const *s;
 
 
       s = DIR_IS_NFS (directory) ? "1" : "0";
       s = DIR_IS_NFS (directory) ? "1" : "0";
       fwrite (s, 2, 1, fp);
       fwrite (s, 2, 1, fp);
@@ -1707,7 +1707,7 @@ try_purge_directory (char const *directory_name)
     }
     }
   free (p);
   free (p);
   dumpdir_free (dump);
   dumpdir_free (dump);
-  
+
   free (current_dir);
   free (current_dir);
   return true;
   return true;
 }
 }

+ 12 - 12
src/list.c

@@ -78,7 +78,7 @@ read_and (void (*do_something) (void))
       prev_status = status;
       prev_status = status;
       tar_stat_destroy (&current_stat_info);
       tar_stat_destroy (&current_stat_info);
 
 
-      status = read_header (&current_header, &current_stat_info, 
+      status = read_header (&current_header, &current_stat_info,
                             read_header_auto);
                             read_header_auto);
       switch (status)
       switch (status)
 	{
 	{
@@ -140,7 +140,7 @@ read_and (void (*do_something) (void))
 	    {
 	    {
 	      char buf[UINTMAX_STRSIZE_BOUND];
 	      char buf[UINTMAX_STRSIZE_BOUND];
 
 
-	      status = read_header (&current_header, &current_stat_info, 
+	      status = read_header (&current_header, &current_stat_info,
 	                            read_header_auto);
 	                            read_header_auto);
 	      if (status == HEADER_ZERO_BLOCK)
 	      if (status == HEADER_ZERO_BLOCK)
 		break;
 		break;
@@ -210,7 +210,7 @@ list_archive (void)
   off_t block_ordinal = current_block_ordinal ();
   off_t block_ordinal = current_block_ordinal ();
 
 
   /* Print the header block.  */
   /* Print the header block.  */
-  
+
   decode_header (current_header, &current_stat_info, &current_format, 0);
   decode_header (current_header, &current_stat_info, &current_format, 0);
   if (verbose_option)
   if (verbose_option)
     print_header (&current_stat_info, current_header, block_ordinal);
     print_header (&current_stat_info, current_header, block_ordinal);
@@ -496,18 +496,18 @@ decode_xform (char *file_name, void *data)
 	 links subject to filename transformation.  In the absence of another
 	 links subject to filename transformation.  In the absence of another
 	 solution, symbolic links are exempt from component stripping and
 	 solution, symbolic links are exempt from component stripping and
 	 name suffix normalization, but subject to filename transformation
 	 name suffix normalization, but subject to filename transformation
-	 proper. */ 
+	 proper. */
       return file_name;
       return file_name;
-      
+
     case XFORM_LINK:
     case XFORM_LINK:
       file_name = safer_name_suffix (file_name, true, absolute_names_option);
       file_name = safer_name_suffix (file_name, true, absolute_names_option);
       break;
       break;
-      
+
     case XFORM_REGFILE:
     case XFORM_REGFILE:
       file_name = safer_name_suffix (file_name, false, absolute_names_option);
       file_name = safer_name_suffix (file_name, false, absolute_names_option);
       break;
       break;
     }
     }
-  
+
   if (strip_name_components)
   if (strip_name_components)
     {
     {
       size_t prefix_len = stripped_prefix_len (file_name,
       size_t prefix_len = stripped_prefix_len (file_name,
@@ -547,7 +547,7 @@ decode_header (union block *header, struct tar_stat_info *stat_info,
   enum archive_format format;
   enum archive_format format;
   unsigned hbits; /* high bits of the file mode. */
   unsigned hbits; /* high bits of the file mode. */
   mode_t mode = MODE_FROM_HEADER (header->header.mode, &hbits);
   mode_t mode = MODE_FROM_HEADER (header->header.mode, &hbits);
-  
+
   if (strcmp (header->header.magic, TMAGIC) == 0)
   if (strcmp (header->header.magic, TMAGIC) == 0)
     {
     {
       if (header->star_header.prefix[130] == 0
       if (header->star_header.prefix[130] == 0
@@ -651,7 +651,7 @@ decode_header (union block *header, struct tar_stat_info *stat_info,
     case SYMTYPE:
     case SYMTYPE:
       transform_member_name (&stat_info->link_name, XFORM_SYMLINK);
       transform_member_name (&stat_info->link_name, XFORM_SYMLINK);
       break;
       break;
-      
+
     case LNKTYPE:
     case LNKTYPE:
       transform_member_name (&stat_info->link_name, XFORM_LINK);
       transform_member_name (&stat_info->link_name, XFORM_LINK);
     }
     }
@@ -1292,8 +1292,8 @@ simple_print_header (struct tar_stat_info *st, union block *blk,
 }
 }
 
 
 
 
-void
-print_volume_label ()
+static void
+print_volume_label (void)
 {
 {
   struct tar_stat_info vstat;
   struct tar_stat_info vstat;
   union block vblk;
   union block vblk;
@@ -1416,7 +1416,7 @@ test_archive_label ()
 		     &current_stat_info, &current_format, 0);
 		     &current_stat_info, &current_format, 0);
       if (current_header->header.typeflag == GNUTYPE_VOLHDR)
       if (current_header->header.typeflag == GNUTYPE_VOLHDR)
 	assign_string (&volume_label, current_header->header.name);
 	assign_string (&volume_label, current_header->header.name);
-      
+
       if (volume_label)
       if (volume_label)
 	{
 	{
 	  if (verbose_option)
 	  if (verbose_option)

+ 5 - 6
src/misc.c

@@ -234,8 +234,8 @@ zap_slashes (char *name)
 }
 }
 
 
 /* Normalize NAME by resolving any relative references and
 /* Normalize NAME by resolving any relative references and
-   removing trailing slashes.  Destructive version: modifies its argument. */ 
-int
+   removing trailing slashes.  Destructive version: modifies its argument. */
+static int
 normalize_filename_x (char *name)
 normalize_filename_x (char *name)
 {
 {
   char *p, *q;
   char *p, *q;
@@ -296,7 +296,7 @@ normalize_filename_x (char *name)
   /* Remove trailing slashes */
   /* Remove trailing slashes */
   while (p - 1 > name && ISSLASH (p[-1]))
   while (p - 1 > name && ISSLASH (p[-1]))
     p--;
     p--;
-  
+
   *p = 0;
   *p = 0;
   return 0;
   return 0;
 }
 }
@@ -393,7 +393,7 @@ code_timespec (struct timespec t, char sbuf[TIMESPEC_STRSIZE_BOUND])
   /* ignore invalid values of ns */
   /* ignore invalid values of ns */
   if (BILLION <= ns || ns < 0)
   if (BILLION <= ns || ns < 0)
     ns = 0;
     ns = 0;
-  
+
   if (negative && ns != 0)
   if (negative && ns != 0)
     {
     {
       s++;
       s++;
@@ -851,7 +851,7 @@ file_removed_diag (const char *name, bool top_level,
 	       (0, 0, _("%s: File removed before we read it"),
 	       (0, 0, _("%s: File removed before we read it"),
 		quotearg_colon (name)));
 		quotearg_colon (name)));
       set_exit_status (TAREXIT_DIFFERS);
       set_exit_status (TAREXIT_DIFFERS);
-    }      
+    }
   else
   else
     diagfn (name);
     diagfn (name);
 }
 }
@@ -961,4 +961,3 @@ namebuf_name (namebuf_t buf, const char *name)
   strcpy (buf->buffer + buf->dir_length, name);
   strcpy (buf->buffer + buf->dir_length, name);
   return buf->buffer;
   return buf->buffer;
 }
 }
-

+ 23 - 32
src/names.c

@@ -27,15 +27,6 @@
 
 
 /* User and group names.  */
 /* User and group names.  */
 
 
-struct group *getgrnam ();
-struct passwd *getpwnam ();
-#if ! HAVE_DECL_GETPWUID
-struct passwd *getpwuid ();
-#endif
-#if ! HAVE_DECL_GETGRGID
-struct group *getgrgid ();
-#endif
-
 /* Make sure you link with the proper libraries if you are running the
 /* Make sure you link with the proper libraries if you are running the
    Yellow Peril (thanks for the good laugh, Ian J.!), or, euh... NIS.
    Yellow Peril (thanks for the good laugh, Ian J.!), or, euh... NIS.
    This code should also be modified for non-UNIX systems to do something
    This code should also be modified for non-UNIX systems to do something
@@ -179,7 +170,7 @@ gname_to_gid (char const *gname, gid_t *gidp)
 }
 }
 
 
 
 
-struct name *
+static struct name *
 make_name (const char *file_name)
 make_name (const char *file_name)
 {
 {
   struct name *p = xzalloc (sizeof (*p));
   struct name *p = xzalloc (sizeof (*p));
@@ -190,7 +181,7 @@ make_name (const char *file_name)
   return p;
   return p;
 }
 }
 
 
-void
+static void
 free_name (struct name *p)
 free_name (struct name *p)
 {
 {
   if (p)
   if (p)
@@ -207,7 +198,7 @@ free_name (struct name *p)
 static struct name *namelist;	/* first name in list, if any */
 static struct name *namelist;	/* first name in list, if any */
 static struct name *nametail;	/* end of name list */
 static struct name *nametail;	/* end of name list */
 
 
-/* File name arguments are processed in two stages: first a 
+/* File name arguments are processed in two stages: first a
    name_array (see below) is filled, then the names from it
    name_array (see below) is filled, then the names from it
    are moved into the namelist.
    are moved into the namelist.
 
 
@@ -215,7 +206,7 @@ static struct name *nametail;	/* end of name list */
    which is meant to help process large archives on machines with
    which is meant to help process large archives on machines with
    limited memory.  With this option on, namelist contains at most one
    limited memory.  With this option on, namelist contains at most one
    entry, which diminishes the memory consumption.
    entry, which diminishes the memory consumption.
-   
+
    However, I very much doubt if we still need this -- Sergey */
    However, I very much doubt if we still need this -- Sergey */
 
 
 /* A name_array element contains entries of three types: */
 /* A name_array element contains entries of three types: */
@@ -230,7 +221,7 @@ struct name_elt        /* A name_array element. */
   union
   union
   {
   {
     const char *name;  /* File or directory name */
     const char *name;  /* File or directory name */
-    int matching_flags;/* fnmatch options if type == NELT_FMASK */ 
+    int matching_flags;/* fnmatch options if type == NELT_FMASK */
   } v;
   } v;
 };
 };
 
 
@@ -241,7 +232,7 @@ static size_t name_index;	 /* how many of the entries have we scanned? */
 
 
 /* Check the size of name_array, reallocating it as necessary.  */
 /* Check the size of name_array, reallocating it as necessary.  */
 static void
 static void
-check_name_alloc ()
+check_name_alloc (void)
 {
 {
   if (names == allocated_names)
   if (names == allocated_names)
     {
     {
@@ -282,7 +273,7 @@ name_add_dir (const char *name)
   ep = &name_array[names++];
   ep = &name_array[names++];
   ep->type = NELT_CHDIR;
   ep->type = NELT_CHDIR;
   ep->v.name = name;
   ep->v.name = name;
-}  
+}
 
 
 
 
 /* Names from external name file.  */
 /* Names from external name file.  */
@@ -313,10 +304,10 @@ static int matching_flags; /* exclude_fnmatch options */
 
 
    If CHANGE_DIRS is true, treat any entries of type NELT_CHDIR as
    If CHANGE_DIRS is true, treat any entries of type NELT_CHDIR as
    the request to change to the given directory.
    the request to change to the given directory.
-   
+
    Entries of type NELT_FMASK cause updates of the matching_flags
    Entries of type NELT_FMASK cause updates of the matching_flags
    value. */
    value. */
-struct name_elt *
+static struct name_elt *
 name_next_elt (int change_dirs)
 name_next_elt (int change_dirs)
 {
 {
   static struct name_elt entry;
   static struct name_elt entry;
@@ -327,14 +318,14 @@ name_next_elt (int change_dirs)
     {
     {
       struct name_elt *ep;
       struct name_elt *ep;
       size_t source_len;
       size_t source_len;
-      
+
       ep = &name_array[name_index++];
       ep = &name_array[name_index++];
       if (ep->type == NELT_FMASK)
       if (ep->type == NELT_FMASK)
 	{
 	{
 	  matching_flags = ep->v.matching_flags;
 	  matching_flags = ep->v.matching_flags;
 	  continue;
 	  continue;
 	}
 	}
-      
+
       source = ep->v.name;
       source = ep->v.name;
       source_len = strlen (source);
       source_len = strlen (source);
       if (name_buffer_length < source_len)
       if (name_buffer_length < source_len)
@@ -421,7 +412,7 @@ name_gather (void)
 	  buffer->directory = NULL;
 	  buffer->directory = NULL;
 	  buffer->parent = NULL;
 	  buffer->parent = NULL;
 	  buffer->cmdline = true;
 	  buffer->cmdline = true;
-	  
+
 	  namelist = nametail = buffer;
 	  namelist = nametail = buffer;
 	}
 	}
       else if (change_dir)
       else if (change_dir)
@@ -519,7 +510,7 @@ name_match (const char *file_name)
 
 
       if (!cursor)
       if (!cursor)
 	return true;
 	return true;
-      
+
       if (cursor->name[0] == 0)
       if (cursor->name[0] == 0)
 	{
 	{
 	  chdir_do (cursor->change_dir);
 	  chdir_do (cursor->change_dir);
@@ -616,7 +607,7 @@ names_notfound (void)
     if (!WASFOUND (cursor) && cursor->name[0])
     if (!WASFOUND (cursor) && cursor->name[0])
       {
       {
 	regex_usage_warning (cursor->name);
 	regex_usage_warning (cursor->name);
-	ERROR ((0, 0, 
+	ERROR ((0, 0,
 		(cursor->found_count == 0) ?
 		(cursor->found_count == 0) ?
 		     _("%s: Not found in archive") :
 		     _("%s: Not found in archive") :
 		     _("%s: Required occurrence not found in archive"),
 		     _("%s: Required occurrence not found in archive"),
@@ -647,7 +638,7 @@ label_notfound (void)
 
 
   if (!namelist)
   if (!namelist)
     return;
     return;
-  
+
   for (cursor = namelist; cursor; cursor = cursor->next)
   for (cursor = namelist; cursor; cursor = cursor->next)
     if (WASFOUND (cursor))
     if (WASFOUND (cursor))
       return;
       return;
@@ -681,7 +672,7 @@ label_notfound (void)
 /* Sort *singly* linked LIST of names, of given LENGTH, using COMPARE
 /* Sort *singly* linked LIST of names, of given LENGTH, using COMPARE
    to order names.  Return the sorted list.  Note that after calling
    to order names.  Return the sorted list.  Note that after calling
    this function, the `prev' links in list elements are messed up.
    this function, the `prev' links in list elements are messed up.
-   
+
    Apart from the type `struct name' and the definition of SUCCESSOR,
    Apart from the type `struct name' and the definition of SUCCESSOR,
    this is a generic list-sorting function, but it's too painful to
    this is a generic list-sorting function, but it's too painful to
    make it both generic and portable
    make it both generic and portable
@@ -797,7 +788,7 @@ static void
 add_hierarchy_to_namelist (struct name *name, dev_t device, bool cmdline)
 add_hierarchy_to_namelist (struct name *name, dev_t device, bool cmdline)
 {
 {
   const char *buffer;
   const char *buffer;
-  
+
   name_fill_directory (name, device, cmdline);
   name_fill_directory (name, device, cmdline);
   buffer = directory_contents (name->directory);
   buffer = directory_contents (name->directory);
   if (buffer)
   if (buffer)
@@ -882,7 +873,7 @@ rebase_child_list (struct name *child, struct name *parent)
   size_t old_prefix_len = child->parent->length;
   size_t old_prefix_len = child->parent->length;
   size_t new_prefix_len = parent->length;
   size_t new_prefix_len = parent->length;
   char *new_prefix = parent->name;
   char *new_prefix = parent->name;
-  
+
   for (; child; child = child->sibling)
   for (; child; child = child->sibling)
     {
     {
       size_t size = child->length - old_prefix_len + new_prefix_len;
       size_t size = child->length - old_prefix_len + new_prefix_len;
@@ -894,7 +885,7 @@ rebase_child_list (struct name *child, struct name *parent)
       child->length = size;
       child->length = size;
 
 
       rebase_directory (child->directory,
       rebase_directory (child->directory,
-			child->parent->name, old_prefix_len, 
+			child->parent->name, old_prefix_len,
 			new_prefix, new_prefix_len);
 			new_prefix, new_prefix_len);
     }
     }
 }
 }
@@ -911,7 +902,7 @@ collect_and_sort_names (void)
   int num_names;
   int num_names;
   struct stat statbuf;
   struct stat statbuf;
   Hash_table *nametab;
   Hash_table *nametab;
-  
+
   name_gather ();
   name_gather ();
 
 
   if (!namelist)
   if (!namelist)
@@ -939,7 +930,7 @@ collect_and_sort_names (void)
 
 
       read_directory_file ();
       read_directory_file ();
     }
     }
-  
+
   num_names = 0;
   num_names = 0;
   for (name = namelist; name; name = name->next, num_names++)
   for (name = namelist; name; name = name->next, num_names++)
     {
     {
@@ -1115,12 +1106,12 @@ static void
 register_individual_file (char const *name)
 register_individual_file (char const *name)
 {
 {
   struct stat st;
   struct stat st;
-  
+
   if (deref_stat (dereference_option, name, &st) != 0)
   if (deref_stat (dereference_option, name, &st) != 0)
     return; /* Will be complained about later */
     return; /* Will be complained about later */
   if (S_ISDIR (st.st_mode))
   if (S_ISDIR (st.st_mode))
     return;
     return;
-  
+
   hash_string_insert (&individual_file_table, name);
   hash_string_insert (&individual_file_table, name);
 }
 }
 
 

+ 24 - 24
src/sparse.c

@@ -224,7 +224,7 @@ sparse_scan_file (struct tar_sparse_file *file)
     return false;
     return false;
 
 
   st->archive_file_size = 0;
   st->archive_file_size = 0;
-  
+
   if (!tar_sparse_scan (file, scan_begin, NULL))
   if (!tar_sparse_scan (file, scan_begin, NULL))
     return false;
     return false;
 
 
@@ -514,7 +514,7 @@ check_data_region (struct tar_sparse_file *file, size_t i)
     return false;
     return false;
   size_left = file->stat_info->sparse_map[i].numbytes;
   size_left = file->stat_info->sparse_map[i].numbytes;
   mv_size_left (file->stat_info->archive_file_size - file->dumped_size);
   mv_size_left (file->stat_info->archive_file_size - file->dumped_size);
-      
+
   while (size_left > 0)
   while (size_left > 0)
     {
     {
       size_t bytes_read;
       size_t bytes_read;
@@ -564,7 +564,7 @@ sparse_diff_file (int fd, struct tar_stat_info *st)
   file.stat_info = st;
   file.stat_info = st;
   file.fd = fd;
   file.fd = fd;
   file.seekable = true; /* File *must* be seekable for compare to work */
   file.seekable = true; /* File *must* be seekable for compare to work */
-  
+
   rc = tar_sparse_decode_header (&file);
   rc = tar_sparse_decode_header (&file);
   mv_begin (st);
   mv_begin (st);
   for (i = 0; rc && i < file.stat_info->sparse_map_avail; i++)
   for (i = 0; rc && i < file.stat_info->sparse_map_avail; i++)
@@ -579,7 +579,7 @@ sparse_diff_file (int fd, struct tar_stat_info *st)
   if (!rc)
   if (!rc)
     skip_file (file.stat_info->archive_file_size - file.dumped_size);
     skip_file (file.stat_info->archive_file_size - file.dumped_size);
   mv_end ();
   mv_end ();
-  
+
   tar_sparse_done (&file);
   tar_sparse_done (&file);
   return rc;
   return rc;
 }
 }
@@ -851,13 +851,13 @@ static struct tar_sparse_optab const star_optab = {
    instances of GNU.sparse.offset/GNU.sparse.numbytes variables, whereas
    instances of GNU.sparse.offset/GNU.sparse.numbytes variables, whereas
    POSIX requires the latest occurrence of the variable to override all
    POSIX requires the latest occurrence of the variable to override all
    previous occurrences.
    previous occurrences.
-   
+
    To avoid this incompatibility two following versions were introduced.
    To avoid this incompatibility two following versions were introduced.
 
 
    * 0.1
    * 0.1
 
 
    Used by tar 1.15.2 -- 1.15.91 (alpha releases).
    Used by tar 1.15.2 -- 1.15.91 (alpha releases).
-   
+
    The sparse file map is stored in
    The sparse file map is stored in
    x header:
    x header:
 
 
@@ -875,18 +875,18 @@ static struct tar_sparse_optab const star_optab = {
    Starting from this version, the exact sparse format version is specified
    Starting from this version, the exact sparse format version is specified
    explicitely in the header using the following variables:
    explicitely in the header using the following variables:
 
 
-   GNU.sparse.major     Major version 
+   GNU.sparse.major     Major version
    GNU.sparse.minor     Minor version
    GNU.sparse.minor     Minor version
 
 
    X header keeps the following variables:
    X header keeps the following variables:
-   
+
    GNU.sparse.name      Real file name of the sparse file
    GNU.sparse.name      Real file name of the sparse file
    GNU.sparse.realsize  Real size of the stored file (corresponds to the old
    GNU.sparse.realsize  Real size of the stored file (corresponds to the old
                         GNU.sparse.size variable)
                         GNU.sparse.size variable)
 
 
    The name field of the ustar header is constructed using the pattern
    The name field of the ustar header is constructed using the pattern
    "%d/GNUSparseFile.%p/%f".
    "%d/GNUSparseFile.%p/%f".
-   
+
    The sparse map itself is stored in the file data block, preceding the actual
    The sparse map itself is stored in the file data block, preceding the actual
    file data. It consists of a series of octal numbers of arbitrary length,
    file data. It consists of a series of octal numbers of arbitrary length,
    delimited by newlines. The map is padded with nulls to the nearest block
    delimited by newlines. The map is padded with nulls to the nearest block
@@ -924,11 +924,11 @@ pax_dump_header_0 (struct tar_sparse_file *file)
   char nbuf[UINTMAX_STRSIZE_BOUND];
   char nbuf[UINTMAX_STRSIZE_BOUND];
   struct sp_array *map = file->stat_info->sparse_map;
   struct sp_array *map = file->stat_info->sparse_map;
   char *save_file_name = NULL;
   char *save_file_name = NULL;
-  
+
   /* Store the real file size */
   /* Store the real file size */
   xheader_store ("GNU.sparse.size", file->stat_info, NULL);
   xheader_store ("GNU.sparse.size", file->stat_info, NULL);
   xheader_store ("GNU.sparse.numblocks", file->stat_info, NULL);
   xheader_store ("GNU.sparse.numblocks", file->stat_info, NULL);
-  
+
   if (xheader_keyword_deleted_p ("GNU.sparse.map")
   if (xheader_keyword_deleted_p ("GNU.sparse.map")
       || tar_sparse_minor == 0)
       || tar_sparse_minor == 0)
     {
     {
@@ -991,7 +991,7 @@ pax_dump_header_1 (struct tar_sparse_file *file)
 #define COPY_STRING(b,dst,src) do                \
 #define COPY_STRING(b,dst,src) do                \
  {                                               \
  {                                               \
    char *endp = b->buffer + BLOCKSIZE;           \
    char *endp = b->buffer + BLOCKSIZE;           \
-   char *srcp = src;                             \
+   char const *srcp = src;                       \
    while (*srcp)                                 \
    while (*srcp)                                 \
      {                                           \
      {                                           \
        if (dst == endp)                          \
        if (dst == endp)                          \
@@ -1003,7 +1003,7 @@ pax_dump_header_1 (struct tar_sparse_file *file)
 	 }                                       \
 	 }                                       \
        *dst++ = *srcp++;                         \
        *dst++ = *srcp++;                         \
      }                                           \
      }                                           \
-   } while (0)                       
+   } while (0)
 
 
   /* Compute stored file size */
   /* Compute stored file size */
   p = umaxtostr (file->stat_info->sparse_map_avail, nbuf);
   p = umaxtostr (file->stat_info->sparse_map_avail, nbuf);
@@ -1018,13 +1018,13 @@ pax_dump_header_1 (struct tar_sparse_file *file)
   size = (size + BLOCKSIZE - 1) / BLOCKSIZE;
   size = (size + BLOCKSIZE - 1) / BLOCKSIZE;
   file->stat_info->archive_file_size += size * BLOCKSIZE;
   file->stat_info->archive_file_size += size * BLOCKSIZE;
   file->dumped_size += size * BLOCKSIZE;
   file->dumped_size += size * BLOCKSIZE;
-  
+
   /* Store sparse file identification */
   /* Store sparse file identification */
   xheader_store ("GNU.sparse.major", file->stat_info, NULL);
   xheader_store ("GNU.sparse.major", file->stat_info, NULL);
   xheader_store ("GNU.sparse.minor", file->stat_info, NULL);
   xheader_store ("GNU.sparse.minor", file->stat_info, NULL);
   xheader_store ("GNU.sparse.name", file->stat_info, NULL);
   xheader_store ("GNU.sparse.name", file->stat_info, NULL);
   xheader_store ("GNU.sparse.realsize", file->stat_info, NULL);
   xheader_store ("GNU.sparse.realsize", file->stat_info, NULL);
-  
+
   file->stat_info->file_name = xheader_format_name (file->stat_info,
   file->stat_info->file_name = xheader_format_name (file->stat_info,
 					    "%d/GNUSparseFile.%p/%f", 0);
 					    "%d/GNUSparseFile.%p/%f", 0);
 
 
@@ -1072,12 +1072,12 @@ decode_num (uintmax_t *num, char const *arg, uintmax_t maxval)
 
 
   if (!ISDIGIT (*arg))
   if (!ISDIGIT (*arg))
     return false;
     return false;
-  
+
   u = strtoumax (arg, &arg_lim, 10);
   u = strtoumax (arg, &arg_lim, 10);
 
 
   if (! (u <= maxval && errno != ERANGE) || *arg_lim)
   if (! (u <= maxval && errno != ERANGE) || *arg_lim)
     return false;
     return false;
-  
+
   *num = u;
   *num = u;
   return true;
   return true;
 }
 }
@@ -1117,7 +1117,7 @@ pax_decode_header (struct tar_sparse_file *file)
      }                                                             \
      }                                                             \
    while (*dst++ != '\n');                                         \
    while (*dst++ != '\n');                                         \
    dst[-1] = 0;                                                    \
    dst[-1] = 0;                                                    \
- } while (0)                       
+ } while (0)
 
 
       set_next_block_after (current_header);
       set_next_block_after (current_header);
       file->dumped_size += BLOCKSIZE;
       file->dumped_size += BLOCKSIZE;
@@ -1126,7 +1126,7 @@ pax_decode_header (struct tar_sparse_file *file)
       COPY_BUF (blk,nbuf,p);
       COPY_BUF (blk,nbuf,p);
       if (!decode_num (&u, nbuf, TYPE_MAXIMUM (size_t)))
       if (!decode_num (&u, nbuf, TYPE_MAXIMUM (size_t)))
 	{
 	{
-	  ERROR ((0, 0, _("%s: malformed sparse archive member"), 
+	  ERROR ((0, 0, _("%s: malformed sparse archive member"),
 		  file->stat_info->orig_file_name));
 		  file->stat_info->orig_file_name));
 	  return false;
 	  return false;
 	}
 	}
@@ -1137,11 +1137,11 @@ pax_decode_header (struct tar_sparse_file *file)
       for (i = 0; i < file->stat_info->sparse_map_size; i++)
       for (i = 0; i < file->stat_info->sparse_map_size; i++)
 	{
 	{
 	  struct sp_array sp;
 	  struct sp_array sp;
-	  
+
 	  COPY_BUF (blk,nbuf,p);
 	  COPY_BUF (blk,nbuf,p);
 	  if (!decode_num (&u, nbuf, TYPE_MAXIMUM (off_t)))
 	  if (!decode_num (&u, nbuf, TYPE_MAXIMUM (off_t)))
 	    {
 	    {
-	      ERROR ((0, 0, _("%s: malformed sparse archive member"), 
+	      ERROR ((0, 0, _("%s: malformed sparse archive member"),
 		      file->stat_info->orig_file_name));
 		      file->stat_info->orig_file_name));
 	      return false;
 	      return false;
 	    }
 	    }
@@ -1149,7 +1149,7 @@ pax_decode_header (struct tar_sparse_file *file)
 	  COPY_BUF (blk,nbuf,p);
 	  COPY_BUF (blk,nbuf,p);
 	  if (!decode_num (&u, nbuf, TYPE_MAXIMUM (size_t)))
 	  if (!decode_num (&u, nbuf, TYPE_MAXIMUM (size_t)))
 	    {
 	    {
-	      ERROR ((0, 0, _("%s: malformed sparse archive member"), 
+	      ERROR ((0, 0, _("%s: malformed sparse archive member"),
 		      file->stat_info->orig_file_name));
 		      file->stat_info->orig_file_name));
 	      return false;
 	      return false;
 	    }
 	    }
@@ -1158,7 +1158,7 @@ pax_decode_header (struct tar_sparse_file *file)
 	}
 	}
       set_next_block_after (blk);
       set_next_block_after (blk);
     }
     }
-  
+
   return true;
   return true;
 }
 }
 
 
@@ -1168,7 +1168,7 @@ static struct tar_sparse_optab const pax_optab = {
   pax_sparse_member_p,
   pax_sparse_member_p,
   pax_dump_header,
   pax_dump_header,
   NULL,
   NULL,
-  pax_decode_header,  
+  pax_decode_header,
   NULL,  /* No scan_block function */
   NULL,  /* No scan_block function */
   sparse_dump_region,
   sparse_dump_region,
   sparse_extract_region,
   sparse_extract_region,

+ 13 - 13
src/system.c

@@ -291,7 +291,7 @@ wait_for_grandchild (pid_t pid)
 {
 {
   int wait_status;
   int wait_status;
   int exit_code = 0;
   int exit_code = 0;
-  
+
   while (waitpid (pid, &wait_status, 0) == -1)
   while (waitpid (pid, &wait_status, 0) == -1)
     if (errno != EINTR)
     if (errno != EINTR)
       {
       {
@@ -303,7 +303,7 @@ wait_for_grandchild (pid_t pid)
     raise (WTERMSIG (wait_status));
     raise (WTERMSIG (wait_status));
   else if (WEXITSTATUS (wait_status) != 0)
   else if (WEXITSTATUS (wait_status) != 0)
     exit_code = WEXITSTATUS (wait_status);
     exit_code = WEXITSTATUS (wait_status);
-  
+
   exit (exit_code);
   exit (exit_code);
 }
 }
 
 
@@ -332,7 +332,7 @@ sys_child_open_for_compress (void)
 
 
   set_program_name (_("tar (child)"));
   set_program_name (_("tar (child)"));
   signal (SIGPIPE, SIG_DFL);
   signal (SIGPIPE, SIG_DFL);
-  
+
   xdup2 (parent_pipe[PREAD], STDIN_FILENO);
   xdup2 (parent_pipe[PREAD], STDIN_FILENO);
   xclose (parent_pipe[PWRITE]);
   xclose (parent_pipe[PWRITE]);
 
 
@@ -476,7 +476,7 @@ sys_child_open_for_uncompress (void)
 
 
   set_program_name (_("tar (child)"));
   set_program_name (_("tar (child)"));
   signal (SIGPIPE, SIG_DFL);
   signal (SIGPIPE, SIG_DFL);
-  
+
   xdup2 (parent_pipe[PWRITE], STDOUT_FILENO);
   xdup2 (parent_pipe[PWRITE], STDOUT_FILENO);
   xclose (parent_pipe[PREAD]);
   xclose (parent_pipe[PREAD]);
 
 
@@ -575,7 +575,7 @@ sys_child_open_for_uncompress (void)
 
 
 
 
 static void
 static void
-dec_to_env (char *envar, uintmax_t num)
+dec_to_env (char const *envar, uintmax_t num)
 {
 {
   char buf[UINTMAX_STRSIZE_BOUND];
   char buf[UINTMAX_STRSIZE_BOUND];
   char *numstr;
   char *numstr;
@@ -586,7 +586,7 @@ dec_to_env (char *envar, uintmax_t num)
 }
 }
 
 
 static void
 static void
-time_to_env (char *envar, struct timespec t)
+time_to_env (char const *envar, struct timespec t)
 {
 {
   char buf[TIMESPEC_STRSIZE_BOUND];
   char buf[TIMESPEC_STRSIZE_BOUND];
   if (setenv (envar, code_timespec (t, buf), 1) != 0)
   if (setenv (envar, code_timespec (t, buf), 1) != 0)
@@ -594,7 +594,7 @@ time_to_env (char *envar, struct timespec t)
 }
 }
 
 
 static void
 static void
-oct_to_env (char *envar, unsigned long num)
+oct_to_env (char const *envar, unsigned long num)
 {
 {
   char buf[1+1+(sizeof(unsigned long)*CHAR_BIT+2)/3];
   char buf[1+1+(sizeof(unsigned long)*CHAR_BIT+2)/3];
 
 
@@ -604,7 +604,7 @@ oct_to_env (char *envar, unsigned long num)
 }
 }
 
 
 static void
 static void
-str_to_env (char *envar, char const *str)
+str_to_env (char const *envar, char const *str)
 {
 {
   if (str)
   if (str)
     {
     {
@@ -616,7 +616,7 @@ str_to_env (char *envar, char const *str)
 }
 }
 
 
 static void
 static void
-chr_to_env (char *envar, char c)
+chr_to_env (char const *envar, char c)
 {
 {
   char buf[2];
   char buf[2];
   buf[0] = c;
   buf[0] = c;
@@ -750,7 +750,7 @@ sys_exec_info_script (const char **archive_name, int volume_number)
   char uintbuf[UINTMAX_STRSIZE_BOUND];
   char uintbuf[UINTMAX_STRSIZE_BOUND];
   int p[2];
   int p[2];
   static RETSIGTYPE (*saved_handler) (int sig);
   static RETSIGTYPE (*saved_handler) (int sig);
-  
+
   xpipe (p);
   xpipe (p);
   saved_handler = signal (SIGPIPE, SIG_IGN);
   saved_handler = signal (SIGPIPE, SIG_IGN);
 
 
@@ -783,7 +783,7 @@ sys_exec_info_script (const char **archive_name, int volume_number)
 	  }
 	  }
 
 
       signal (SIGPIPE, saved_handler);
       signal (SIGPIPE, saved_handler);
-      
+
       if (WIFEXITED (status))
       if (WIFEXITED (status))
 	{
 	{
 	  if (WEXITSTATUS (status) == 0 && rc > 0)
 	  if (WEXITSTATUS (status) == 0 && rc > 0)
@@ -813,7 +813,7 @@ sys_exec_info_script (const char **archive_name, int volume_number)
 
 
   argv[0] = "/bin/sh";
   argv[0] = "/bin/sh";
   argv[1] = "-c";
   argv[1] = "-c";
-  argv[2] = (char*) info_script_option;
+  argv[2] = (char *) info_script_option;
   argv[3] = NULL;
   argv[3] = NULL;
 
 
   execv (argv[0], argv);
   execv (argv[0], argv);
@@ -860,7 +860,7 @@ sys_exec_checkpoint_script (const char *script_name,
 				 archive_format : current_format), 1);
 				 archive_format : current_format), 1);
   argv[0] = "/bin/sh";
   argv[0] = "/bin/sh";
   argv[1] = "-c";
   argv[1] = "-c";
-  argv[2] = (char*) script_name;
+  argv[2] = (char *) script_name;
   argv[3] = NULL;
   argv[3] = NULL;
 
 
   execv (argv[0], argv);
   execv (argv[0], argv);

File diff suppressed because it is too large
+ 166 - 166
src/tar.c


+ 43 - 43
src/transform.c

@@ -1,4 +1,4 @@
-/* This file is part of GNU tar. 
+/* This file is part of GNU tar.
    Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
    Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
 
 
    This program is free software; you can redistribute it and/or modify it
    This program is free software; you can redistribute it and/or modify it
@@ -34,8 +34,8 @@ enum replace_segm_type
 
 
 enum case_ctl_type
 enum case_ctl_type
   {
   {
-    ctl_stop,       /* Stop case conversion */ 
-    ctl_upcase_next,/* Turn the next character to uppercase */ 
+    ctl_stop,       /* Stop case conversion */
+    ctl_upcase_next,/* Turn the next character to uppercase */
     ctl_locase_next,/* Turn the next character to lowercase */
     ctl_locase_next,/* Turn the next character to lowercase */
     ctl_upcase,     /* Turn the replacement to uppercase until ctl_stop */
     ctl_upcase,     /* Turn the replacement to uppercase until ctl_stop */
     ctl_locase      /* Turn the replacement to lowercase until ctl_stop */
     ctl_locase      /* Turn the replacement to lowercase until ctl_stop */
@@ -51,9 +51,9 @@ struct replace_segm
     {
     {
       char *ptr;
       char *ptr;
       size_t size;
       size_t size;
-    } literal;                /* type == segm_literal */   
+    } literal;                /* type == segm_literal */
     size_t ref;               /* type == segm_backref */
     size_t ref;               /* type == segm_backref */
-    enum case_ctl_type ctl;   /* type == segm_case_ctl */ 
+    enum case_ctl_type ctl;   /* type == segm_case_ctl */
   } v;
   } v;
 };
 };
 
 
@@ -75,7 +75,7 @@ int transform_flags = XFORM_ALL;
 static struct transform *transform_head, *transform_tail;
 static struct transform *transform_head, *transform_tail;
 
 
 static struct transform *
 static struct transform *
-new_transform ()
+new_transform (void)
 {
 {
   struct transform *p = xzalloc (sizeof *p);
   struct transform *p = xzalloc (sizeof *p);
   if (transform_tail)
   if (transform_tail)
@@ -146,7 +146,7 @@ parse_xform_flags (int *pflags, int c)
     case 'R':
     case 'R':
       *pflags &= ~XFORM_REGFILE;
       *pflags &= ~XFORM_REGFILE;
       break;
       break;
-	
+
     case 'h':
     case 'h':
       *pflags |= XFORM_LINK;
       *pflags |= XFORM_LINK;
       break;
       break;
@@ -154,7 +154,7 @@ parse_xform_flags (int *pflags, int c)
     case 'H':
     case 'H':
       *pflags &= ~XFORM_LINK;
       *pflags &= ~XFORM_LINK;
       break;
       break;
-	
+
     case 's':
     case 's':
       *pflags |= XFORM_SYMLINK;
       *pflags |= XFORM_SYMLINK;
       break;
       break;
@@ -204,10 +204,10 @@ parse_transform_expr (const char *expr)
 			      *expr));
 			      *expr));
 	    }
 	    }
 	  return expr;
 	  return expr;
-	}	  
+	}
       USAGE_ERROR ((0, 0, _("Invalid transform expression")));
       USAGE_ERROR ((0, 0, _("Invalid transform expression")));
     }
     }
-  
+
   delim = expr[1];
   delim = expr[1];
 
 
   /* Scan regular expression */
   /* Scan regular expression */
@@ -258,14 +258,14 @@ parse_transform_expr (const char *expr)
 
 
   if (*p == ';')
   if (*p == ';')
     p++;
     p++;
-  
+
   /* Extract and compile regex */
   /* Extract and compile regex */
   str = xmalloc (i - 1);
   str = xmalloc (i - 1);
   memcpy (str, expr + 2, i - 2);
   memcpy (str, expr + 2, i - 2);
   str[i - 2] = 0;
   str[i - 2] = 0;
 
 
   rc = regcomp (&tf->regex, str, cflags);
   rc = regcomp (&tf->regex, str, cflags);
-  
+
   if (rc)
   if (rc)
     {
     {
       char errbuf[512];
       char errbuf[512];
@@ -275,7 +275,7 @@ parse_transform_expr (const char *expr)
 
 
   if (str[0] == '^' || str[strlen (str) - 1] == '$')
   if (str[0] == '^' || str[strlen (str) - 1] == '$')
     tf->transform_type = transform_first;
     tf->transform_type = transform_first;
-  
+
   free (str);
   free (str);
 
 
   /* Extract and compile replacement expr */
   /* Extract and compile replacement expr */
@@ -289,7 +289,7 @@ parse_transform_expr (const char *expr)
       if (*cur == '\\')
       if (*cur == '\\')
 	{
 	{
 	  size_t n;
 	  size_t n;
-	  
+
 	  add_literal_segment (tf, beg, cur);
 	  add_literal_segment (tf, beg, cur);
 	  switch (*++cur)
 	  switch (*++cur)
 	    {
 	    {
@@ -310,32 +310,32 @@ parse_transform_expr (const char *expr)
 	      add_char_segment (tf, '\a');
 	      add_char_segment (tf, '\a');
 	      cur++;
 	      cur++;
 	      break;
 	      break;
-	      
+
 	    case 'b':
 	    case 'b':
 	      add_char_segment (tf, '\b');
 	      add_char_segment (tf, '\b');
 	      cur++;
 	      cur++;
 	      break;
 	      break;
-	      
+
 	    case 'f':
 	    case 'f':
 	      add_char_segment (tf, '\f');
 	      add_char_segment (tf, '\f');
 	      cur++;
 	      cur++;
 	      break;
 	      break;
-	      
+
 	    case 'n':
 	    case 'n':
 	      add_char_segment (tf, '\n');
 	      add_char_segment (tf, '\n');
 	      cur++;
 	      cur++;
 	      break;
 	      break;
-	      
+
 	    case 'r':
 	    case 'r':
 	      add_char_segment (tf, '\r');
 	      add_char_segment (tf, '\r');
 	      cur++;
 	      cur++;
 	      break;
 	      break;
-	      
+
 	    case 't':
 	    case 't':
 	      add_char_segment (tf, '\t');
 	      add_char_segment (tf, '\t');
 	      cur++;
 	      cur++;
 	      break;
 	      break;
-	      
+
 	    case 'v':
 	    case 'v':
 	      add_char_segment (tf, '\v');
 	      add_char_segment (tf, '\v');
 	      cur++;
 	      cur++;
@@ -345,39 +345,39 @@ parse_transform_expr (const char *expr)
 	      add_char_segment (tf, '&');
 	      add_char_segment (tf, '&');
 	      cur++;
 	      cur++;
 	      break;
 	      break;
-	      
+
 	    case 'L':
 	    case 'L':
 	      /* Turn the replacement to lowercase until a `\U' or `\E'
 	      /* Turn the replacement to lowercase until a `\U' or `\E'
 		 is found, */
 		 is found, */
 	      add_case_ctl_segment (tf, ctl_locase);
 	      add_case_ctl_segment (tf, ctl_locase);
 	      cur++;
 	      cur++;
 	      break;
 	      break;
- 
+
 	    case 'l':
 	    case 'l':
 	      /* Turn the next character to lowercase, */
 	      /* Turn the next character to lowercase, */
 	      add_case_ctl_segment (tf, ctl_locase_next);
 	      add_case_ctl_segment (tf, ctl_locase_next);
 	      cur++;
 	      cur++;
 	      break;
 	      break;
-	      
+
 	    case 'U':
 	    case 'U':
 	      /* Turn the replacement to uppercase until a `\L' or `\E'
 	      /* Turn the replacement to uppercase until a `\L' or `\E'
 		 is found, */
 		 is found, */
 	      add_case_ctl_segment (tf, ctl_upcase);
 	      add_case_ctl_segment (tf, ctl_upcase);
 	      cur++;
 	      cur++;
 	      break;
 	      break;
-	      
+
 	    case 'u':
 	    case 'u':
 	      /* Turn the next character to uppercase, */
 	      /* Turn the next character to uppercase, */
 	      add_case_ctl_segment (tf, ctl_upcase_next);
 	      add_case_ctl_segment (tf, ctl_upcase_next);
 	      cur++;
 	      cur++;
 	      break;
 	      break;
-	      
+
 	    case 'E':
 	    case 'E':
 	      /* Stop case conversion started by `\L' or `\U'. */
 	      /* Stop case conversion started by `\L' or `\U'. */
 	      add_case_ctl_segment (tf, ctl_stop);
 	      add_case_ctl_segment (tf, ctl_stop);
 	      cur++;
 	      cur++;
 	      break;
 	      break;
-  
+
 	    default:
 	    default:
 	      /* Try to be nice */
 	      /* Try to be nice */
 	      {
 	      {
@@ -420,7 +420,7 @@ run_case_conv (enum case_ctl_type case_ctl, char *ptr, size_t size)
   static char *case_ctl_buffer;
   static char *case_ctl_buffer;
   static size_t case_ctl_bufsize;
   static size_t case_ctl_bufsize;
   char *p;
   char *p;
-  
+
   if (case_ctl_bufsize < size)
   if (case_ctl_bufsize < size)
     {
     {
       case_ctl_bufsize = size;
       case_ctl_bufsize = size;
@@ -432,16 +432,16 @@ run_case_conv (enum case_ctl_type case_ctl, char *ptr, size_t size)
     case ctl_upcase_next:
     case ctl_upcase_next:
       case_ctl_buffer[0] = toupper ((unsigned char) case_ctl_buffer[0]);
       case_ctl_buffer[0] = toupper ((unsigned char) case_ctl_buffer[0]);
       break;
       break;
-      
+
     case ctl_locase_next:
     case ctl_locase_next:
       case_ctl_buffer[0] = tolower ((unsigned char) case_ctl_buffer[0]);
       case_ctl_buffer[0] = tolower ((unsigned char) case_ctl_buffer[0]);
       break;
       break;
-      
+
     case ctl_upcase:
     case ctl_upcase:
       for (p = case_ctl_buffer; p < case_ctl_buffer + size; p++)
       for (p = case_ctl_buffer; p < case_ctl_buffer + size; p++)
 	*p = toupper ((unsigned char) *p);
 	*p = toupper ((unsigned char) *p);
       break;
       break;
-      
+
     case ctl_locase:
     case ctl_locase:
       for (p = case_ctl_buffer; p < case_ctl_buffer + size; p++)
       for (p = case_ctl_buffer; p < case_ctl_buffer + size; p++)
 	*p = tolower ((unsigned char) *p);
 	*p = tolower ((unsigned char) *p);
@@ -457,7 +457,7 @@ run_case_conv (enum case_ctl_type case_ctl, char *ptr, size_t size)
 static struct obstack stk;
 static struct obstack stk;
 static bool stk_init;
 static bool stk_init;
 
 
-void
+static void
 _single_transform_name_to_obstack (struct transform *tf, char *input)
 _single_transform_name_to_obstack (struct transform *tf, char *input)
 {
 {
   regmatch_t *rmp;
   regmatch_t *rmp;
@@ -465,7 +465,7 @@ _single_transform_name_to_obstack (struct transform *tf, char *input)
   size_t nmatches = 0;
   size_t nmatches = 0;
   enum case_ctl_type case_ctl = ctl_stop,  /* Current case conversion op */
   enum case_ctl_type case_ctl = ctl_stop,  /* Current case conversion op */
                      save_ctl = ctl_stop;  /* Saved case_ctl for \u and \l */
                      save_ctl = ctl_stop;  /* Saved case_ctl for \u and \l */
-  
+
   /* Reset case conversion after a single-char operation */
   /* Reset case conversion after a single-char operation */
 #define CASE_CTL_RESET()  if (case_ctl == ctl_upcase_next     \
 #define CASE_CTL_RESET()  if (case_ctl == ctl_upcase_next     \
 			      || case_ctl == ctl_locase_next) \
 			      || case_ctl == ctl_locase_next) \
@@ -473,20 +473,20 @@ _single_transform_name_to_obstack (struct transform *tf, char *input)
                               case_ctl = save_ctl;            \
                               case_ctl = save_ctl;            \
                               save_ctl = ctl_stop;            \
                               save_ctl = ctl_stop;            \
 			    }
 			    }
-  
+
   rmp = xmalloc ((tf->regex.re_nsub + 1) * sizeof (*rmp));
   rmp = xmalloc ((tf->regex.re_nsub + 1) * sizeof (*rmp));
 
 
   while (*input)
   while (*input)
     {
     {
       size_t disp;
       size_t disp;
       char *ptr;
       char *ptr;
-      
+
       rc = regexec (&tf->regex, input, tf->regex.re_nsub + 1, rmp, 0);
       rc = regexec (&tf->regex, input, tf->regex.re_nsub + 1, rmp, 0);
-      
+
       if (rc == 0)
       if (rc == 0)
 	{
 	{
 	  struct replace_segm *segm;
 	  struct replace_segm *segm;
-	  
+
 	  disp = rmp[0].rm_eo;
 	  disp = rmp[0].rm_eo;
 
 
 	  if (rmp[0].rm_so)
 	  if (rmp[0].rm_so)
@@ -516,7 +516,7 @@ _single_transform_name_to_obstack (struct transform *tf, char *input)
 		    }
 		    }
 		  obstack_grow (&stk, ptr, segm->v.literal.size);
 		  obstack_grow (&stk, ptr, segm->v.literal.size);
 		  break;
 		  break;
-	      
+
 		case segm_backref:    /* Back-reference segment */
 		case segm_backref:    /* Back-reference segment */
 		  if (rmp[segm->v.ref].rm_so != -1
 		  if (rmp[segm->v.ref].rm_so != -1
 		      && rmp[segm->v.ref].rm_eo != -1)
 		      && rmp[segm->v.ref].rm_eo != -1)
@@ -529,7 +529,7 @@ _single_transform_name_to_obstack (struct transform *tf, char *input)
 			  ptr = run_case_conv (case_ctl, ptr, size);
 			  ptr = run_case_conv (case_ctl, ptr, size);
 			  CASE_CTL_RESET();
 			  CASE_CTL_RESET();
 			}
 			}
-		      
+
 		      obstack_grow (&stk, ptr, size);
 		      obstack_grow (&stk, ptr, size);
 		    }
 		    }
 		  break;
 		  break;
@@ -549,7 +549,7 @@ _single_transform_name_to_obstack (struct transform *tf, char *input)
 			  break;
 			  break;
 			}
 			}
 		      /*FALL THROUGH*/
 		      /*FALL THROUGH*/
-		      
+
 		    case ctl_upcase:
 		    case ctl_upcase:
 		    case ctl_locase:
 		    case ctl_locase:
 		    case ctl_stop:
 		    case ctl_stop:
@@ -577,18 +577,18 @@ _single_transform_name_to_obstack (struct transform *tf, char *input)
   free (rmp);
   free (rmp);
 }
 }
 
 
-bool
+static bool
 _transform_name_to_obstack (int flags, char *input, char **output)
 _transform_name_to_obstack (int flags, char *input, char **output)
 {
 {
   struct transform *tf;
   struct transform *tf;
   bool alloced = false;
   bool alloced = false;
-  
+
   if (!stk_init)
   if (!stk_init)
     {
     {
       obstack_init (&stk);
       obstack_init (&stk);
       stk_init = true;
       stk_init = true;
     }
     }
-  
+
   for (tf = transform_head; tf; tf = tf->next)
   for (tf = transform_head; tf; tf = tf->next)
     {
     {
       if (tf->flags & flags)
       if (tf->flags & flags)
@@ -601,7 +601,7 @@ _transform_name_to_obstack (int flags, char *input, char **output)
   *output = input;
   *output = input;
   return alloced;
   return alloced;
 }
 }
-  
+
 bool
 bool
 transform_name_fp (char **pinput, int flags,
 transform_name_fp (char **pinput, int flags,
 		   char *(*fun)(char *, void *), void *dat)
 		   char *(*fun)(char *, void *), void *dat)

+ 5 - 5
src/unlink.c

@@ -1,4 +1,4 @@
-/* This file is part of GNU tar. 
+/* This file is part of GNU tar.
    Copyright (C) 2009 Free Software Foundation, Inc.
    Copyright (C) 2009 Free Software Foundation, Inc.
 
 
    This program is free software; you can redistribute it and/or modify it
    This program is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@ static struct deferred_unlink *dunlink_avail;
 size_t deferred_unlink_delay = 0;
 size_t deferred_unlink_delay = 0;
 
 
 static struct deferred_unlink *
 static struct deferred_unlink *
-dunlink_alloc ()
+dunlink_alloc (void)
 {
 {
   struct deferred_unlink *p;
   struct deferred_unlink *p;
   if (dunlink_avail)
   if (dunlink_avail)
@@ -116,7 +116,7 @@ flush_deferred_unlinks (bool force)
 	{
 	{
 	  prev = p;
 	  prev = p;
 	  p = next;
 	  p = next;
-	}	  
+	}
     }
     }
   if (!dunlink_head)
   if (!dunlink_head)
     dunlink_tail = NULL;
     dunlink_tail = NULL;
@@ -142,13 +142,13 @@ queue_deferred_unlink (const char *name, bool is_dir)
   if (dunlink_head
   if (dunlink_head
       && records_written > dunlink_head->records_written + deferred_unlink_delay)
       && records_written > dunlink_head->records_written + deferred_unlink_delay)
     flush_deferred_unlinks (false);
     flush_deferred_unlinks (false);
-  
+
   p = dunlink_alloc ();
   p = dunlink_alloc ();
   p->next = NULL;
   p->next = NULL;
   p->file_name = normalize_filename (name);
   p->file_name = normalize_filename (name);
   p->is_dir = is_dir;
   p->is_dir = is_dir;
   p->records_written = records_written;
   p->records_written = records_written;
-  
+
   if (dunlink_tail)
   if (dunlink_tail)
     dunlink_tail->next = p;
     dunlink_tail->next = p;
   else
   else

Some files were not shown because too many files changed in this diff