Explorar el Código

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

+ 12 - 13
src/checkpoint.c

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

+ 5 - 5
src/common.h

@@ -1,7 +1,7 @@
 /* Common declarations for the tar program.
 
    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.
 
    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 */
     bool cmdline;               /* true if this name was given in the
 				   command line */
-    
+
     int change_dir;		/* Number of the directory to change to.
 				   Set with the -C option. */
     uintmax_t found_count;	/* number of times a matching file has
 				   been found */
-    
+
     /* The following members are used for incremental dumps only,
        if this struct name represents a directory;
        see incremen.c */
@@ -465,7 +465,7 @@ void exclusion_tag_warning (const char *dirname, const char *tagname,
 			    const char *message);
 enum exclusion_tag_type check_exclusion_tags (const char *dirname,
 					      const char **tag_file_name);
-     
+
 #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 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);
 bool name_match (const char *name);
 void names_notfound (void);
+void label_notfound (void);
 void collect_and_sort_names (void);
 struct name *name_scan (const char *name);
 struct name const *name_from_list (void);
@@ -858,4 +859,3 @@ void finish_deferred_unlinks (void);
 
 /* Module exit.c */
 extern void (*fatal_exit_hook) (void);
-

+ 14 - 15
src/extract.c

@@ -146,7 +146,7 @@ set_mode (char const *file_name,
 {
   mode_t mode;
   bool failed;
-  
+
   if (0 < same_permissions_option
       && permstatus != INTERDIR_PERMSTATUS)
     {
@@ -893,10 +893,10 @@ create_placeholder_file (char *file_name, bool is_symlink, int *interdir_made)
 	{
 	case RECOVER_OK:
 	  continue;
-	  
+
 	case RECOVER_SKIP:
 	  return 0;
-	  
+
 	case RECOVER_NO:
 	  open_error (file_name);
 	  return -1;
@@ -967,9 +967,9 @@ extract_link (char *file_name, int typeflag)
   int interdir_made = 0;
   char const *link_name;
   int rc;
-  
+
   link_name = current_stat_info.link_name;
-  
+
   if (! absolute_names_option && contains_dot_dot (link_name))
     return create_placeholder_file (file_name, false, &interdir_made);
 
@@ -1035,15 +1035,15 @@ extract_symlink (char *file_name, int typeflag)
       {
       case RECOVER_OK:
 	continue;
-	
+
       case RECOVER_SKIP:
 	return 0;
-	
+
       case RECOVER_NO:
 	symlink_error (current_stat_info.link_name, file_name);
 	return -1;
       }
-  
+
   set_stat (file_name, &current_stat_info, NULL, 0, 0, SYMTYPE);
   return 0;
 
@@ -1065,7 +1065,6 @@ extract_symlink (char *file_name, int typeflag)
 static int
 extract_node (char *file_name, int typeflag)
 {
-  int status;
   int interdir_made = 0;
   mode_t mode = current_stat_info.stat.st_mode & ~ current_umask;
   mode_t invert_permissions =
@@ -1077,10 +1076,10 @@ extract_node (char *file_name, int typeflag)
       {
       case RECOVER_OK:
 	continue;
-	
+
       case RECOVER_SKIP:
 	return 0;
-	
+
       case RECOVER_NO:
 	mknod_error (file_name);
 	return -1;
@@ -1088,7 +1087,7 @@ extract_node (char *file_name, int typeflag)
 
   set_stat (file_name, &current_stat_info, NULL, invert_permissions,
 	    ARCHIVED_PERMSTATUS, typeflag);
-  return status;
+  return 0;
 }
 #endif
 
@@ -1107,10 +1106,10 @@ extract_fifo (char *file_name, int typeflag)
       {
       case RECOVER_OK:
 	continue;
-	
+
       case RECOVER_SKIP:
 	return 0;
-	
+
       case RECOVER_NO:
 	mkfifo_error (file_name);
 	return -1;
@@ -1274,7 +1273,7 @@ extract_archive (void)
   tar_extractor_t fun;
 
   fatal_exit_hook = extract_finish;
-  
+
   /* Try to disable the ability to unlink a directory.  */
   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;
   char *p;
   const char *q;
-  
+
   for (i = 0, total = 0, ctsize = 1, q = contents; *q; total++, q += len)
     {
       len = strlen (q) + 1;
@@ -146,7 +146,7 @@ dumpdir_locate (struct dumpdir *dump, const char *name)
 struct dumpdir_iter
 {
   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 */
 };
 
@@ -155,7 +155,7 @@ dumpdir_next (struct dumpdir_iter *itr)
 {
   size_t cur = itr->next;
   char *ret = NULL;
-  
+
   if (itr->all)
     {
       ret = itr->dump->contents + cur;
@@ -288,9 +288,9 @@ attach_directory (const char *name)
   dirtail = dir;
   return dir;
 }
-		 
+
 
-void
+static void
 dirlist_replace_prefix (const char *pref, const char *repl)
 {
   struct directory *dp;
@@ -414,7 +414,7 @@ update_parent_directory (const char *name)
       struct stat st;
       if (deref_stat (dereference_option, p, &st) != 0)
 	{
-	  if (errno != ENOENT) 
+	  if (errno != ENOENT)
 	    stat_diag (directory->name);
 	  /* else: should have been already reported */
 	}
@@ -457,14 +457,14 @@ procdir (const char *name_buffer, struct stat *stat_data,
 	  *entry = 'N';
 	  return directory;
 	}
-      
+
       /* With NFS, the same file can have two different devices
 	 if an NFS directory is mounted in multiple locations,
 	 which is relatively common when automounting.
 	 To avoid spurious incremental redumping of
 	 directories, consider all NFS devices as equal,
 	 relying on the i-node to establish differences.  */
-      
+
       if (! ((!check_device_option
 	      || (DIR_IS_NFS (directory) && nfs)
 	      || directory->device_number == stat_data->st_dev)
@@ -502,14 +502,14 @@ procdir (const char *name_buffer, struct stat *stat_data,
 	}
       else
 	directory->children = CHANGED_CHILDREN;
-      
+
       DIR_SET_FLAG (directory, DIRF_FOUND);
     }
   else
     {
       struct directory *d = find_directory_meta (stat_data->st_dev,
 						 stat_data->st_ino);
-      
+
       directory = note_directory (name_buffer,
 				  get_stat_mtime(stat_data),
 				  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
       /* ... except if it was explicitely given in the command line */
       && !is_individual_file (name_buffer))
-    /* FIXME: 
+    /* FIXME:
 	WARNOPT (WARN_XDEV,
 		 (0, 0,
 		  _("%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)
 	*entry = 'N';
     }
-	  
+
   DIR_SET_FLAG (directory, DIRF_INIT);
 
   if (directory->children != NO_CHILDREN)
@@ -590,13 +590,13 @@ procdir (const char *name_buffer, struct stat *stat_data,
 				 _("contents not dumped"));
 	  directory->children = NO_CHILDREN;
 	  break;
-	  
+
 	case exclusion_tag_under:
 	  exclusion_tag_warning (name_buffer, tag_file_name,
 				 _("contents not dumped"));
 	  directory->tagfile = tag_file_name;
 	  break;
-	  
+
 	case exclusion_tag_none:
 	  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
    prefixed with ' ' if it was present in DUMP and with 'Y' otherwise. */
 
-void
+static void
 makedumpdir (struct directory *directory, const char *dir)
 {
   size_t i,
@@ -697,13 +697,13 @@ scan_directory (char *dir, dev_t device, bool cmdline)
   struct stat stat_data;
   struct directory *directory;
   char ch;
-  
+
   if (! dirp)
     savedir_error (dir);
 
   tmp = xstrdup (dir);
   zap_slashes (tmp);
-  
+
   if (deref_stat (dereference_option, tmp, &stat_data))
     {
       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,
 		       (cmdline ? PD_FORCE_INIT : 0),
 		       &ch);
-  
+
   free (tmp);
 
   nbuf = namebuf_create (dir);
@@ -809,9 +809,9 @@ name_fill_directory (struct name *name, dev_t device, bool cmdline)
 
 
 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 :
                      safer_name_suffix (from, false, absolute_names_option);
@@ -874,7 +874,7 @@ append_incremental_renames (struct directory *dir)
   size_t size;
   struct directory *dp;
   const char *dump;
-  
+
   if (dirhead == NULL)
     return;
 
@@ -1217,7 +1217,7 @@ read_timespec (FILE *fp, struct timespec *pval)
 
 /* Read incremental snapshot format 2 */
 static void
-read_incr_db_2 ()
+read_incr_db_2 (void)
 {
   uintmax_t u;
   struct obstack stk;
@@ -1312,7 +1312,7 @@ read_directory_file (void)
      which is necessary to recreate absolute file names. */
   name_from_list ();
   blank_name_list ();
-  
+
   if (0 < getline (&buf, &bufsize, listed_incremental_stream))
     {
       char *ebuf;
@@ -1367,7 +1367,7 @@ write_directory_file_entry (void *entry, void *data)
   if (DIR_IS_FOUND (directory))
     {
       char buf[UINTMAX_STRSIZE_BOUND];
-      char *s;
+      char const *s;
 
       s = DIR_IS_NFS (directory) ? "1" : "0";
       fwrite (s, 2, 1, fp);
@@ -1707,7 +1707,7 @@ try_purge_directory (char const *directory_name)
     }
   free (p);
   dumpdir_free (dump);
-  
+
   free (current_dir);
   return true;
 }

+ 12 - 12
src/list.c

@@ -78,7 +78,7 @@ read_and (void (*do_something) (void))
       prev_status = status;
       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);
       switch (status)
 	{
@@ -140,7 +140,7 @@ read_and (void (*do_something) (void))
 	    {
 	      char buf[UINTMAX_STRSIZE_BOUND];
 
-	      status = read_header (&current_header, &current_stat_info, 
+	      status = read_header (&current_header, &current_stat_info,
 	                            read_header_auto);
 	      if (status == HEADER_ZERO_BLOCK)
 		break;
@@ -210,7 +210,7 @@ list_archive (void)
   off_t block_ordinal = current_block_ordinal ();
 
   /* Print the header block.  */
-  
+
   decode_header (current_header, &current_stat_info, &current_format, 0);
   if (verbose_option)
     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
 	 solution, symbolic links are exempt from component stripping and
 	 name suffix normalization, but subject to filename transformation
-	 proper. */ 
+	 proper. */
       return file_name;
-      
+
     case XFORM_LINK:
       file_name = safer_name_suffix (file_name, true, absolute_names_option);
       break;
-      
+
     case XFORM_REGFILE:
       file_name = safer_name_suffix (file_name, false, absolute_names_option);
       break;
     }
-  
+
   if (strip_name_components)
     {
       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;
   unsigned hbits; /* high bits of the file mode. */
   mode_t mode = MODE_FROM_HEADER (header->header.mode, &hbits);
-  
+
   if (strcmp (header->header.magic, TMAGIC) == 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:
       transform_member_name (&stat_info->link_name, XFORM_SYMLINK);
       break;
-      
+
     case LNKTYPE:
       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;
   union block vblk;
@@ -1416,7 +1416,7 @@ test_archive_label ()
 		     &current_stat_info, &current_format, 0);
       if (current_header->header.typeflag == GNUTYPE_VOLHDR)
 	assign_string (&volume_label, current_header->header.name);
-      
+
       if (volume_label)
 	{
 	  if (verbose_option)

+ 5 - 6
src/misc.c

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

+ 23 - 32
src/names.c

@@ -27,15 +27,6 @@
 
 /* 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
    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
@@ -179,7 +170,7 @@ gname_to_gid (char const *gname, gid_t *gidp)
 }
 
 
-struct name *
+static struct name *
 make_name (const char *file_name)
 {
   struct name *p = xzalloc (sizeof (*p));
@@ -190,7 +181,7 @@ make_name (const char *file_name)
   return p;
 }
 
-void
+static void
 free_name (struct name *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 *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
    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
    limited memory.  With this option on, namelist contains at most one
    entry, which diminishes the memory consumption.
-   
+
    However, I very much doubt if we still need this -- Sergey */
 
 /* A name_array element contains entries of three types: */
@@ -230,7 +221,7 @@ struct name_elt        /* A name_array element. */
   union
   {
     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;
 };
 
@@ -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.  */
 static void
-check_name_alloc ()
+check_name_alloc (void)
 {
   if (names == allocated_names)
     {
@@ -282,7 +273,7 @@ name_add_dir (const char *name)
   ep = &name_array[names++];
   ep->type = NELT_CHDIR;
   ep->v.name = name;
-}  
+}
 
 
 /* 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
    the request to change to the given directory.
-   
+
    Entries of type NELT_FMASK cause updates of the matching_flags
    value. */
-struct name_elt *
+static struct name_elt *
 name_next_elt (int change_dirs)
 {
   static struct name_elt entry;
@@ -327,14 +318,14 @@ name_next_elt (int change_dirs)
     {
       struct name_elt *ep;
       size_t source_len;
-      
+
       ep = &name_array[name_index++];
       if (ep->type == NELT_FMASK)
 	{
 	  matching_flags = ep->v.matching_flags;
 	  continue;
 	}
-      
+
       source = ep->v.name;
       source_len = strlen (source);
       if (name_buffer_length < source_len)
@@ -421,7 +412,7 @@ name_gather (void)
 	  buffer->directory = NULL;
 	  buffer->parent = NULL;
 	  buffer->cmdline = true;
-	  
+
 	  namelist = nametail = buffer;
 	}
       else if (change_dir)
@@ -519,7 +510,7 @@ name_match (const char *file_name)
 
       if (!cursor)
 	return true;
-      
+
       if (cursor->name[0] == 0)
 	{
 	  chdir_do (cursor->change_dir);
@@ -616,7 +607,7 @@ names_notfound (void)
     if (!WASFOUND (cursor) && cursor->name[0])
       {
 	regex_usage_warning (cursor->name);
-	ERROR ((0, 0, 
+	ERROR ((0, 0,
 		(cursor->found_count == 0) ?
 		     _("%s: Not found in archive") :
 		     _("%s: Required occurrence not found in archive"),
@@ -647,7 +638,7 @@ label_notfound (void)
 
   if (!namelist)
     return;
-  
+
   for (cursor = namelist; cursor; cursor = cursor->next)
     if (WASFOUND (cursor))
       return;
@@ -681,7 +672,7 @@ label_notfound (void)
 /* Sort *singly* linked LIST of names, of given LENGTH, using COMPARE
    to order names.  Return the sorted list.  Note that after calling
    this function, the `prev' links in list elements are messed up.
-   
+
    Apart from the type `struct name' and the definition of SUCCESSOR,
    this is a generic list-sorting function, but it's too painful to
    make it both generic and portable
@@ -797,7 +788,7 @@ static void
 add_hierarchy_to_namelist (struct name *name, dev_t device, bool cmdline)
 {
   const char *buffer;
-  
+
   name_fill_directory (name, device, cmdline);
   buffer = directory_contents (name->directory);
   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 new_prefix_len = parent->length;
   char *new_prefix = parent->name;
-  
+
   for (; child; child = child->sibling)
     {
       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;
 
       rebase_directory (child->directory,
-			child->parent->name, old_prefix_len, 
+			child->parent->name, old_prefix_len,
 			new_prefix, new_prefix_len);
     }
 }
@@ -911,7 +902,7 @@ collect_and_sort_names (void)
   int num_names;
   struct stat statbuf;
   Hash_table *nametab;
-  
+
   name_gather ();
 
   if (!namelist)
@@ -939,7 +930,7 @@ collect_and_sort_names (void)
 
       read_directory_file ();
     }
-  
+
   num_names = 0;
   for (name = namelist; name; name = name->next, num_names++)
     {
@@ -1115,12 +1106,12 @@ static void
 register_individual_file (char const *name)
 {
   struct stat st;
-  
+
   if (deref_stat (dereference_option, name, &st) != 0)
     return; /* Will be complained about later */
   if (S_ISDIR (st.st_mode))
     return;
-  
+
   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;
 
   st->archive_file_size = 0;
-  
+
   if (!tar_sparse_scan (file, scan_begin, NULL))
     return false;
 
@@ -514,7 +514,7 @@ check_data_region (struct tar_sparse_file *file, size_t i)
     return false;
   size_left = file->stat_info->sparse_map[i].numbytes;
   mv_size_left (file->stat_info->archive_file_size - file->dumped_size);
-      
+
   while (size_left > 0)
     {
       size_t bytes_read;
@@ -564,7 +564,7 @@ sparse_diff_file (int fd, struct tar_stat_info *st)
   file.stat_info = st;
   file.fd = fd;
   file.seekable = true; /* File *must* be seekable for compare to work */
-  
+
   rc = tar_sparse_decode_header (&file);
   mv_begin (st);
   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)
     skip_file (file.stat_info->archive_file_size - file.dumped_size);
   mv_end ();
-  
+
   tar_sparse_done (&file);
   return rc;
 }
@@ -851,13 +851,13 @@ static struct tar_sparse_optab const star_optab = {
    instances of GNU.sparse.offset/GNU.sparse.numbytes variables, whereas
    POSIX requires the latest occurrence of the variable to override all
    previous occurrences.
-   
+
    To avoid this incompatibility two following versions were introduced.
 
    * 0.1
 
    Used by tar 1.15.2 -- 1.15.91 (alpha releases).
-   
+
    The sparse file map is stored in
    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
    explicitely in the header using the following variables:
 
-   GNU.sparse.major     Major version 
+   GNU.sparse.major     Major version
    GNU.sparse.minor     Minor version
 
    X header keeps the following variables:
-   
+
    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.size variable)
 
    The name field of the ustar header is constructed using the pattern
    "%d/GNUSparseFile.%p/%f".
-   
+
    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,
    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];
   struct sp_array *map = file->stat_info->sparse_map;
   char *save_file_name = NULL;
-  
+
   /* Store the real file size */
   xheader_store ("GNU.sparse.size", file->stat_info, NULL);
   xheader_store ("GNU.sparse.numblocks", file->stat_info, NULL);
-  
+
   if (xheader_keyword_deleted_p ("GNU.sparse.map")
       || tar_sparse_minor == 0)
     {
@@ -991,7 +991,7 @@ pax_dump_header_1 (struct tar_sparse_file *file)
 #define COPY_STRING(b,dst,src) do                \
  {                                               \
    char *endp = b->buffer + BLOCKSIZE;           \
-   char *srcp = src;                             \
+   char const *srcp = src;                       \
    while (*srcp)                                 \
      {                                           \
        if (dst == endp)                          \
@@ -1003,7 +1003,7 @@ pax_dump_header_1 (struct tar_sparse_file *file)
 	 }                                       \
        *dst++ = *srcp++;                         \
      }                                           \
-   } while (0)                       
+   } while (0)
 
   /* Compute stored file size */
   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;
   file->stat_info->archive_file_size += size * BLOCKSIZE;
   file->dumped_size += size * BLOCKSIZE;
-  
+
   /* Store sparse file identification */
   xheader_store ("GNU.sparse.major", 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.realsize", file->stat_info, NULL);
-  
+
   file->stat_info->file_name = xheader_format_name (file->stat_info,
 					    "%d/GNUSparseFile.%p/%f", 0);
 
@@ -1072,12 +1072,12 @@ decode_num (uintmax_t *num, char const *arg, uintmax_t maxval)
 
   if (!ISDIGIT (*arg))
     return false;
-  
+
   u = strtoumax (arg, &arg_lim, 10);
 
   if (! (u <= maxval && errno != ERANGE) || *arg_lim)
     return false;
-  
+
   *num = u;
   return true;
 }
@@ -1117,7 +1117,7 @@ pax_decode_header (struct tar_sparse_file *file)
      }                                                             \
    while (*dst++ != '\n');                                         \
    dst[-1] = 0;                                                    \
- } while (0)                       
+ } while (0)
 
       set_next_block_after (current_header);
       file->dumped_size += BLOCKSIZE;
@@ -1126,7 +1126,7 @@ pax_decode_header (struct tar_sparse_file *file)
       COPY_BUF (blk,nbuf,p);
       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));
 	  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++)
 	{
 	  struct sp_array sp;
-	  
+
 	  COPY_BUF (blk,nbuf,p);
 	  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));
 	      return false;
 	    }
@@ -1149,7 +1149,7 @@ pax_decode_header (struct tar_sparse_file *file)
 	  COPY_BUF (blk,nbuf,p);
 	  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));
 	      return false;
 	    }
@@ -1158,7 +1158,7 @@ pax_decode_header (struct tar_sparse_file *file)
 	}
       set_next_block_after (blk);
     }
-  
+
   return true;
 }
 
@@ -1168,7 +1168,7 @@ static struct tar_sparse_optab const pax_optab = {
   pax_sparse_member_p,
   pax_dump_header,
   NULL,
-  pax_decode_header,  
+  pax_decode_header,
   NULL,  /* No scan_block function */
   sparse_dump_region,
   sparse_extract_region,

+ 13 - 13
src/system.c

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

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 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.
 
    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
   {
-    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_upcase,     /* Turn the replacement to uppercase until ctl_stop */
     ctl_locase      /* Turn the replacement to lowercase until ctl_stop */
@@ -51,9 +51,9 @@ struct replace_segm
     {
       char *ptr;
       size_t size;
-    } literal;                /* type == segm_literal */   
+    } literal;                /* type == segm_literal */
     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;
 };
 
@@ -75,7 +75,7 @@ int transform_flags = XFORM_ALL;
 static struct transform *transform_head, *transform_tail;
 
 static struct transform *
-new_transform ()
+new_transform (void)
 {
   struct transform *p = xzalloc (sizeof *p);
   if (transform_tail)
@@ -146,7 +146,7 @@ parse_xform_flags (int *pflags, int c)
     case 'R':
       *pflags &= ~XFORM_REGFILE;
       break;
-	
+
     case 'h':
       *pflags |= XFORM_LINK;
       break;
@@ -154,7 +154,7 @@ parse_xform_flags (int *pflags, int c)
     case 'H':
       *pflags &= ~XFORM_LINK;
       break;
-	
+
     case 's':
       *pflags |= XFORM_SYMLINK;
       break;
@@ -204,10 +204,10 @@ parse_transform_expr (const char *expr)
 			      *expr));
 	    }
 	  return expr;
-	}	  
+	}
       USAGE_ERROR ((0, 0, _("Invalid transform expression")));
     }
-  
+
   delim = expr[1];
 
   /* Scan regular expression */
@@ -258,14 +258,14 @@ parse_transform_expr (const char *expr)
 
   if (*p == ';')
     p++;
-  
+
   /* Extract and compile regex */
   str = xmalloc (i - 1);
   memcpy (str, expr + 2, i - 2);
   str[i - 2] = 0;
 
   rc = regcomp (&tf->regex, str, cflags);
-  
+
   if (rc)
     {
       char errbuf[512];
@@ -275,7 +275,7 @@ parse_transform_expr (const char *expr)
 
   if (str[0] == '^' || str[strlen (str) - 1] == '$')
     tf->transform_type = transform_first;
-  
+
   free (str);
 
   /* Extract and compile replacement expr */
@@ -289,7 +289,7 @@ parse_transform_expr (const char *expr)
       if (*cur == '\\')
 	{
 	  size_t n;
-	  
+
 	  add_literal_segment (tf, beg, cur);
 	  switch (*++cur)
 	    {
@@ -310,32 +310,32 @@ parse_transform_expr (const char *expr)
 	      add_char_segment (tf, '\a');
 	      cur++;
 	      break;
-	      
+
 	    case 'b':
 	      add_char_segment (tf, '\b');
 	      cur++;
 	      break;
-	      
+
 	    case 'f':
 	      add_char_segment (tf, '\f');
 	      cur++;
 	      break;
-	      
+
 	    case 'n':
 	      add_char_segment (tf, '\n');
 	      cur++;
 	      break;
-	      
+
 	    case 'r':
 	      add_char_segment (tf, '\r');
 	      cur++;
 	      break;
-	      
+
 	    case 't':
 	      add_char_segment (tf, '\t');
 	      cur++;
 	      break;
-	      
+
 	    case 'v':
 	      add_char_segment (tf, '\v');
 	      cur++;
@@ -345,39 +345,39 @@ parse_transform_expr (const char *expr)
 	      add_char_segment (tf, '&');
 	      cur++;
 	      break;
-	      
+
 	    case 'L':
 	      /* Turn the replacement to lowercase until a `\U' or `\E'
 		 is found, */
 	      add_case_ctl_segment (tf, ctl_locase);
 	      cur++;
 	      break;
- 
+
 	    case 'l':
 	      /* Turn the next character to lowercase, */
 	      add_case_ctl_segment (tf, ctl_locase_next);
 	      cur++;
 	      break;
-	      
+
 	    case 'U':
 	      /* Turn the replacement to uppercase until a `\L' or `\E'
 		 is found, */
 	      add_case_ctl_segment (tf, ctl_upcase);
 	      cur++;
 	      break;
-	      
+
 	    case 'u':
 	      /* Turn the next character to uppercase, */
 	      add_case_ctl_segment (tf, ctl_upcase_next);
 	      cur++;
 	      break;
-	      
+
 	    case 'E':
 	      /* Stop case conversion started by `\L' or `\U'. */
 	      add_case_ctl_segment (tf, ctl_stop);
 	      cur++;
 	      break;
-  
+
 	    default:
 	      /* 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 size_t case_ctl_bufsize;
   char *p;
-  
+
   if (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_buffer[0] = toupper ((unsigned char) case_ctl_buffer[0]);
       break;
-      
+
     case ctl_locase_next:
       case_ctl_buffer[0] = tolower ((unsigned char) case_ctl_buffer[0]);
       break;
-      
+
     case ctl_upcase:
       for (p = case_ctl_buffer; p < case_ctl_buffer + size; p++)
 	*p = toupper ((unsigned char) *p);
       break;
-      
+
     case ctl_locase:
       for (p = case_ctl_buffer; p < case_ctl_buffer + size; 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 bool stk_init;
 
-void
+static void
 _single_transform_name_to_obstack (struct transform *tf, char *input)
 {
   regmatch_t *rmp;
@@ -465,7 +465,7 @@ _single_transform_name_to_obstack (struct transform *tf, char *input)
   size_t nmatches = 0;
   enum case_ctl_type case_ctl = ctl_stop,  /* Current case conversion op */
                      save_ctl = ctl_stop;  /* Saved case_ctl for \u and \l */
-  
+
   /* Reset case conversion after a single-char operation */
 #define CASE_CTL_RESET()  if (case_ctl == ctl_upcase_next     \
 			      || case_ctl == ctl_locase_next) \
@@ -473,20 +473,20 @@ _single_transform_name_to_obstack (struct transform *tf, char *input)
                               case_ctl = save_ctl;            \
                               save_ctl = ctl_stop;            \
 			    }
-  
+
   rmp = xmalloc ((tf->regex.re_nsub + 1) * sizeof (*rmp));
 
   while (*input)
     {
       size_t disp;
       char *ptr;
-      
+
       rc = regexec (&tf->regex, input, tf->regex.re_nsub + 1, rmp, 0);
-      
+
       if (rc == 0)
 	{
 	  struct replace_segm *segm;
-	  
+
 	  disp = rmp[0].rm_eo;
 
 	  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);
 		  break;
-	      
+
 		case segm_backref:    /* Back-reference segment */
 		  if (rmp[segm->v.ref].rm_so != -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);
 			  CASE_CTL_RESET();
 			}
-		      
+
 		      obstack_grow (&stk, ptr, size);
 		    }
 		  break;
@@ -549,7 +549,7 @@ _single_transform_name_to_obstack (struct transform *tf, char *input)
 			  break;
 			}
 		      /*FALL THROUGH*/
-		      
+
 		    case ctl_upcase:
 		    case ctl_locase:
 		    case ctl_stop:
@@ -577,18 +577,18 @@ _single_transform_name_to_obstack (struct transform *tf, char *input)
   free (rmp);
 }
 
-bool
+static bool
 _transform_name_to_obstack (int flags, char *input, char **output)
 {
   struct transform *tf;
   bool alloced = false;
-  
+
   if (!stk_init)
     {
       obstack_init (&stk);
       stk_init = true;
     }
-  
+
   for (tf = transform_head; tf; tf = tf->next)
     {
       if (tf->flags & flags)
@@ -601,7 +601,7 @@ _transform_name_to_obstack (int flags, char *input, char **output)
   *output = input;
   return alloced;
 }
-  
+
 bool
 transform_name_fp (char **pinput, int flags,
 		   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.
 
    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;
 
 static struct deferred_unlink *
-dunlink_alloc ()
+dunlink_alloc (void)
 {
   struct deferred_unlink *p;
   if (dunlink_avail)
@@ -116,7 +116,7 @@ flush_deferred_unlinks (bool force)
 	{
 	  prev = p;
 	  p = next;
-	}	  
+	}
     }
   if (!dunlink_head)
     dunlink_tail = NULL;
@@ -142,13 +142,13 @@ queue_deferred_unlink (const char *name, bool is_dir)
   if (dunlink_head
       && records_written > dunlink_head->records_written + deferred_unlink_delay)
     flush_deferred_unlinks (false);
-  
+
   p = dunlink_alloc ();
   p->next = NULL;
   p->file_name = normalize_filename (name);
   p->is_dir = is_dir;
   p->records_written = records_written;
-  
+
   if (dunlink_tail)
     dunlink_tail->next = p;
   else

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio