2 * Include file for client cmdline interface GnomeVFSFileInfo utils for libcaptive
3 * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
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; exactly version 2 of June 1991 is required
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #ifndef _CAPTIVE_CLIENT_CMDLINE_UTF8_H
21 #define _CAPTIVE_CLIENT_CMDLINE_UTF8_H 1
24 #include <captive/macros.h>
25 #include <glib/gconvert.h>
26 #include <glib/gtypes.h>
29 gchar *cmd_utf8_macro_malloc_errorchecking(
30 gchar *(*func)(const gchar *string,gssize len,gsize *bytes_read,gsize *bytes_written,GError **error),
34 #define CMD_UTF8_MACRO_ALLOCA(func,string) ({ \
35 const gchar *_cmd_utf8_macro_alloca_string=(string); \
36 gchar *_cmd_utf8_macro_alloca_r_malloc; \
37 const gchar *_cmd_utf8_macro_alloca_r; \
39 _cmd_utf8_macro_alloca_r_malloc=cmd_utf8_macro_malloc_errorchecking( \
41 _cmd_utf8_macro_alloca_string); \
42 if (!_cmd_utf8_macro_alloca_r_malloc) \
43 _cmd_utf8_macro_alloca_r=_cmd_utf8_macro_alloca_string; \
45 _cmd_utf8_macro_alloca_r=captive_strdup_alloca(_cmd_utf8_macro_alloca_r_malloc); \
46 g_free(_cmd_utf8_macro_alloca_r_malloc); \
48 _cmd_utf8_macro_alloca_r; \
52 #define CMD_FILENAME_TO_UTF8_ALLOCA(string) CMD_UTF8_MACRO_ALLOCA(g_filename_to_utf8,(string))
53 #define CMD_FILENAME_FROM_UTF8_ALLOCA(string) CMD_UTF8_MACRO_ALLOCA(g_filename_from_utf8,(string))
54 #define CMD_LOCALE_TO_UTF8_ALLOCA(string) CMD_UTF8_MACRO_ALLOCA(g_locale_to_utf8,(string))
55 #define CMD_LOCALE_FROM_UTF8_ALLOCA(string) CMD_UTF8_MACRO_ALLOCA(g_locale_from_utf8,(string))
58 #endif /* _CAPTIVE_CLIENT_CMDLINE_UTF8_H */