diff options
| author | Miles Bader | 2006-06-07 18:05:10 +0000 |
|---|---|---|
| committer | Miles Bader | 2006-06-07 18:05:10 +0000 |
| commit | b883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb (patch) | |
| tree | de3804210a8cd955e0d3b9abc15679480930bc82 /src/fileio.c | |
| parent | 885b7d0991bd4b4b8f4bd1d3cd21c18a697bbce2 (diff) | |
| parent | 26c9afc3239e18b03537faaea33e3e82e28099e6 (diff) | |
| download | emacs-b883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb.tar.gz emacs-b883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb.zip | |
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 285-296)
- Update from CVS
- Merge from gnus--rel--5.10
- Update from CVS: admin/FOR-RELEASE: Update refcard section.
* gnus--rel--5.10 (patch 102-104)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-64
Diffstat (limited to 'src/fileio.c')
| -rw-r--r-- | src/fileio.c | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/src/fileio.c b/src/fileio.c index 84b32f8dda9..8ce89ba23f3 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -2409,32 +2409,31 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick) | |||
| 2409 | return; | 2409 | return; |
| 2410 | } | 2410 | } |
| 2411 | 2411 | ||
| 2412 | DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 6, | 2412 | DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 5, |
| 2413 | "fCopy file: \nGCopy %s to file: \np\nP", | 2413 | "fCopy file: \nGCopy %s to file: \np\nP", |
| 2414 | doc: /* Copy FILE to NEWNAME. Both args must be strings. | 2414 | doc: /* Copy FILE to NEWNAME. Both args must be strings. |
| 2415 | If NEWNAME names a directory, copy FILE there. | 2415 | If NEWNAME names a directory, copy FILE there. |
| 2416 | Signals a `file-already-exists' error if file NEWNAME already exists, | 2416 | |
| 2417 | unless a third argument OK-IF-ALREADY-EXISTS is supplied and non-nil. | 2417 | This function always sets the file modes of the output file to match |
| 2418 | A number as third arg means request confirmation if NEWNAME already exists. | 2418 | the input file. |
| 2419 | This is what happens in interactive use with M-x. | 2419 | |
| 2420 | Always sets the file modes of the output file to match the input file. | 2420 | The optional third argument OK-IF-ALREADY-EXISTS specifies what to do |
| 2421 | if file NEWNAME already exists. If OK-IF-ALREADY-EXISTS is nil, we | ||
| 2422 | signal a `file-already-exists' error without overwriting. If | ||
| 2423 | OK-IF-ALREADY-EXISTS is a number, we request confirmation from the user | ||
| 2424 | about overwriting; this is what happens in interactive use with M-x. | ||
| 2425 | Any other value for OK-IF-ALREADY-EXISTS means to overwrite the | ||
| 2426 | existing file. | ||
| 2421 | 2427 | ||
| 2422 | Fourth arg KEEP-TIME non-nil means give the output file the same | 2428 | Fourth arg KEEP-TIME non-nil means give the output file the same |
| 2423 | last-modified time as the old one. (This works on only some systems.) | 2429 | last-modified time as the old one. (This works on only some systems.) |
| 2424 | 2430 | ||
| 2425 | A prefix arg makes KEEP-TIME non-nil. | 2431 | A prefix arg makes KEEP-TIME non-nil. |
| 2426 | 2432 | ||
| 2427 | The optional fifth arg MUSTBENEW, if non-nil, insists on a check | ||
| 2428 | for an existing file with the same name. If MUSTBENEW is `excl', | ||
| 2429 | that means to get an error if the file already exists; never overwrite. | ||
| 2430 | If MUSTBENEW is neither nil nor `excl', that means ask for | ||
| 2431 | confirmation before overwriting, but do go ahead and overwrite the file | ||
| 2432 | if the user confirms. | ||
| 2433 | |||
| 2434 | If PRESERVE-UID-GID is non-nil, we try to transfer the | 2433 | If PRESERVE-UID-GID is non-nil, we try to transfer the |
| 2435 | uid and gid of FILE to NEWNAME. */) | 2434 | uid and gid of FILE to NEWNAME. */) |
| 2436 | (file, newname, ok_if_already_exists, keep_time, mustbenew, preserve_uid_gid) | 2435 | (file, newname, ok_if_already_exists, keep_time, preserve_uid_gid) |
| 2437 | Lisp_Object file, newname, ok_if_already_exists, keep_time, mustbenew; | 2436 | Lisp_Object file, newname, ok_if_already_exists, keep_time; |
| 2438 | Lisp_Object preserve_uid_gid; | 2437 | Lisp_Object preserve_uid_gid; |
| 2439 | { | 2438 | { |
| 2440 | int ifd, ofd, n; | 2439 | int ifd, ofd, n; |
| @@ -2451,9 +2450,6 @@ uid and gid of FILE to NEWNAME. */) | |||
| 2451 | CHECK_STRING (file); | 2450 | CHECK_STRING (file); |
| 2452 | CHECK_STRING (newname); | 2451 | CHECK_STRING (newname); |
| 2453 | 2452 | ||
| 2454 | if (!NILP (mustbenew) && !EQ (mustbenew, Qexcl)) | ||
| 2455 | barf_or_query_if_file_exists (newname, "overwrite", 1, 0, 1); | ||
| 2456 | |||
| 2457 | if (!NILP (Ffile_directory_p (newname))) | 2453 | if (!NILP (Ffile_directory_p (newname))) |
| 2458 | newname = Fexpand_file_name (Ffile_name_nondirectory (file), newname); | 2454 | newname = Fexpand_file_name (Ffile_name_nondirectory (file), newname); |
| 2459 | else | 2455 | else |
| @@ -2556,12 +2552,12 @@ uid and gid of FILE to NEWNAME. */) | |||
| 2556 | /* System's default file type was set to binary by _fmode in emacs.c. */ | 2552 | /* System's default file type was set to binary by _fmode in emacs.c. */ |
| 2557 | ofd = emacs_open (SDATA (encoded_newname), | 2553 | ofd = emacs_open (SDATA (encoded_newname), |
| 2558 | O_WRONLY | O_TRUNC | O_CREAT | 2554 | O_WRONLY | O_TRUNC | O_CREAT |
| 2559 | | (EQ (mustbenew, Qexcl) ? O_EXCL : 0), | 2555 | | (NILP (ok_if_already_exists) ? O_EXCL : 0), |
| 2560 | S_IREAD | S_IWRITE); | 2556 | S_IREAD | S_IWRITE); |
| 2561 | #else /* not MSDOS */ | 2557 | #else /* not MSDOS */ |
| 2562 | ofd = emacs_open (SDATA (encoded_newname), | 2558 | ofd = emacs_open (SDATA (encoded_newname), |
| 2563 | O_WRONLY | O_TRUNC | O_CREAT | 2559 | O_WRONLY | O_TRUNC | O_CREAT |
| 2564 | | (EQ (mustbenew, Qexcl) ? O_EXCL : 0), | 2560 | | (NILP (ok_if_already_exists) ? O_EXCL : 0), |
| 2565 | 0666); | 2561 | 0666); |
| 2566 | #endif /* not MSDOS */ | 2562 | #endif /* not MSDOS */ |
| 2567 | #endif /* VMS */ | 2563 | #endif /* VMS */ |
| @@ -2806,7 +2802,7 @@ This is what happens in interactive use with M-x. */) | |||
| 2806 | /* We have already prompted if it was an integer, | 2802 | /* We have already prompted if it was an integer, |
| 2807 | so don't have copy-file prompt again. */ | 2803 | so don't have copy-file prompt again. */ |
| 2808 | NILP (ok_if_already_exists) ? Qnil : Qt, | 2804 | NILP (ok_if_already_exists) ? Qnil : Qt, |
| 2809 | Qt, Qnil, Qt); | 2805 | Qt, Qt); |
| 2810 | 2806 | ||
| 2811 | Fdelete_file (file); | 2807 | Fdelete_file (file); |
| 2812 | } | 2808 | } |