all: prefer https: URLs
[gnulib.git] / lib / copy-file.h
blobd8efbb3da7058c5438d1f8c3b3228cf446b3e5d6
1 /* Copying of files.
2 Copyright (C) 2001-2003, 2009-2017 Free Software Foundation, Inc.
3 Written by Bruno Haible <haible@clisp.cons.org>, 2001.
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
24 /* Error codes returned by qcopy_file_preserving. */
25 enum
27 GL_COPY_ERR_OPEN_READ = -1,
28 GL_COPY_ERR_OPEN_BACKUP_WRITE = -2,
29 GL_COPY_ERR_READ = -3,
30 GL_COPY_ERR_WRITE = -4,
31 GL_COPY_ERR_AFTER_READ = -5,
32 GL_COPY_ERR_GET_ACL = -6,
33 GL_COPY_ERR_SET_ACL = -7
36 /* Copy a regular file: from src_filename to dest_filename.
37 The destination file is assumed to be a backup file.
38 Modification times, owner, group and access permissions are preserved as
39 far as possible.
40 Return 0 if successful, otherwise set errno and return one of the error
41 codes above. */
42 extern int qcopy_file_preserving (const char *src_filename, const char *dest_filename);
44 /* Copy a regular file: from src_filename to dest_filename.
45 The destination file is assumed to be a backup file.
46 Modification times, owner, group and access permissions are preserved as
47 far as possible.
48 Exit upon failure. */
49 extern void copy_file_preserving (const char *src_filename, const char *dest_filename);
52 #ifdef __cplusplus
54 #endif