williamr@2
|
1 |
/* gstdio.h - GFilename wrappers for C library functions
|
williamr@2
|
2 |
*
|
williamr@2
|
3 |
* Copyright 2004 Tor Lillqvist
|
williamr@2
|
4 |
* Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
|
williamr@2
|
5 |
*
|
williamr@2
|
6 |
* GLib is free software; you can redistribute it and/or modify it
|
williamr@2
|
7 |
* under the terms of the GNU Lesser General Public License as
|
williamr@2
|
8 |
* published by the Free Software Foundation; either version 2 of the
|
williamr@2
|
9 |
* License, or (at your option) any later version.
|
williamr@2
|
10 |
*
|
williamr@2
|
11 |
* GLib is distributed in the hope that it will be useful,
|
williamr@2
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
williamr@2
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
williamr@2
|
14 |
* Lesser General Public License for more details.
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
* You should have received a copy of the GNU Lesser General Public
|
williamr@2
|
17 |
* License along with GLib; see the file COPYING.LIB. If not,
|
williamr@2
|
18 |
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
williamr@2
|
19 |
* Boston, MA 02111-1307, USA.
|
williamr@2
|
20 |
*/
|
williamr@2
|
21 |
|
williamr@2
|
22 |
#ifndef __G_STDIO_H__
|
williamr@2
|
23 |
#define __G_STDIO_H__
|
williamr@2
|
24 |
|
williamr@2
|
25 |
#include <_ansi.h>
|
williamr@2
|
26 |
#include <glib/gprintf.h>
|
williamr@2
|
27 |
|
williamr@2
|
28 |
#include <sys/stat.h>
|
williamr@2
|
29 |
|
williamr@2
|
30 |
G_BEGIN_DECLS
|
williamr@2
|
31 |
|
williamr@2
|
32 |
#if defined(G_OS_UNIX) && !defined(G_STDIO_NO_WRAP_ON_UNIX) && !defined(__SYMBIAN32__)
|
williamr@2
|
33 |
|
williamr@2
|
34 |
/* Just pass on to the system functions, so there's no potential for data
|
williamr@2
|
35 |
* format mismatches, especially with large file interfaces.
|
williamr@2
|
36 |
* A few functions can't be handled in this way, since they are not defined
|
williamr@2
|
37 |
* in a portable system header that we could include here.
|
williamr@2
|
38 |
*/
|
williamr@2
|
39 |
|
williamr@2
|
40 |
#define g_chmod chmod
|
williamr@2
|
41 |
#define g_open open
|
williamr@2
|
42 |
#define g_creat creat
|
williamr@2
|
43 |
#define g_rename rename
|
williamr@2
|
44 |
#define g_mkdir mkdir
|
williamr@2
|
45 |
#define g_stat stat
|
williamr@2
|
46 |
#define g_lstat lstat
|
williamr@2
|
47 |
#define g_remove remove
|
williamr@2
|
48 |
#define g_fopen fopen
|
williamr@2
|
49 |
#define g_freopen freopen
|
williamr@2
|
50 |
|
williamr@2
|
51 |
IMPORT_C int g_access (const gchar *filename,
|
williamr@2
|
52 |
int mode);
|
williamr@2
|
53 |
|
williamr@2
|
54 |
IMPORT_C int g_chdir (const gchar *path);
|
williamr@2
|
55 |
|
williamr@2
|
56 |
IMPORT_C int g_unlink (const gchar *filename);
|
williamr@2
|
57 |
|
williamr@2
|
58 |
IMPORT_C int g_rmdir (const gchar *filename);
|
williamr@2
|
59 |
|
williamr@2
|
60 |
#else /* ! G_OS_UNIX */
|
williamr@2
|
61 |
|
williamr@2
|
62 |
/* Wrappers for C library functions that take pathname arguments. On
|
williamr@2
|
63 |
* Unix, the pathname is a file name as it literally is in the file
|
williamr@2
|
64 |
* system. On well-maintained systems with consistent users who know
|
williamr@2
|
65 |
* what they are doing and no exchange of files with others this would
|
williamr@2
|
66 |
* be a well-defined encoding, preferrably UTF-8. On Windows, the
|
williamr@2
|
67 |
* pathname is always in UTF-8, even if that is not the on-disk
|
williamr@2
|
68 |
* encoding, and not the encoding accepted by the C library or Win32
|
williamr@2
|
69 |
* API.
|
williamr@2
|
70 |
*/
|
williamr@2
|
71 |
|
williamr@2
|
72 |
IMPORT_C int g_access (const gchar *filename,
|
williamr@2
|
73 |
int mode);
|
williamr@2
|
74 |
|
williamr@2
|
75 |
IMPORT_C int g_chmod (const gchar *filename,
|
williamr@2
|
76 |
int mode);
|
williamr@2
|
77 |
|
williamr@2
|
78 |
IMPORT_C int g_open (const gchar *filename,
|
williamr@2
|
79 |
int flags,
|
williamr@2
|
80 |
int mode);
|
williamr@2
|
81 |
|
williamr@2
|
82 |
IMPORT_C int g_creat (const gchar *filename,
|
williamr@2
|
83 |
int mode);
|
williamr@2
|
84 |
|
williamr@2
|
85 |
IMPORT_C int g_rename (const gchar *oldfilename,
|
williamr@2
|
86 |
const gchar *newfilename);
|
williamr@2
|
87 |
|
williamr@2
|
88 |
IMPORT_C int g_mkdir (const gchar *filename,
|
williamr@2
|
89 |
int mode);
|
williamr@2
|
90 |
|
williamr@2
|
91 |
IMPORT_C int g_chdir (const gchar *path);
|
williamr@2
|
92 |
|
williamr@2
|
93 |
IMPORT_C int g_stat (const gchar *filename,
|
williamr@2
|
94 |
struct stat *buf);
|
williamr@2
|
95 |
|
williamr@2
|
96 |
IMPORT_C int g_lstat (const gchar *filename,
|
williamr@2
|
97 |
struct stat *buf);
|
williamr@2
|
98 |
|
williamr@2
|
99 |
IMPORT_C int g_unlink (const gchar *filename);
|
williamr@2
|
100 |
|
williamr@2
|
101 |
IMPORT_C int g_remove (const gchar *filename);
|
williamr@2
|
102 |
|
williamr@2
|
103 |
IMPORT_C int g_rmdir (const gchar *filename);
|
williamr@2
|
104 |
|
williamr@2
|
105 |
IMPORT_C FILE *g_fopen (const gchar *filename,
|
williamr@2
|
106 |
const gchar *mode);
|
williamr@2
|
107 |
|
williamr@2
|
108 |
IMPORT_C FILE *g_freopen (const gchar *filename,
|
williamr@2
|
109 |
const gchar *mode,
|
williamr@2
|
110 |
FILE *stream);
|
williamr@2
|
111 |
|
williamr@2
|
112 |
#endif /* G_OS_UNIX */
|
williamr@2
|
113 |
|
williamr@2
|
114 |
G_END_DECLS
|
williamr@2
|
115 |
|
williamr@2
|
116 |
#endif /* __G_STDIO_H__ */
|