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