comparison src/fileio.c @ 592:4f6ba8f1fb3d

[xemacs-hg @ 2001-05-31 12:03:37 by adrian] [PATCH] Fix time preservation in (copy-file ...) on native Windows <1yp8gt63.fsf@rapier.ecf.teradyne.com>
author adrian
date Thu, 31 May 2001 12:03:39 +0000
parents 183866b06e0b
children 5fd7ba8b56e7
comparison
equal deleted inserted replaced
591:ec73ae6e772b 592:4f6ba8f1fb3d
52 #include <errnet.h> 52 #include <errnet.h>
53 #endif /* HPUX_PRE_8_0 */ 53 #endif /* HPUX_PRE_8_0 */
54 #endif /* HPUX */ 54 #endif /* HPUX */
55 55
56 #ifdef WIN32_NATIVE 56 #ifdef WIN32_NATIVE
57 #include "nt.h"
57 #define IS_DRIVE(x) isalpha (x) 58 #define IS_DRIVE(x) isalpha (x)
58 /* Need to lower-case the drive letter, or else expanded 59 /* Need to lower-case the drive letter, or else expanded
59 filenames will sometimes compare inequal, because 60 filenames will sometimes compare inequal, because
60 `expand-file-name' doesn't always down-case the drive letter. */ 61 `expand-file-name' doesn't always down-case the drive letter. */
61 #define DRIVE_LETTER(x) tolower (x) 62 #define DRIVE_LETTER(x) tolower (x)
1594 statptr->st_mode = 0; 1595 statptr->st_mode = 0;
1595 } 1596 }
1596 return; 1597 return;
1597 } 1598 }
1598 1599
1599 /* A slightly higher-level interface than `set_file_times' */
1600 static int
1601 lisp_string_set_file_times (Lisp_Object filename,
1602 EMACS_TIME atime, EMACS_TIME mtime)
1603 {
1604 char *ext_filename;
1605 LISP_STRING_TO_EXTERNAL (filename, ext_filename, Qfile_name);
1606 return set_file_times (ext_filename, atime, mtime);
1607 }
1608
1609 DEFUN ("copy-file", Fcopy_file, 2, 4, 1600 DEFUN ("copy-file", Fcopy_file, 2, 4,
1610 "fCopy file: \nFCopy %s to file: \np\nP", /* 1601 "fCopy file: \nFCopy %s to file: \np\nP", /*
1611 Copy FILENAME to NEWNAME. Both args must be strings. 1602 Copy FILENAME to NEWNAME. Both args must be strings.
1612 Signals a `file-already-exists' error if file NEWNAME already exists, 1603 Signals a `file-already-exists' error if file NEWNAME already exists,
1613 unless a third argument OK-IF-ALREADY-EXISTS is supplied and non-nil. 1604 unless a third argument OK-IF-ALREADY-EXISTS is supplied and non-nil.
1741 if (!NILP (keep_time)) 1732 if (!NILP (keep_time))
1742 { 1733 {
1743 EMACS_TIME atime, mtime; 1734 EMACS_TIME atime, mtime;
1744 EMACS_SET_SECS_USECS (atime, st.st_atime, 0); 1735 EMACS_SET_SECS_USECS (atime, st.st_atime, 0);
1745 EMACS_SET_SECS_USECS (mtime, st.st_mtime, 0); 1736 EMACS_SET_SECS_USECS (mtime, st.st_mtime, 0);
1746 if (lisp_string_set_file_times (newname, atime, mtime)) 1737 if (set_file_times (newname, atime, mtime))
1747 report_file_error ("I/O error", newname); 1738 report_file_error ("I/O error", list1 (newname));
1748 } 1739 }
1749 chmod ((const char *) XSTRING_DATA (newname), 1740 chmod ((const char *) XSTRING_DATA (newname),
1750 st.st_mode & 07777); 1741 st.st_mode & 07777);
1751 } 1742 }
1752 1743