Include stat-time.h, and use its functions instead of the obsolete
[platform/upstream/coreutils.git] / src / cp.c
index a2810c3..4e08612 100644 (file)
--- a/src/cp.c
+++ b/src/cp.c
@@ -33,6 +33,7 @@
 #include "filenamecat.h"
 #include "quote.h"
 #include "quotearg.h"
+#include "stat-time.h"
 #include "utimens.h"
 
 #define ASSIGN_BASENAME_STRDUPA(Dest, File_name)       \
@@ -130,7 +131,8 @@ static struct option const long_opts[] =
   {"preserve", optional_argument, NULL, PRESERVE_ATTRIBUTES_OPTION},
   {"recursive", no_argument, NULL, 'R'},
   {"remove-destination", no_argument, NULL, UNLINK_DEST_BEFORE_OPENING},
-  {"reply", required_argument, NULL, REPLY_OPTION},
+  {"reply", required_argument, NULL, REPLY_OPTION}, /* Deprecated 2005-07-03,
+                                                      remove in 2008. */
   {"sparse", required_argument, NULL, SPARSE_OPTION},
   {"strip-trailing-slashes", no_argument, NULL, STRIP_TRAILING_SLASHES_OPTION},
   {"suffix", required_argument, NULL, 'S'},
@@ -200,8 +202,6 @@ Mandatory arguments to long options are mandatory for short options too.\n\
                                  attempting to open it (contrast with --force)\n\
 "), stdout);
       fputs (_("\
-      --reply={yes,no,query}   specify how to handle the prompt about an\n\
-                                 existing destination file\n\
       --sparse=WHEN            control creation of sparse files\n\
       --strip-trailing-slashes remove any trailing slashes from each SOURCE\n\
                                  argument\n\
@@ -305,10 +305,8 @@ re_protect (char const *const_dst_name, size_t src_offset,
        {
          struct timespec timespec[2];
 
-         timespec[0].tv_sec = src_sb.st_atime;
-         timespec[0].tv_nsec = TIMESPEC_NS (src_sb.st_atim);
-         timespec[1].tv_sec = src_sb.st_mtime;
-         timespec[1].tv_nsec = TIMESPEC_NS (src_sb.st_mtim);
+         timespec[0] = get_stat_atime (&src_sb);
+         timespec[1] = get_stat_mtime (&src_sb);
 
          if (utimens (dst_name, timespec))
            {
@@ -905,9 +903,11 @@ main (int argc, char **argv)
          x.recursive = true;
          break;
 
-       case REPLY_OPTION:
+       case REPLY_OPTION: /* Deprecated */
          x.interactive = XARGMATCH ("--reply", optarg,
                                     reply_args, reply_vals);
+         error (0, 0,
+                _("the --reply option is deprecated; use -i or -f instead"));
          break;
 
        case UNLINK_DEST_BEFORE_OPENING: