From 132c57497cadfcff6facea263fb4144168a8280f Mon Sep 17 00:00:00 2001
From: Shreenidhi Shedi <sshedi@vmware.com>
Date: Wed, 1 Sep 2021 19:17:21 +0530
Subject: [PATCH 02/12] Remove ^L from files & redundant empty lines

Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
---
 src/copyin.c   | 95 ++++++++++++++++++++++++--------------------------
 src/copyout.c  | 55 ++++++++++++++---------------
 src/copypass.c | 34 +++++++++---------
 src/extern.h   |  1 -
 src/filemode.c |  2 +-
 src/tar.c      |  7 ++--
 src/userspec.c |  2 +-
 src/util.c     | 69 ++++++++++++++++++------------------
 8 files changed, 129 insertions(+), 136 deletions(-)

diff --git a/src/copyin.c b/src/copyin.c
index 4fb14af..bf14710 100644
--- a/src/copyin.c
+++ b/src/copyin.c
@@ -47,7 +47,6 @@ warn_junk_bytes (long bytes_skipped)
 	 bytes_skipped);
 }
 
-
 static int
 query_rename(struct cpio_file_stat* file_hdr, FILE *tty_in, FILE *tty_out,
 	     FILE *rename_in)
@@ -80,7 +79,7 @@ query_rename(struct cpio_file_stat* file_hdr, FILE *tty_in, FILE *tty_out,
     cpio_set_c_name (file_hdr, new_name.ds_string);
   return 0;
 }
-
+
 /* Skip the padding on IN_FILE_DES after a header or file,
    up to the next header.
    The number of bytes skipped is based on OFFSET -- the current offset
@@ -104,12 +103,12 @@ tape_skip_padding (int in_file_des, off_t offset)
   if (pad != 0)
     tape_toss_input (in_file_des, pad);
 }
-
+
 static char *
 get_link_name (struct cpio_file_stat *file_hdr, int in_file_des)
 {
   char *link_name;
-  
+
   if (file_hdr->c_filesize < 0 || file_hdr->c_filesize > SIZE_MAX-1)
     {
       error (0, 0, _("%s: stored filename length is out of range"),
@@ -125,7 +124,7 @@ get_link_name (struct cpio_file_stat *file_hdr, int in_file_des)
     }
   return link_name;
 }
-
+
 static void
 list_file (struct cpio_file_stat* file_hdr, int in_file_des)
 {
@@ -176,7 +175,7 @@ list_file (struct cpio_file_stat* file_hdr, int in_file_des)
 	}
     }
 }
-
+
 static int
 try_existing_file (struct cpio_file_stat* file_hdr, int in_file_des,
 		   bool *existing_dir)
@@ -204,7 +203,7 @@ try_existing_file (struct cpio_file_stat* file_hdr, int in_file_des,
 	  tape_skip_padding (in_file_des, file_hdr->c_filesize);
 	  return -1;	/* Go to the next file.  */
 	}
-      else if (S_ISDIR (file_stat.st_mode) 
+      else if (S_ISDIR (file_stat.st_mode)
 		? rmdir (file_hdr->c_name)
 		: unlink (file_hdr->c_name))
 	{
@@ -217,11 +216,11 @@ try_existing_file (struct cpio_file_stat* file_hdr, int in_file_des,
     }
   return 0;
 }
-
-/* The newc and crc formats store multiply linked copies of the same file 
-   in the archive only once.  The actual data is attached to the last link 
-   in the archive, and the other links all have a filesize of 0.  When a 
-   file in the archive has multiple links and a filesize of 0, its data is 
+
+/* The newc and crc formats store multiply linked copies of the same file
+   in the archive only once.  The actual data is attached to the last link
+   in the archive, and the other links all have a filesize of 0.  When a
+   file in the archive has multiple links and a filesize of 0, its data is
    probably "attatched" to another file in the archive, so we can't create
    it right away.  We have to "defer" creating it until we have created
    the file that has the data "attatched" to it.  We keep a list of the
@@ -357,7 +356,7 @@ create_final_defers ()
       /* Debian hack:  This was reported by Horst Knobloch. This bug has
          been reported to "bug-gnu-utils@prep.ai.mit.edu". (99/1/6) -BEM
          */
-      link_res = link_to_maj_min_ino (d->header.c_name, 
+      link_res = link_to_maj_min_ino (d->header.c_name,
 		    d->header.c_dev_maj, d->header.c_dev_min,
 		    d->header.c_ino);
       if (link_res == 0)
@@ -386,7 +385,7 @@ create_final_defers ()
 
     }
 }
-
+
 static void
 copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des)
 {
@@ -429,7 +428,7 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des)
 	     the archive was created and later appeneded to). */
 	  /* Debian hack: (97/1/2) This was reported by Ronald
 	     F. Guilmette to the upstream maintainers. -BEM */
-	  link_res = link_to_maj_min_ino (file_hdr->c_name, 
+	  link_res = link_to_maj_min_ino (file_hdr->c_name,
 		    file_hdr->c_dev_maj, file_hdr->c_dev_min,
 					  file_hdr->c_ino);
 	  if (link_res == 0)
@@ -446,7 +445,7 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des)
 	  int link_res;
 	  /* Debian hack: (97/1/2) This was reported by Ronald
 	     F. Guilmette to the upstream maintainers. -BEM */
-	  link_res = link_to_maj_min_ino (file_hdr->c_name, 
+	  link_res = link_to_maj_min_ino (file_hdr->c_name,
 					  file_hdr->c_dev_maj,
 					  file_hdr->c_dev_min,
 					  file_hdr->c_ino);
@@ -470,11 +469,11 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des)
 	    }
 	  return;
 	}
-    
+
       /* If not linked, copy the contents of the file.  */
       out_file_des = open (file_hdr->c_name,
 			   O_CREAT | O_WRONLY | O_BINARY, 0600);
-  
+
       if (out_file_des < 0 && create_dir_flag)
 	{
 	  create_all_directories (file_hdr->c_name);
@@ -482,7 +481,7 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des)
 			       O_CREAT | O_WRONLY | O_BINARY,
 			       0600);
 	}
-      
+
       if (out_file_des < 0)
 	{
 	  open_error (file_hdr->c_name);
@@ -491,7 +490,7 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des)
 	  return;
 	}
     }
-  
+
   crc = 0;
   if (swap_halfwords_flag)
     {
@@ -511,7 +510,7 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des)
     }
   copy_files_tape_to_disk (in_file_des, out_file_des, file_hdr->c_filesize);
   disk_empty_output_buffer (out_file_des, true);
-  
+
   if (to_stdout_option)
     {
       if (archive_format == arf_crcascii)
@@ -523,7 +522,7 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des)
       tape_skip_padding (in_file_des, file_hdr->c_filesize);
       return;
     }
-      
+
   set_perms (out_file_des, file_hdr);
 
   if (close (out_file_des) < 0)
@@ -540,14 +539,14 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des)
   if (file_hdr->c_nlink > 1
       && (archive_format == arf_newascii || archive_format == arf_crcascii) )
     {
-      /* (see comment above for how the newc and crc formats 
-	 store multiple links).  Now that we have the data 
+      /* (see comment above for how the newc and crc formats
+	 store multiple links).  Now that we have the data
 	 for this file, create any other links to it which
 	 we defered.  */
       create_defered_links (file_hdr);
     }
 }
-
+
 static void
 copyin_device (struct cpio_file_stat* file_hdr)
 {
@@ -563,7 +562,7 @@ copyin_device (struct cpio_file_stat* file_hdr)
       /* Debian hack:  This was reported by Horst
 	 Knobloch. This bug has been reported to
 	 "bug-gnu-utils@prep.ai.mit.edu". (99/1/6) -BEM */
-      link_res = link_to_maj_min_ino (file_hdr->c_name, 
+      link_res = link_to_maj_min_ino (file_hdr->c_name,
 		    file_hdr->c_dev_maj, file_hdr->c_dev_min,
 		    file_hdr->c_ino);
       if (link_res == 0)
@@ -572,7 +571,7 @@ copyin_device (struct cpio_file_stat* file_hdr)
 	}
     }
   else if (archive_format == arf_ustar &&
-	   file_hdr->c_tar_linkname && 
+	   file_hdr->c_tar_linkname &&
 	   file_hdr->c_tar_linkname [0] != '\0')
     {
       int	link_res;
@@ -591,7 +590,7 @@ copyin_device (struct cpio_file_stat* file_hdr)
 	}
       return;
     }
-  
+
   res = mknod (file_hdr->c_name, file_hdr->c_mode,
 	    makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min));
   if (res < 0 && create_dir_flag)
@@ -620,7 +619,7 @@ copyin_device (struct cpio_file_stat* file_hdr)
     set_file_times (-1, file_hdr->c_name, file_hdr->c_mtime,
 		    file_hdr->c_mtime);
 }
-
+
 static void
 copyin_link (struct cpio_file_stat *file_hdr, int in_file_des)
 {
@@ -647,7 +646,7 @@ copyin_link (struct cpio_file_stat *file_hdr, int in_file_des)
     }
 
   cpio_safer_name_suffix (link_name, true, !no_abs_paths_flag, false);
-  
+
   res = UMASKED_SYMLINK (link_name, file_hdr->c_name,
 			 file_hdr->c_mode);
   if (res < 0 && create_dir_flag)
@@ -672,7 +671,7 @@ copyin_link (struct cpio_file_stat *file_hdr, int in_file_des)
     }
   free (link_name);
 }
-
+
 static void
 copyin_file (struct cpio_file_stat *file_hdr, int in_file_des)
 {
@@ -716,7 +715,7 @@ copyin_file (struct cpio_file_stat *file_hdr, int in_file_des)
       tape_skip_padding (in_file_des, file_hdr->c_filesize);
     }
 }
-
+
 
 /* Current time for verbose table.  */
 static time_t current_time;
@@ -810,7 +809,7 @@ read_pattern_file (void)
     }
 
   ds_free (&pattern_name);
-  
+
   if (ferror (pattern_fp) || fclose (pattern_fp) == EOF)
     close_error (pattern_file_name);
 
@@ -821,7 +820,7 @@ read_pattern_file (void)
   num_patterns = new_num_patterns;
 }
 
-
+
 uintmax_t
 from_ascii (char const *where, size_t digs, unsigned logbase)
 {
@@ -842,14 +841,14 @@ from_ascii (char const *where, size_t digs, unsigned logbase)
   while (1)
     {
       unsigned d;
-      
+
       char *p = strchr (codetab, toupper (*buf));
       if (!p)
 	{
 	  error (0, 0, _("Malformed number %.*s"), (int) digs, where);
 	  break;
 	}
-      
+
       d = p - codetab;
       if ((d >> logbase) > 1)
 	{
@@ -868,8 +867,6 @@ from_ascii (char const *where, size_t digs, unsigned logbase)
   return value;
 }
 
-
-
 /* Return 16-bit integer I with the bytes swapped.  */
 #define swab_short(i) ((((i) << 8) & 0xff00) | (((i) >> 8) & 0x00ff))
 
@@ -1224,13 +1221,13 @@ process_copy_in (void)
 
   newdir_umask = umask (0);     /* Reset umask to preserve modes of
 				   created files  */
-  
+
   /* Initialize the copy in.  */
   if (pattern_file_name)
     {
       read_pattern_file ();
     }
-  
+
   if (rename_batch_file)
     {
       rename_in = fopen (rename_batch_file, "r");
@@ -1281,7 +1278,7 @@ process_copy_in (void)
   output_is_seekable = true;
 
   change_dir ();
-  
+
   /* While there is more input in the collection, process the input.  */
   while (1)
     {
@@ -1295,18 +1292,18 @@ process_copy_in (void)
 	{
 	  struct cpio_file_stat *h;
 	  h = &file_hdr;
-	  fprintf (stderr, 
+	  fprintf (stderr,
 		"magic = 0%o, ino = %ld, mode = 0%o, uid = %d, gid = %d\n",
 		h->c_magic, (long)h->c_ino, h->c_mode, h->c_uid, h->c_gid);
-	  fprintf (stderr, 
+	  fprintf (stderr,
 		"nlink = %d, mtime = %d, filesize = %d, dev_maj = 0x%x\n",
 		h->c_nlink, h->c_mtime, h->c_filesize, h->c_dev_maj);
-	  fprintf (stderr, 
+	  fprintf (stderr,
 	        "dev_min = 0x%x, rdev_maj = 0x%x, rdev_min = 0x%x, namesize = %d\n",
 		h->c_dev_min, h->c_rdev_maj, h->c_rdev_min, h->c_namesize);
-	  fprintf (stderr, 
+	  fprintf (stderr,
 		"chksum = %d, name = \"%s\", tar_linkname = \"%s\"\n",
-		h->c_chksum, h->c_name, 
+		h->c_chksum, h->c_name,
 		h->c_tar_linkname ? h->c_tar_linkname : "(null)" );
 
 	}
@@ -1321,7 +1318,7 @@ process_copy_in (void)
 
 	  cpio_safer_name_suffix (file_hdr.c_name, false, !no_abs_paths_flag,
 				  false);
-      
+
 	  /* Does the file name match one of the given patterns?  */
 	  if (num_patterns <= 0)
 	    skip_file = false;
@@ -1336,7 +1333,7 @@ process_copy_in (void)
 		}
 	    }
 	}
-      
+
       if (skip_file)
 	{
 	  /* If we're skipping a file with links, there might be other
@@ -1429,7 +1426,7 @@ process_copy_in (void)
   apply_delayed_set_stat ();
 
   cpio_file_stat_free (&file_hdr);
-  
+
   if (append_flag)
     return;
 
diff --git a/src/copyout.c b/src/copyout.c
index ca6798c..d54e388 100644
--- a/src/copyout.c
+++ b/src/copyout.c
@@ -68,7 +68,7 @@ read_for_checksum (int in_file_des, int file_size, char *file_name)
 static void
 tape_clear_rest_of_block (int out_file_des)
 {
-  write_nuls_to_file (io_block_size - output_size, out_file_des, 
+  write_nuls_to_file (io_block_size - output_size, out_file_des,
                       tape_buffered_write);
 }
 
@@ -238,7 +238,7 @@ writeout_defered_file (struct cpio_file_stat *header, int out_file_des)
 /* When writing newc and crc format archives we defer multiply linked
    files until we have seen all of the links to the file.  If a file
    has links to it that aren't going into the archive, then we will
-   never see the "last" link to the file, so at the end we just write 
+   never see the "last" link to the file, so at the end we just write
    all of the leftover defered files into the archive.  */
 
 static void
@@ -311,7 +311,7 @@ to_ascii_or_warn (char *where, uintmax_t n, size_t digits,
 {
   if (to_ascii (where, n, digits, logbase, false))
     field_width_warning (filename, fieldname);
-}    
+}
 
 int
 to_ascii_or_error (char *where, uintmax_t n, size_t digits,
@@ -324,9 +324,9 @@ to_ascii_or_error (char *where, uintmax_t n, size_t digits,
       return 1;
     }
   return 0;
-}    
+}
+
 
-
 int
 write_out_new_ascii_header (const char *magic_string,
 			    struct cpio_file_stat *file_hdr, int out_des)
@@ -385,7 +385,7 @@ write_out_new_ascii_header (const char *magic_string,
   tape_buffered_write (file_hdr->c_name, out_des, (long) file_hdr->c_namesize);
   tape_pad_output (out_des, file_hdr->c_namesize + sizeof ascii_header);
   return 0;
-}  
+}
 
 int
 write_out_old_ascii_header (dev_t dev, dev_t rdev,
@@ -393,7 +393,7 @@ write_out_old_ascii_header (dev_t dev, dev_t rdev,
 {
   char ascii_header[76];
   char *p = ascii_header;
-  
+
   to_ascii (p, file_hdr->c_magic, 6, LG_8, false);
   p += 6;
   to_ascii_or_warn (p, dev, 6, LG_8, file_hdr->c_name, _("device number"));
@@ -474,23 +474,23 @@ write_out_binary_header (dev_t rdev,
   short_hdr.c_ino = file_hdr->c_ino & 0xFFFF;
   if (short_hdr.c_ino != file_hdr->c_ino)
     field_width_warning (file_hdr->c_name, _("inode number"));
-  
+
   short_hdr.c_mode = file_hdr->c_mode & 0xFFFF;
   if (short_hdr.c_mode != file_hdr->c_mode)
     field_width_warning (file_hdr->c_name, _("file mode"));
-  
+
   short_hdr.c_uid = file_hdr->c_uid & 0xFFFF;
   if (short_hdr.c_uid != file_hdr->c_uid)
     field_width_warning (file_hdr->c_name, _("uid"));
-  
+
   short_hdr.c_gid = file_hdr->c_gid & 0xFFFF;
   if (short_hdr.c_gid != file_hdr->c_gid)
     field_width_warning (file_hdr->c_name, _("gid"));
-  
+
   short_hdr.c_nlink = file_hdr->c_nlink & 0xFFFF;
   if (short_hdr.c_nlink != file_hdr->c_nlink)
     field_width_warning (file_hdr->c_name, _("number of links"));
-		      
+
   short_hdr.c_rdev = rdev;
   short_hdr.c_mtimes[0] = file_hdr->c_mtime >> 16;
   short_hdr.c_mtimes[1] = file_hdr->c_mtime & 0xFFFF;
@@ -504,7 +504,7 @@ write_out_binary_header (dev_t rdev,
 	     STRINGIFY_BIGINT (file_hdr->c_namesize, maxbuf), 0xFFFFu);
       return 1;
     }
-		      
+
   short_hdr.c_filesizes[0] = file_hdr->c_filesize >> 16;
   short_hdr.c_filesizes[1] = file_hdr->c_filesize & 0xFFFF;
 
@@ -517,7 +517,7 @@ write_out_binary_header (dev_t rdev,
 	     STRINGIFY_BIGINT (file_hdr->c_namesize, maxbuf), 0xFFFFFFFFlu);
       return 1;
     }
-		      
+
   /* Output the file header.  */
   tape_buffered_write ((char *) &short_hdr, out_des, 26);
 
@@ -528,35 +528,34 @@ write_out_binary_header (dev_t rdev,
   return 0;
 }
 
-
 /* Write out header FILE_HDR, including the file name, to file
    descriptor OUT_DES.  */
 
-int 
+int
 write_out_header (struct cpio_file_stat *file_hdr, int out_des)
 {
   dev_t dev;
   dev_t rdev;
-  
+
   switch (archive_format)
     {
     case arf_newascii:
       return write_out_new_ascii_header ("070701", file_hdr, out_des);
-      
+
     case arf_crcascii:
       return write_out_new_ascii_header ("070702", file_hdr, out_des);
-      
+
     case arf_oldascii:
       return write_out_old_ascii_header (makedev (file_hdr->c_dev_maj,
 						  file_hdr->c_dev_min),
 					 makedev (file_hdr->c_rdev_maj,
 						  file_hdr->c_rdev_min),
 					 file_hdr, out_des);
-      
+
     case arf_hpoldascii:
       hp_compute_dev (file_hdr, &dev, &rdev);
       return write_out_old_ascii_header (dev, rdev, file_hdr, out_des);
-      
+
     case arf_tar:
     case arf_ustar:
       if (is_tar_filename_too_long (file_hdr->c_name))
@@ -628,7 +627,7 @@ process_copy_out (void)
     }
 
   change_dir ();
-  
+
   if (append_flag)
     {
       process_copy_in ();
@@ -652,7 +651,7 @@ process_copy_out (void)
 	{
 	  /* Set values in output header.  */
 	  stat_to_cpio (&file_hdr, &file_stat);
-	  
+
 	  if (archive_format == arf_tar || archive_format == arf_ustar)
 	    {
 	      if (file_hdr.c_mode & CP_IFDIR)
@@ -662,7 +661,7 @@ process_copy_out (void)
 		    ds_append (&input_name, '/');
 		}
 	    }
-	  
+
 	  assign_string (&orig_file_name, input_name.ds_string);
 	  cpio_safer_name_suffix (input_name.ds_string, false,
 				  !no_abs_paths_flag, true);
@@ -760,7 +759,7 @@ process_copy_out (void)
 						    file_hdr.c_dev_maj,
 						    file_hdr.c_dev_min)))
 		    {
-		      /* This file is linked to another file already in the 
+		      /* This file is linked to another file already in the
 		         archive, so write it out as a hard link. */
 		      file_hdr.c_mode = (file_stat.st_mode & 07777);
 		      file_hdr.c_mode |= CP_IFREG;
@@ -769,7 +768,7 @@ process_copy_out (void)
 			continue;
 		      break;
 		    }
-		  add_inode (file_hdr.c_ino, orig_file_name, 
+		  add_inode (file_hdr.c_ino, orig_file_name,
 			     file_hdr.c_dev_maj, file_hdr.c_dev_min);
 		}
 	      file_hdr.c_filesize = 0;
@@ -826,7 +825,7 @@ process_copy_out (void)
 	    default:
 	      error (0, 0, _("%s: unknown file type"), orig_file_name);
 	    }
-	  
+
 	  if (verbose_flag)
 	    fprintf (stderr, "%s\n", orig_file_name);
 	  if (dot_flag)
@@ -835,7 +834,7 @@ process_copy_out (void)
     }
 
   free (orig_file_name);
-  
+
   writeout_final_defers(out_file_des);
   /* The collection is complete; append the trailer.  */
   file_hdr.c_ino = 0;
diff --git a/src/copypass.c b/src/copypass.c
index 23ee687..978db6a 100644
--- a/src/copypass.c
+++ b/src/copypass.c
@@ -67,12 +67,12 @@ process_copy_pass (void)
 				   created files  */
 
   /* Initialize the copy pass.  */
-  
+
   dirname_len = strlen (directory_name);
   if (change_directory_option && !ISSLASH (directory_name[0]))
     {
       char *pwd = xgetcwd ();
-      
+
       ds_concat (&output_name, pwd);
       ds_append (&output_name, '/');
     }
@@ -82,7 +82,7 @@ process_copy_pass (void)
   output_is_seekable = true;
 
   change_dir ();
-  
+
   /* Copy files with names read from stdin.  */
   while (ds_fgetstr (stdin, &input_name, name_end) != NULL)
     {
@@ -150,12 +150,12 @@ process_copy_pass (void)
 	    /* User said to link it if possible.  Try and link to
 	       the original copy.  If that fails we'll still try
 	       and link to a copy we've already made.  */
-	    link_res = link_to_name (output_name.ds_string, 
+	    link_res = link_to_name (output_name.ds_string,
 				     input_name.ds_string);
 	  if ( (link_res < 0) && (in_file_stat.st_nlink > 1) )
-	    link_res = link_to_maj_min_ino (output_name.ds_string, 
-				major (in_file_stat.st_dev), 
-				minor (in_file_stat.st_dev), 
+	    link_res = link_to_maj_min_ino (output_name.ds_string,
+				major (in_file_stat.st_dev),
+				minor (in_file_stat.st_dev),
 				in_file_stat.st_ino);
 
 	  /* If the file was not linked, copy contents of file.  */
@@ -185,7 +185,7 @@ process_copy_pass (void)
 
 	      copy_files_disk_to_disk (in_file_des, out_file_des, in_file_stat.st_size, input_name.ds_string);
 	      disk_empty_output_buffer (out_file_des, true);
-	      
+
 	      set_copypass_perms (out_file_des,
 				  output_name.ds_string, &in_file_stat);
 
@@ -199,7 +199,7 @@ process_copy_pass (void)
 				  output_name.ds_string,
                                   in_file_stat.st_atime,
                                   in_file_stat.st_mtime);
-	        } 
+	        }
 
 	      if (close (in_file_des) < 0)
 		close_error (input_name.ds_string);
@@ -214,7 +214,7 @@ process_copy_pass (void)
       else if (S_ISDIR (in_file_stat.st_mode))
 	{
 	  struct cpio_file_stat file_stat;
-	  
+
 	  stat_to_cpio (&file_stat, &in_file_stat);
 	  file_stat.c_name = output_name.ds_string;
 	  cpio_create_dir (&file_stat, existing_dir);
@@ -233,10 +233,10 @@ process_copy_pass (void)
 	     Set link_name to the original file name.  */
 	  if (link_flag)
 	    /* User said to link it if possible.  */
-	    link_res = link_to_name (output_name.ds_string, 
+	    link_res = link_to_name (output_name.ds_string,
 				     input_name.ds_string);
 	  if ( (link_res < 0) && (in_file_stat.st_nlink > 1) )
-	    link_res = link_to_maj_min_ino (output_name.ds_string, 
+	    link_res = link_to_maj_min_ino (output_name.ds_string,
 			major (in_file_stat.st_dev),
 			minor (in_file_stat.st_dev),
 			in_file_stat.st_ino);
@@ -319,7 +319,7 @@ process_copy_pass (void)
     fputc ('\n', stderr);
 
   apply_delayed_set_stat ();
-  
+
   if (!quiet_flag)
     {
       size_t blocks = (output_bytes + io_block_size - 1) / io_block_size;
@@ -332,8 +332,8 @@ process_copy_pass (void)
   ds_free (&input_name);
   ds_free (&output_name);
 }
-
-/* Try and create a hard link from FILE_NAME to another file 
+
+/* Try and create a hard link from FILE_NAME to another file
    with the given major/minor device number and inode.  If no other
    file with the same major/minor/inode numbers is known, add this file
    to the list of known files and associated major/minor/inode numbers
@@ -360,9 +360,9 @@ link_to_maj_min_ino (char *file_name, int st_dev_maj, int st_dev_min,
     link_res = link_to_name (file_name, link_name);
   return link_res;
 }
-
+
 /* Try and create a hard link from LINK_NAME to LINK_TARGET.  If
-   `create_dir_flag' is set, any non-existent (parent) directories 
+   `create_dir_flag' is set, any non-existent (parent) directories
    needed by LINK_NAME will be created.  If the link is successfully
    created and `verbose_flag' is set, print "LINK_TARGET linked to LINK_NAME\n".
    If the link can not be created and `link_flag' is set, print
diff --git a/src/extern.h b/src/extern.h
index e7cb274..ad09b0e 100644
--- a/src/extern.h
+++ b/src/extern.h
@@ -102,7 +102,6 @@ extern char output_is_seekable;
 extern int (*xstat) ();
 extern void (*copy_function) ();
 extern char *change_directory_option;
-
 
 /* copyin.c */
 void warn_junk_bytes (long bytes_skipped);
diff --git a/src/filemode.c b/src/filemode.c
index e0b72e9..f301d52 100644
--- a/src/filemode.c
+++ b/src/filemode.c
@@ -16,7 +16,7 @@
    License along with this program; if not, write to the Free
    Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301 USA.  */
-
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
diff --git a/src/tar.c b/src/tar.c
index 5272d50..64be7e1 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -42,7 +42,7 @@ stash_tar_linkname (char *linkname)
 
 /* Try to split a long file name into prefix and suffix parts separated
    by a slash. Return the length of the prefix (not counting the slash). */
-   
+
 static size_t
 split_long_name (const char *name, size_t length)
 {
@@ -89,7 +89,6 @@ to_oct_or_error (uintmax_t value, size_t digits, char *where, char const *field,
     }
   return 0;
 }
-
 
 /* Compute and return a checksum for TAR_HDR,
    counting the checksum bytes as if they were spaces.  */
@@ -353,14 +352,14 @@ read_in_tar_header (struct cpio_file_stat *file_hdr, int in_des)
 	  /* If a POSIX tar header has a valid linkname it's always supposed
 	     to set typeflag to be LNKTYPE.  System V.4 tar seems to
 	     be broken, and for device files with multiple links it
-	     puts the name of the link into linkname, but leaves typeflag 
+	     puts the name of the link into linkname, but leaves typeflag
 	     as CHRTYPE, BLKTYPE, FIFOTYPE, etc.  */
 	  file_hdr->c_tar_linkname = stash_tar_linkname (tar_hdr->linkname);
 
 	  /* Does POSIX say that the filesize must be 0 for devices?  We
 	     assume so, but HPUX's POSIX tar sets it to be 1 which causes
 	     us problems (when reading an archive we assume we can always
-	     skip to the next file by skipping filesize bytes).  For 
+	     skip to the next file by skipping filesize bytes).  For
 	     now at least, it's easier to clear filesize for devices,
 	     rather than check everywhere we skip in copyin.c.  */
 	  file_hdr->c_filesize = 0;
diff --git a/src/userspec.c b/src/userspec.c
index 59a9130..f84147d 100644
--- a/src/userspec.c
+++ b/src/userspec.c
@@ -18,7 +18,7 @@
    Boston, MA 02110-1301 USA.  */
 
 /* Written by David MacKenzie <djm@gnu.ai.mit.edu>.  */
-
+
 #include <system.h>
 #include <alloca.h>
 #include <stdio.h>
diff --git a/src/util.c b/src/util.c
index ff2746d..f07a913 100644
--- a/src/util.c
+++ b/src/util.c
@@ -60,8 +60,8 @@ tape_empty_output_buffer (int out_des)
   static long output_bytes_before_lseek = 0;
 
   /* Some tape drivers seem to have a signed internal seek pointer and
-     they lose if it overflows and becomes negative (e.g. when writing 
-     tapes > 2Gb).  Doing an lseek (des, 0, SEEK_SET) seems to reset the 
+     they lose if it overflows and becomes negative (e.g. when writing
+     tapes > 2Gb).  Doing an lseek (des, 0, SEEK_SET) seems to reset the
      seek pointer and prevent it from overflowing.  */
   if (output_is_special
      && ( (output_bytes_before_lseek += output_size) >= 1073741824L) )
@@ -106,7 +106,7 @@ static ssize_t sparse_write (int fildes, char *buf, size_t nbyte, bool flush);
    descriptor OUT_DES and reset `output_size' and `out_buff'.
    If `swapping_halfwords' or `swapping_bytes' is set,
    do the appropriate swapping first.  Our callers have
-   to make sure to only set these flags if `output_size' 
+   to make sure to only set these flags if `output_size'
    is appropriate (a multiple of 4 for `swapping_halfwords',
    2 for `swapping_bytes').  The fact that DISK_IO_BLOCK_SIZE
    must always be a multiple of 4 helps us (and our callers)
@@ -188,8 +188,8 @@ tape_fill_input_buffer (int in_des, int num_bytes)
 {
 #ifdef BROKEN_LONG_TAPE_DRIVER
   /* Some tape drivers seem to have a signed internal seek pointer and
-     they lose if it overflows and becomes negative (e.g. when writing 
-     tapes > 4Gb).  Doing an lseek (des, 0, SEEK_SET) seems to reset the 
+     they lose if it overflows and becomes negative (e.g. when writing
+     tapes > 4Gb).  Doing an lseek (des, 0, SEEK_SET) seems to reset the
      seek pointer and prevent it from overflowing.  */
   if (input_is_special
       && ( (input_bytes_before_lseek += num_bytes) >= 1073741824L) )
@@ -234,7 +234,7 @@ disk_fill_input_buffer (int in_des, off_t num_bytes)
   input_bytes += input_size;
   return (0);
 }
-
+
 /* Copy NUM_BYTES of buffer IN_BUF to `out_buff', which may be partly full.
    When `out_buff' fills up, flush it to file descriptor OUT_DES.  */
 
@@ -332,8 +332,8 @@ tape_buffered_peek (char *peek_buf, int in_des, int num_bytes)
 
 #ifdef BROKEN_LONG_TAPE_DRIVER
   /* Some tape drivers seem to have a signed internal seek pointer and
-     they lose if it overflows and becomes negative (e.g. when writing 
-     tapes > 4Gb).  Doing an lseek (des, 0, SEEK_SET) seems to reset the 
+     they lose if it overflows and becomes negative (e.g. when writing
+     tapes > 4Gb).  Doing an lseek (des, 0, SEEK_SET) seems to reset the
      seek pointer and prevent it from overflowing.  */
   if (input_is_special
       && ( (input_bytes_before_lseek += num_bytes) >= 1073741824L) )
@@ -384,7 +384,7 @@ tape_buffered_peek (char *peek_buf, int in_des, int num_bytes)
   memcpy (peek_buf, in_buff, (unsigned) got_bytes);
   return got_bytes;
 }
-
+
 /* Skip the next NUM_BYTES bytes of file descriptor IN_DES.  */
 
 void
@@ -414,16 +414,16 @@ tape_toss_input (int in_des, off_t num_bytes)
       bytes_left -= space_left;
     }
 }
-
+
 void
-write_nuls_to_file (off_t num_bytes, int out_des, 
+write_nuls_to_file (off_t num_bytes, int out_des,
                     void (*writer) (char *in_buf, int out_des, off_t num_bytes))
 {
   off_t	blocks;
   off_t	extra_bytes;
   off_t	i;
   static char zeros_512[512];
-  
+
   blocks = num_bytes / sizeof zeros_512;
   extra_bytes = num_bytes % sizeof zeros_512;
   for (i = 0; i < blocks; ++i)
@@ -431,7 +431,7 @@ write_nuls_to_file (off_t num_bytes, int out_des,
   if (extra_bytes)
     writer (zeros_512, out_des, extra_bytes);
 }
-
+
 /* Copy a file using the input and output buffers, which may start out
    partly full.  After the copy, the files are not closed nor the last
    block flushed to output, and the input buffer may still be partly
@@ -567,7 +567,7 @@ copy_files_disk_to_disk (int in_des, int out_des, off_t num_bytes,
       in_buff += size;
     }
 }
-
+
 /* Warn if file changed while it was being copied.  */
 
 void
@@ -593,7 +593,7 @@ warn_if_file_changed (char *file_name, off_t old_file_size,
   else if (new_file_stat.st_mtime != old_file_mtime)
     error (0, 0, _("File %s was modified while being copied"), file_name);
 }
-
+
 /* Create all directories up to but not including the last part of NAME.
    Do not destroy any nondirectories while creating directories.  */
 
@@ -603,7 +603,7 @@ create_all_directories (char const *name)
   char *dir;
 
   dir = dir_name (name);
-  
+
   if (dir == NULL)
     error (PAXEXIT_FAILURE, 0, _("virtual memory exhausted"));
 
@@ -706,10 +706,10 @@ find_inode_val (ino_t node_num, unsigned long major_num,
 		 unsigned long minor_num)
 {
   struct inode_val sample;
-  
+
   if (!hash_table)
     return NULL;
-  
+
   sample.inode = node_num;
   sample.major_num = major_num;
   sample.minor_num = minor_num;
@@ -734,7 +734,7 @@ add_inode (ino_t node_num, char *file_name, unsigned long major_num,
 {
   struct inode_val *temp;
   struct inode_val *e = NULL;
-  
+
   /* Create new inode record.  */
   temp = (struct inode_val *) xmalloc (sizeof (struct inode_val));
   temp->inode = node_num;
@@ -787,7 +787,7 @@ get_inode_and_dev (struct cpio_file_stat *hdr, struct stat *st)
     }
 }
 
-
+
 /* Open FILE in the mode specified by the command line options
    and return an open file descriptor for it,
    or -1 if it can't be opened.  */
@@ -1005,7 +1005,7 @@ buf_all_zeros (char *buf, int bufsize)
 
 /* Write NBYTE bytes from BUF to file descriptor FILDES, trying to
    create holes instead of writing blockfuls of zeros.
-   
+
    Return the number of bytes written (including bytes in zero
    regions) on success, -1 on error.
 
@@ -1025,7 +1025,7 @@ sparse_write (int fildes, char *buf, size_t nbytes, bool flush)
 
   enum { begin, in_zeros, not_in_zeros } state =
 			   delayed_seek_count ? in_zeros : begin;
-  
+
   while (nbytes)
     {
       size_t rest = nbytes;
@@ -1040,7 +1040,7 @@ sparse_write (int fildes, char *buf, size_t nbytes, bool flush)
 	      if (state == not_in_zeros)
 		{
 		  ssize_t bytes = buf - start_ptr + rest;
-		  
+
 		  n = write (fildes, start_ptr, bytes);
 		  if (n == -1)
 		    return -1;
@@ -1089,8 +1089,8 @@ sparse_write (int fildes, char *buf, size_t nbytes, bool flush)
       if (n != 1)
 	return n;
       delayed_seek_count = 0;
-    }      
-  
+    }
+
   return nwritten + seek_count;
 }
 
@@ -1228,7 +1228,7 @@ set_perms (int fd, struct cpio_file_stat *header)
   if (!no_chown_flag)
     {
       uid_t uid = CPIO_UID (header->c_uid);
-      gid_t gid = CPIO_GID (header->c_gid); 
+      gid_t gid = CPIO_GID (header->c_gid);
       if ((fchown_or_chown (fd, header->c_name, uid, gid) < 0)
 	  && errno != EPERM)
 	chown_error_details (header->c_name, uid, gid);
@@ -1245,13 +1245,13 @@ set_file_times (int fd,
 		const char *name, unsigned long atime, unsigned long mtime)
 {
   struct timespec ts[2];
-  
+
   memset (&ts, 0, sizeof ts);
 
   ts[0].tv_sec = atime;
   ts[1].tv_sec = mtime;
 
-  /* Silently ignore EROFS because reading the file won't have upset its 
+  /* Silently ignore EROFS because reading the file won't have upset its
      timestamp if it's on a read-only filesystem. */
   if (fdutimens (fd, name, ts) < 0 && errno != EROFS)
     utime_error (name);
@@ -1300,10 +1300,10 @@ cpio_safer_name_suffix (char *name, bool link_target, bool absolute_names,
     memmove (name, p, (size_t)(strlen (p) + 1));
 }
 
-
+
 /* This is a simplified form of delayed set_stat used by GNU tar.
    With the time, both forms will merge and pass to paxutils
-   
+
    List of directories whose statuses we need to extract after we've
    finished extracting their subsidiary files.  If you consider each
    contiguous subsequence of elements of the form [D]?[^D]*, where [D]
@@ -1415,13 +1415,12 @@ apply_delayed_set_stat ()
     }
 }
 
-
 static int
 cpio_mkdir (struct cpio_file_stat *file_hdr, int *setstat_delayed)
 {
   int rc;
   mode_t mode = file_hdr->c_mode;
-  
+
   if (!(file_hdr->c_mode & S_IWUSR))
     {
       rc = mkdir (file_hdr->c_name, mode | S_IWUSR);
@@ -1444,10 +1443,10 @@ cpio_create_dir (struct cpio_file_stat *file_hdr, int existing_dir)
 {
   int res;			/* Result of various function calls.  */
   int setstat_delayed = 0;
-  
+
   if (to_stdout_option)
     return 0;
-  
+
   /* Strip any trailing `/'s off the filename; tar puts
      them on.  We might as well do it here in case anybody
      else does too, since they cause strange things to happen.  */
@@ -1536,7 +1535,7 @@ arf_stores_inode_p (enum archive_format arf)
     }
   return 1;
 }
-  
+
 void
 cpio_file_stat_init (struct cpio_file_stat *file_hdr)
 {
-- 
2.17.1

