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__
24 #include "claws-features.h"
30 #if HAVE_FGETS_UNLOCKED
31 #define claws_fgets fgets_unlocked
32 #define claws_fgetc fgetc_unlocked
33 #define claws_fputs fputs_unlocked
34 #define claws_fputc fputc_unlocked
35 #define claws_fread fread_unlocked
36 #define claws_fwrite fwrite_unlocked
37 #define claws_feof feof_unlocked
38 #define claws_ferror ferror_unlocked
40 FILE *claws_fopen (const char *file,
42 FILE *claws_fdopen (int fd,
44 int claws_fclose (FILE *fp);
45 int claws_safe_fclose (FILE *fp);
49 #define claws_fgets fgets
50 #define claws_fgetc fgetc
51 #define claws_fputs fputs
52 #define claws_fputc fputc
53 #define claws_fread fread
54 #define claws_fwrite fwrite
55 #define claws_feof feof
56 #define claws_ferror ferror
57 #define claws_fopen g_fopen
58 #define claws_fdopen fdopen
59 #define claws_fclose fclose
60 #define claws_safe_fclose safe_fclose
63 int safe_fclose (FILE *fp);
64 int claws_unlink (const char *filename);
66 gint file_strip_crs (const gchar *file);
67 gint append_file (const gchar *src,
69 gboolean keep_backup);
70 gint copy_file (const gchar *src,
72 gboolean keep_backup);
73 gint move_file (const gchar *src,
76 gint copy_file_part_to_fp (FILE *fp,
80 gint copy_file_part (FILE *fp,
84 gint canonicalize_file (const gchar *src,
86 gint canonicalize_file_replace (const gchar *file);
87 gint str_write_to_file (const gchar *str,
89 gchar *file_read_to_str (const gchar *file);
90 gchar *file_read_to_str_no_recode(const gchar *file);
91 gchar *file_read_stream_to_str (FILE *fp);
92 gchar *file_read_stream_to_str_no_recode(FILE *fp);
94 gint rename_force (const gchar *oldpath,
95 const gchar *newpath);
96 gint copy_dir (const gchar *src,
98 gint change_file_mode_rw (FILE *fp,
100 FILE *my_tmpfile (void);
101 FILE *my_tmpfile_with_len (size_t len);
102 FILE *get_tmpfile_in_dir (const gchar *dir,
104 FILE *str_open_as_stream (const gchar *str);
105 gint str_write_to_file (const gchar *str,