Merge branch 'master' of ssh://git.claws-mail.org/home/git/claws
[claws.git] / src / common / claws_io.h
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
4  *
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.
9  *
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.
14  *
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/>.
17  */
18
19 #ifndef __CLAWS_IO_H__
20 #define __CLAWS_IO_H__
21
22 #ifdef HAVE_CONFIG_H
23 #  include "config.h"
24 #include "claws-features.h"
25 #endif
26
27 #include <stdio.h>
28
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
38
39 FILE *claws_fopen(const char *file, const char *mode);
40 FILE *claws_fdopen(int fd, const char *mode);
41 int claws_fclose(FILE *fp);
42 int claws_safe_fclose(FILE *fp);
43
44 #else
45
46 #define claws_fgets fgets
47 #define claws_fgetc fgetc
48 #define claws_fputs fputs
49 #define claws_fputc fputc
50 #define claws_fread fread
51 #define claws_fwrite fwrite
52 #define claws_feof feof
53 #define claws_ferror ferror
54 #define claws_fopen g_fopen
55 #define claws_fdopen fdopen
56 #define claws_fclose fclose
57 #define claws_safe_fclose safe_fclose
58 #endif
59
60 int safe_fclose(FILE *fp);
61
62 #endif