Sync Spanish manual
[claws.git] / src / common / file-utils.h
blob13cfc69accc947cf9889eac4e1d782f57e2bffe9
1 /*
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__
22 #ifdef HAVE_CONFIG_H
23 #include "claws-features.h"
24 #endif
26 #include <stdio.h>
27 #include <glib.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,
40 const char *mode);
41 FILE *claws_fdopen (int fd,
42 const char *mode);
43 int claws_fclose (FILE *fp);
45 #else
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
58 #endif
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,
65 const gchar *dest,
66 gboolean keep_backup);
67 gint copy_file (const gchar *src,
68 const gchar *dest,
69 gboolean keep_backup);
70 gint move_file (const gchar *src,
71 const gchar *dest,
72 gboolean overwrite);
73 gint copy_file_part_to_fp (FILE *fp,
74 off_t offset,
75 size_t length,
76 FILE *dest_fp);
77 gint copy_file_part (FILE *fp,
78 off_t offset,
79 size_t length,
80 const gchar *dest);
81 gint canonicalize_file (const gchar *src,
82 const gchar *dest);
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,
92 const gchar *dest);
93 gint change_file_mode_rw (FILE *fp,
94 const gchar *file);
95 FILE *my_tmpfile (void);
96 FILE *get_tmpfile_in_dir (const gchar *dir,
97 gchar **filename);
98 FILE *str_open_as_stream (const gchar *str);
99 gint str_write_to_file (const gchar *str,
100 const gchar *file,
101 gboolean safe);
103 #endif