2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2018 Colin Leroy and the Claws Mail team
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 <http://www.gnu.org/licenses/>.
19 #ifndef __CLAWS_IO_H__
20 #define __CLAWS_IO_H__
23 #include "claws-features.h"
29 #if HAVE_FGETS_UNLOCKED
30 #define claws_fgets fgets_unlocked
31 #define claws_fgetc fgetc_unlocked
32 #define claws_fputs fputs_unlocked
33 #define claws_fputc fputc_unlocked
34 #define claws_fread fread_unlocked
35 #define claws_fwrite fwrite_unlocked
36 #define claws_feof feof_unlocked
37 #define claws_ferror ferror_unlocked
39 FILE *claws_fopen (const char *file
,
41 FILE *claws_fdopen (int fd
,
43 int claws_fclose (FILE *fp
);
47 #define claws_fgets fgets
48 #define claws_fgetc fgetc
49 #define claws_fputs fputs
50 #define claws_fputc fputc
51 #define claws_fread fread
52 #define claws_fwrite fwrite
53 #define claws_feof feof
54 #define claws_ferror ferror
55 #define claws_fopen g_fopen
56 #define claws_fdopen fdopen
57 #define claws_fclose fclose
60 int claws_safe_fclose (FILE *fp
);
61 int claws_unlink (const char *filename
);
63 gint
file_strip_crs (const gchar
*file
);
64 gint
append_file (const gchar
*src
,
66 gboolean keep_backup
);
67 gint
copy_file (const gchar
*src
,
69 gboolean keep_backup
);
70 gint
move_file (const gchar
*src
,
73 gint
copy_file_part_to_fp (FILE *fp
,
77 gint
copy_file_part (FILE *fp
,
81 gint
canonicalize_file (const gchar
*src
,
83 gint
canonicalize_file_replace (const gchar
*file
);
84 gchar
*file_read_to_str (const gchar
*file
);
85 gchar
*file_read_to_str_no_recode(const gchar
*file
);
86 gchar
*file_read_stream_to_str (FILE *fp
);
87 gchar
*file_read_stream_to_str_no_recode(FILE *fp
);
89 gint
rename_force (const gchar
*oldpath
,
90 const gchar
*newpath
);
91 gint
copy_dir (const gchar
*src
,
93 gint
change_file_mode_rw (FILE *fp
,
95 FILE *my_tmpfile (void);
96 FILE *get_tmpfile_in_dir (const gchar
*dir
,
98 FILE *str_open_as_stream (const gchar
*str
);
99 gint
str_write_to_file (const gchar
*str
,