]> Dogcows Code - chaz/tar/blobdiff - src/system.c
(sys_child_open_for_uncompress): Minor stylistic fix.
[chaz/tar] / src / system.c
index 37d0496a0edc2c49fe19e9742aef31a87d565b8d..f0b64615bed2ca5adabb6e0ad30e706579bbc97c 100644 (file)
 #include "rmt.h"
 #include <signal.h>
 
+void
+sys_stat_nanoseconds(struct tar_stat_info *stat)
+{
+#if defined(HAVE_STRUCT_STAT_ST_SPARE1)
+  stat->atime_nsec = stat->stat.st_spare1 * 1000;
+  stat->mtime_nsec = stat->stat.st_spare2 * 1000;
+  stat->ctime_nsec = stat->stat.st_spare3 * 1000;
+#elif defined(HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC)
+  stat->atime_nsec = stat->stat.st_atim.tv_nsec;
+  stat->mtime_nsec = stat->stat.st_mtim.tv_nsec;
+  stat->ctime_nsec = stat->stat.st_ctim.tv_nsec;
+#elif defined(HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC)
+  stat->atime_nsec = stat->stat.st_atimespec.tv_nsec;
+  stat->mtime_nsec = stat->stat.st_mtimespec.tv_nsec;
+  stat->ctime_nsec = stat->stat.st_ctimespec.tv_nsec;
+#elif defined(HAVE_STRUCT_STAT_ST_ATIMENSEC)
+  stat->atime_nsec = stat->stat.st_atimensec;
+  stat->mtime_nsec = stat->stat.st_mtimensec;
+  stat->ctime_nsec = stat->stat.st_ctimensec;
+#else
+  stat->atime_nsec  = stat->mtime_nsec = stat->ctime_nsec = 0;
+#endif
+}
+
+int
+sys_utimes(char *file_name, struct timeval tvp[3])
+{
+#ifdef HAVE_UTIMES
+  return utimes (file_name, tvp);
+#else
+  struct utimbuf utimbuf;
+  utimbuf.actime = tvp[0].tv_sec;
+  utimbuf.modtime = tvp[1].tv_sec;
+  return utime (file_name, &utimbuf);
+#endif
+}
+
 #if MSDOS
 
 bool
@@ -66,17 +103,26 @@ sys_spawn_shell ()
   spawnl (P_WAIT, getenv ("COMSPEC"), "-", 0);
 }
 
-void
-sys_compare_uid_gid (struct stat *a, struct stat *b)
+/* stat() in djgpp's C library gives a constant number of 42 as the
+   uid and gid of a file.  So, comparing an FTP'ed archive just after
+   unpack would fail on MSDOS.  */
+
+bool
+sys_compare_uid (struct stat *a, struct stat *b)
 {
-  /* stat() in djgpp's C library gives a constant number of 42 as the
-     uid and gid of a file.  So, comparing an FTP'ed archive just after
-     unpack would fail on MSDOS.  */
+  return true;
+}
+
+bool
+sys_compare_gid (struct stat *a, struct stat *b)
+{
+  return true;
 }
 
 void
 sys_compare_links (struct stat *link_data, struct stat *stat_data)
 {
+  return true;
 }
 
 int
@@ -230,24 +276,23 @@ sys_spawn_shell ()
     }
 }
 
-void
-sys_compare_uid_gid (struct stat *a, struct stat *b)
+bool
+sys_compare_uid (struct stat *a, struct stat *b)
 {
-  if (a->st_uid != b->st_uid)
-    report_difference (_("Uid differs"));
-  if (a->st_gid != b->st_gid)
-    report_difference (_("Gid differs"));
+  return a->st_uid == b->st_uid;
 }
 
-void
+bool
+sys_compare_gid (struct stat *a, struct stat *b)
+{
+  return a->st_gid == b->st_gid;
+}
+
+bool
 sys_compare_links (struct stat *link_data, struct stat *stat_data)
 {
-  if (stat_data->st_dev != link_data->st_dev
-      || stat_data->st_ino != link_data->st_ino)
-    {
-      report_difference (_("Not linked to %s"),
-                        quote (current_stat_info.link_name));
-    }
+  return stat_data->st_dev == link_data->st_dev
+         && stat_data->st_ino == link_data->st_ino;
 }
 
 int
@@ -508,7 +553,7 @@ sys_child_open_for_uncompress (void)
     {
       /* The parent tar is still here!  Just clean up.  */
 
-      read_full_records_option = 1;
+      read_full_records_option = true;
       archive = parent_pipe[PREAD];
       xclose (parent_pipe[PWRITE]);
       return child_pid;
This page took 0.023432 seconds and 4 git commands to generate.