final cleansing
[apps/madmutt.git] / charset.h
1 /*
2  * Copyright notice from original mutt:
3  * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
4  *
5  * This file is part of mutt-ng, see http://www.muttng.org/.
6  * It's licensed under the GNU General Public License,
7  * please see the file GPL in the top level source directory.
8  */
9
10 #ifndef _CHARSET_H
11 #define _CHARSET_H
12
13 #ifdef HAVE_CONFIG_H
14 #include "config.h"
15 #endif
16
17 #include "mutt.h"
18
19 #ifdef HAVE_ICONV_H
20 #include <iconv.h>
21 #endif
22
23 #ifndef HAVE_ICONV_T_DEF
24 typedef void *iconv_t;
25 #endif
26
27 #ifndef HAVE_ICONV
28 #  define iconv_open(a, b)     ((iconv_t)(-1))
29 #  define my_iconv(a,b,c,d,e)  0
30 #  define iconv_close(a)       0
31 #else
32 static inline ssize_t my_iconv(iconv_t ict, const char **inbuf, ssize_t *ilen,
33                                char **outbuf, ssize_t *olen)
34 {
35     return iconv(ict, (char **)inbuf, (size_t*)ilen, outbuf, (size_t*)olen);
36 }
37 #endif
38
39 int mutt_convert_string (char **, const char *, const char *, int);
40 const char *mutt_get_first_charset (const char *);
41 int mutt_convert_nonmime_string (char **);
42
43 iconv_t mutt_iconv_open (const char *, const char *, int);
44 size_t mutt_iconv (iconv_t, const char **, size_t *, char **, size_t *,
45                    const char **, const char *);
46
47 typedef void *FGETCONV;
48
49 FGETCONV *fgetconv_open (FILE *, const char *, const char *, int);
50 int fgetconv (FGETCONV *);
51 char *fgetconvs (char *, size_t, FGETCONV *);
52 void fgetconv_close (FGETCONV **);
53
54 void mutt_set_langinfo_charset (void);
55
56 #define M_ICONV_HOOK_FROM 1
57 #define M_ICONV_HOOK_TO   2
58
59 #endif /* _CHARSET_H */